Auditing and Logging Admin Sessions
Record every command an operator runs for accountability.
Auditing and Logging Admin Sessions is a free AWS Security Academy lesson on CoddyKit — lesson 3 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the AWS Security Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
Accountability for Admins
Granting administrative access is only half the job; you must also record what administrators do. Session Manager provides rich logging so every command and session is accountable. The SCS-C02 exam stresses this auditability as a core advantage over SSH, where command-level logging is hard to centralize.
Two Layers of Logging
Session Manager logging has two layers: API-level logging of who started and stopped sessions, captured by CloudTrail, and session-content logging of the actual keystrokes and output, sent to CloudWatch Logs or S3. Together they answer both "who connected" and "what did they do."
CloudTrail for Session Events
CloudTrail records the StartSession and TerminateSession API calls, showing which IAM identity connected to which instance and when. Because these are management events, they appear in your trail automatically, giving a reliable, tamper-evident record of administrative access for investigations.
Logging Session Content
To capture the commands and output inside a session, you enable session logging in Session Manager preferences, directing it to an S3 bucket or a CloudWatch Logs group. Now every keystroke an operator types and every result returned is stored, the closest thing to a video recording of the session.
Protecting the Logs
Session logs are evidence, so they must be tamper-resistant. Store them in a dedicated, locked-down S3 bucket, ideally in a separate logging account, with encryption and restrictive policies. This ensures an administrator, even a malicious one, cannot delete the record of their own session.
Encrypting Session Logs
You can require KMS encryption for both the live session data and the stored logs. Enforcing encryption means session content is protected at rest and in transit, meeting compliance mandates and ensuring sensitive commands or outputs are never exposed in plaintext.
Run Command Auditing
Beyond interactive sessions, SSM Run Command executes commands across many instances at once, and it is fully audited too. Each invocation is logged with who ran it, on which targets, and the output, so even fleet-wide administrative actions carry the same accountability as a single session.
Real-Time Notifications
You can wire session events to EventBridge and SNS to get real-time alerts when a session starts, especially on sensitive instances. A notification the moment someone connects to a production database server lets your security team watch privileged access as it happens, not after the fact.
Why Auditing Matters
Complete session auditing supports incident response, compliance, and deterrence. Knowing every action is recorded discourages misuse, and when an incident occurs, investigators can replay exactly what an operator did. This end-to-end accountability is a decisive reason the exam favors Session Manager over key-based SSH.
Restricting Shell Commands
You can tighten sessions further by using SSM documents that limit a session to specific actions, and by disabling interactive shells for certain roles. Combined with logging, this means even an authorized operator is constrained to approved activity, narrowing what a compromised account could do while every action stays recorded.
Putting It Together
Session Manager auditing combines CloudTrail for StartSession/TerminateSession API events with session-content logging to S3 or CloudWatch Logs, optionally KMS-encrypted. Protect logs in a locked-down, separate account, audit Run Command the same way, and use EventBridge/SNS for real-time alerts on privileged access.
Quick Check
Test session auditing.
Recap
Session Manager auditing has two layers: CloudTrail records StartSession/TerminateSession API events, while session-content logging sends keystrokes and output to S3 or CloudWatch Logs, optionally KMS-encrypted. Protect logs in a separate, locked-down account, audit Run Command too, and alert in real time via EventBridge/SNS.
Frequently asked questions
Is the “Auditing and Logging Admin Sessions” lesson free?
Yes — the full text of “Auditing and Logging Admin Sessions” is free to read here on the web, and the AWS Security Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the AWS Security Academy course, upgrade to CoddyKit PRO.
What will I learn in “Auditing and Logging Admin Sessions”?
Record every command an operator runs for accountability. You practise AWS Security Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start AWS Security Academy?
No prior experience is required. AWS Security Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 3 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Auditing and Logging Admin Sessions” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this AWS Security Academy lesson?
Yes. Every AWS Security Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- Why Bastion Hosts Add Risk
- Session Manager Without Open Ports
- Auditing and Logging Admin Sessions
- Hardening Endpoints and Patch Manager