Skip to main content
In this walkthrough, you’ll learn how to pinpoint the IAM user who terminated an EC2 instance (ID ends with 1D91) using AWS CloudTrail’s Event History. This helps you audit critical API calls and enhance security visibility.

1. Access CloudTrail Event History

  1. Sign in to the AWS Management Console and search for CloudTrail.
  2. In the left-hand menu, select Event history.
  3. Adjust the time range and apply filters as needed to narrow down results.
By default, Event history shows all recorded API calls, such as:
  • CreateBucket
  • PutBucketEncryption
  • ConsoleLogin
  • TerminateInstances
Ensure your IAM user or role has the cloudtrail:LookupEvents permission to view event history.

2. Filter for TerminateInstances Events

  1. In the Event name filter, type TerminateInstances.
  2. (Optional) Under Resource name, enter the instance ID:
Now you should see the specific TerminateInstances event for the target instance. The summary row displays the IAM user, timestamp, and event name.

3. Inspect Event Details

Click the TerminateInstances entry to expand the details pane. You’ll find several sections:

3.1 User Identity & Metadata

This indicates:
  • IAM user John (principalId: AIDAZZBPMTHEGGK6QLMU)
  • Event timestamp: 2023-10-16T17:25:20Z
  • API source: ec2.amazonaws.com

3.2 Instance State Transition

Scroll down to Response elements to view the state change:
This confirms the TerminateInstances call initiated a shutdown.

4. Summary of Event Record

At the bottom of the details pane, you’ll find additional metadata:
From this audit trail, you’ve confirmed that John executed the TerminateInstances API call, changing the instance from running to shutting-down.

5. Automate Alerts with EventBridge

Integrate these CloudTrail logs with Amazon EventBridge (formerly CloudWatch Events) to trigger alerts or remediation workflows when critical actions occur:
Attach a target (e.g., SNS topic, Lambda function) to notify your team or perform automated checks.

References

Watch Video