How can I troubleshoot unusual resource activity with my AWS account?
Last updated: 2021-10-19
I want to determine which AWS Identity and Access Management (IAM) user created a resource and restrict access.
Unauthorized account activity, such as new services that are unexpectedly launched, can indicate that your AWS credentials are compromised. Someone with malicious intent can use your credentials to access your account and perform activities permitted by the policies. For more information, see What do I do if I notice unauthorized activity in my AWS account and the AWS Customer Agreement.
Identify the compromised IAM user and access key. Then, disable them. Use AWS CloudTrail to search for API event history associated with the compromised IAM user.
In the following example, an Amazon Elastic Compute Cloud (Amazon EC2) instance launched unexpectedly.
Note: These instructions apply to long-term security credentials, not temporary security credentials. To disable temporary credentials, see Disabling permissions for temporary security credentials.
Identify the Amazon EC2 instance ID
- Open the Amazon EC2 console, and then choose Instances.
- Choose the EC2 instance, and then choose the Description tab.
- Copy the Instance ID.
Locate the IAM access key ID and user name used to launch the instance
- Open the CloudTrail console, and then choose Event history.
- Select the Filter dropdown list, and then choose Resource name.
- In the Enter resource name field, paste the EC2 instance ID, and then choose enter on your device.
- Expand the Event name for RunInstances.
- Copy the AWS access key, and then note the User name.
Disable the IAM user, create a backup IAM access key, and then disable the compromised access key
- Open the IAM console, and then paste the IAM access key ID in the Search IAM bar.
- Choose the user name, and then choose the Security credentials tab.
- In Console password, choose Manage.
Note: If the AWS Management Console password is set to Disabled, you can skip this step.
- In Console access, choose Disable, and then choose Apply.
Important: Users whose accounts are disabled can't access the AWS Management Console. However, if the user has active access keys, they can still access AWS services using API calls.
- Follow the instructions to rotate access keys for an IAM user without interrupting your applications (console).
- For the compromised IAM access key, choose Make inactive.
Review CloudTrail event history for activity by the compromised access key
- Open the CloudTrail console, and then choose Event history from the navigation pane.
- Select the Filter dropdown menu, and then choose AWS access key filter.
- In the Enter AWS access key field, enter the compromised IAM access key ID.
- Expand the Event name for the API call RunInstances.
Note: You can view event history for the last 90 days.
You can also search CloudTrail event history to determine how a security group or resource was changed and API calls that run, stop, start, and terminate EC2 instances.
For more information, see Viewing events with CloudTrail event history.