Customized Notifications for EC2 Instance Scaling in Auto Scaling Groups | AWS Certified DevOps Engineer - Professional

Send Customized Notifications for EC2 Instance Scaling in Auto Scaling Groups

Prev Question Next Question

Question

You are a DevOps Engineer in your company.

There is a requirement to send customized notifications whenever an EC2 Instance is scaled in or scaled out in an Auto Scaling Group.

Which of the following steps can be implemented to fulfil this requirement? Each step forms part of the solution.

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

Answer - A and B.

The AWS documentation mentions the following.

You can run an AWS Lambda function that logs an event whenever an Auto Scaling group launches or terminates an Amazon EC2 instance and whether the launch or terminate event was successful.

Options A and B are correct because the CloudWatch Event rule can trigger the Lambda function and the function can perform the required actions.

Options C and D and incorrect because the SQS queue cannot send customized notifications by itself.

To send customized notifications whenever an EC2 instance is scaled in or scaled out in an Auto Scaling Group, the following steps can be implemented:

Step 1: Create a Lambda Function The first step is to create a Lambda function that will send customized notifications. Lambda is a serverless compute service that allows you to run code without provisioning or managing servers. You can use a Lambda function to send customized notifications when an EC2 instance is scaled in or scaled out. You can write the code for the Lambda function in Python, Node.js, or other supported languages.

Step 2: Create a CloudWatch Event Rule The next step is to create a CloudWatch event rule that triggers the Lambda function. CloudWatch is a monitoring service that allows you to collect and track metrics, collect and monitor log files, and set alarms. You can create an event rule that triggers the Lambda function whenever an EC2 instance is scaled in or scaled out in an Auto Scaling Group.

Step 3: Configure the CloudWatch Event Rule Once you have created the CloudWatch event rule, you can configure it to trigger the Lambda function. You can specify the conditions that trigger the event rule, such as when an EC2 instance is added or removed from the Auto Scaling Group. You can also specify the actions that the event rule should take, such as sending an email or SMS notification.

Therefore, options A and B are correct as they fulfill the requirement by creating a Lambda function and a CloudWatch event rule that triggers the Lambda function. Options C and D are not required to fulfill the requirement of sending customized notifications when an EC2 instance is scaled in or scaled out in an Auto Scaling Group, and therefore are not correct answers.