You open an incident ticket and see that access to a private test host stopped at 14:32 UTC. The security group now has a different inbound source. Before restoring the previous rule, find the API call that changed it and identify whether it came from a person, an automation role, or an authorized rollout.
Start with the affected group and a short UTC window
Copy the security group ID and the Region from the affected EC2 resource. In CloudTrail Event history, look for EC2 management events around the incident. A rule edit can appear as ModifySecurityGroupRules. A console or infrastructure change can also appear as AuthorizeSecurityGroupIngress or RevokeSecurityGroupIngress. Search each relevant event name separately and inspect the event JSON for the group ID. Event history is Regional and covers the past 90 days of management events.
aws cloudtrail lookup-events --region "$AWS_REGION" \
--start-time "$START_UTC" --end-time "$END_UTC" \
--lookup-attributes AttributeKey=EventName,AttributeValue=ModifySecurityGroupRules \
--query 'Events[].{At:EventTime,ID:EventId,Event:CloudTrailEvent}'
Set the start and end variables to specific ISO 8601 UTC timestamps. The Event field is serialized JSON. Open it in the console or parse it before filtering nested fields. An empty lookup is a reason to check the Region, time filter, event name, and pagination.
Reconstruct what changed
In a candidate event, match requestParameters to the group or rule ID, and look at errorCode or errorMessage before treating the call as successful. Then read userIdentity. An AssumedRole event gives you the role session and issuer. The session name can be a lead, but it alone is a poor way to attribute a human. Cross-check it with the deployment run or identity-provider logs. Save the event ID, UTC time, and relevant rule fields in the incident record.
Revert at the source
If a stack or pipeline owns the group, correct the reviewed configuration there and redeploy through the usual process. A manual console fix can be overwritten by the next run. Verify that the intended CIDR or source group is restored and retry the original connection from the same source. Use a sandbox group and a harmless rule change to practice this process before you need it during an incident.





