Ends in
00
days
00
hrs
00
mins
00
secs
LEARN MORE

Cyber Week Sale: HUGE DISCOUNTS on ALL COURSES!

Find answers, ask questions, and connect with our
community around the world.

Home Forums AWS AWS Certified Solutions Architect Associate ASG life cycle and Lambda

  • pskarthic

    Member
    August 13, 2021 at 12:59 pm

    A company has an application hosted in an Auto Scaling group of Amazon EC2 instances across multiple Availability Zones behind an Application Load Balancer. There are several occasions where some instances are automatically terminated after failing the HTTPS health checks in the ALB and then purges all the ephemeral logs stored in the instance. A Solutions Architect must implement a solution that collects all of the application and server logs effectively. She should be able to perform a root cause analysis based on the logs, even if the Auto Scaling group immediately terminated the instance.

    What is the EASIEST way for the Architect to automate the log collection from the Amazon EC2 instances?

    Correct answer:

    Add a lifecycle hook to your Auto Scaling group to move instances in the Terminating state to the Terminating:Wait state to delay the termination of unhealthy Amazon EC2 instances. Configure a CloudWatch Events rule for the EC2 Instance-terminate Lifecycle Action Auto Scaling Event with an associated Lambda function. Trigger the CloudWatch agent to push the application logs and then resume the instance termination once all the logs are sent to CloudWatch Logs.


    The only thing I am not able to understand is, why Lambda is used? Can you guys please check this and clarify me?

  • Carlo-TutorialsDojo

    Member
    August 14, 2021 at 6:04 am

    Hello pskarthic,

    Thank you for your feedback.

    Based on the answers given and the scenario, CloudWatch Events is used to monitor the terminating auto-scaling event. If that event happens, CW will invoke a Lambda function that triggers the CW agent inside the affected instance. The CW agent publishes the logs before terminating the instance.

    Regards,

    Carlo @ Tutorials Dojo

Viewing 1 - 2 of 2 replies

Log in to reply.

Original Post
0 of 0 posts June 2018
Now