Join our Newsletter — 33% off our NHI Course

How do you enable logging of ECS Exec sessions in Amazon ECS?

Enable ECS Exec session logging by configuring the cluster and task environment so session output is sent to the logging destination you use for audit review. Verify that the required IAM permissions and log delivery path are in place, then test that interactive commands are recorded. Without logging, administrative shell access can go unaudited.

What actually turns ECS Exec into an auditable access path?

ECS Exec becomes auditable only when the session is treated as a recorded administrative action, not just an interactive shell. You need the cluster and task environment configured so the session transcript or command stream is delivered to a logging destination you already trust for review, and the IAM path must allow both the exec action and the log delivery flow.

That matters because ECS Exec can otherwise create a high-trust break-glass path into running containers. If the session is not logged, you may still have control-plane visibility, but you do not have the evidence needed to answer who connected, what they ran, or whether the session was used for legitimate troubleshooting.

Which AWS-side settings usually determine whether logs appear?

The practical dependency is usually not the shell itself, but the surrounding execution environment. Session logging has to be enabled in the ECS configuration that governs exec sessions, and the destination you choose, such as a CloudWatch Logs group or S3-based archive, must be reachable and writable from the task and the supporting AWS services.

Check the parts that commonly fail first: the task role or execution role missing permissions, the log destination policy blocking writes, or the cluster settings pointing at a destination that is not actually receiving session output. If the service can start an interactive session but the destination never receives records, you have operational access without auditability.

For containerised workloads, it is also worth checking the broader runtime posture in NHIMG’s Container Security Guide, because exec access sits on top of the same container and host assumptions that govern isolation, hardening, and escape risk.

How should you validate that ECS Exec logging is really working?

Do not assume that an enabled setting means the logs are usable. Run a simple interactive command through ECS Exec, then verify that the resulting session evidence lands in the expected destination with enough detail to support audit review. The test should confirm both availability and fidelity, not just that a session opened successfully.

Make the check specific: confirm timestamps, task identity, operator identity, and the command transcript or session record that your logging mode is supposed to capture. If the output is partial, delayed, or routed to an unexpected location, treat the control as incomplete until the log path is corrected and retested.

When the access path matters more than the workload itself, the relevant control question is often whether the session can be traced back to an accountable identity. That is why IAM permissions, session recording, and access review belong together rather than being handled as separate chores.

Risk and Threat Considerations

ECS Exec creates an administrative pathway that can bypass normal application interfaces, so the main risk is unaudited interactive access inside a live container. If that path is misconfigured or not logged, an operator, or an attacker using stolen credentials, can inspect data, alter state, or stage follow-on actions with much less visibility than through the application layer.

Failure mechanism: The cluster allows exec sessions, but the permissions or log delivery path are incomplete, so the session succeeds without durable audit evidence. That breaks the assumption that every privileged interactive action will leave a record.

Impact: You lose forensic traceability and weaken deterrence, because the environment can no longer prove what was done during the session or whether a legitimate troubleshooting action crossed into risky administrative change.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

NIST SP 800-53 Rev 5 and CIS Controls v8 set the governance and control requirements practitioners need to meet.

Framework Control / Reference Relevance
NIST SP 800-53 Rev 5 AU-2 — Event Logging ECS Exec logging is an audit trail requirement for privileged session activity.
AC-6 — Least Privilege Exec sessions grant elevated interactive access and should be constrained to need-to-use cases.
Recommendation — Define and retain exec-session events for audit review and incident investigation. Limit ECS Exec access to only the tasks and operators that need it.
CIS Controls v8 CIS-8 — Audit Log Management Session logging must be centralized, protected, and reviewable to support accountability.
CIS-5 — Account Management Enabling ECS Exec depends on tightly governed operator and task access paths.
Recommendation — Centralise and review ECS Exec logs so interactive access is traceable. Restrict who can invoke ECS Exec and review those accounts regularly.

Practitioner Guidance

What to verify: Confirm that the log destination, task role, and cluster exec settings all line up before you rely on ECS Exec for production support. A working shell is not enough; the control only succeeds if the session is also reviewable after the fact.

Common mistake: Teams often test command execution and stop there. The better test is to prove that the command, the operator context, and the session record are all recoverable in the system you use for audit and incident review.

Practitioner takeaway: Treat ECS Exec logging as a control over privileged access, not a cosmetic logging setting, and do not approve it for sensitive workloads until you have verified end-to-end recording.