QuestionQ57

Incident and Event Response

A production account requires that every Amazon EC2 instance that has been manually logged in to be terminated within 24 hours. All applications in the production account use Auto Scaling groups with the Amazon CloudWatch Logs agent configured.

How can this process be automated?

Explanation

A CloudWatch Logs subscription filter can send matching manual-login log events to a Lambda function. That function can tag the originating EC2 instance for decommissioning, and an Amazon EventBridge daily schedule can invoke another Lambda function to terminate all instances with that tag. This provides an automated cleanup process within the required time window; Auto Scaling groups can replace terminated application instances as needed.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!