Which set of actions will ensure that log files are copied to the central S3 bucket from the terminated EC2 instances?

1 Comment

  1. Ashley
    Author

    I draft that the answer is:
    Create an AWS Systems Manager document with a script to copy log files to Amazon S3. Create an Auto Scaling lifecycle hook and an Amazon EventBridge rule to detect lifecycle events from the Auto Scaling group. Invoke an AWS Lambda function on the autoscaling:EC2_INSTANCE_TERMINATING transition to call the AWS Systems Manager API SendCommand operation to run the document to copy the log files and send CONTINUE to the Auto Scaling group to terminate the instance.

Leave a Reply

Your email address will not be published. Required fields are marked *

three × four =