
Ultimate access to all questions.
A DevOps engineer has successfully implemented a CI/CD pipeline to deploy an AWS CloudFormation template that sets up a web application. This application includes an Application Load Balancer (ALB), a target group, a launch template using an Amazon Linux 2 AMI, an Auto Scaling group of EC2 instances, a security group, and an Amazon RDS for MySQL database. The launch template contains user data with a script to install and start the application. After a successful initial deployment, the engineer updates the application version in the user data. The CI/CD pipeline deploys the new version, but the ALB health checks now fail, marking all targets as unhealthy. Upon investigation, the CloudFormation stack shows a status of UPDATE_COMPLETE, but logs on an EC2 instance reveal that the Apache web server failed to start due to a configuration error. What method should the DevOps engineer use to ensure the CloudFormation deployment fails if the user data script does not execute successfully?_
A
Use the cfn-signal helper script to signal success or failure to CloudFormation. Use the WaitOnResourceSignals update policy within the CloudFormation template. Set an appropriate timeout for the update policy.
B
Create an Amazon CloudWatch alarm for the UnhealthyHostCount metric. Include an appropriate alarm threshold for the target group. Create an Amazon Simple Notification Service (Amazon SNS) topic as the target to signal success or failure to CloudFormation.
C
Create a lifecycle hook on the Auto Scaling group by using the AWS::AutoScaling::LifecycleHook resource. Create an Amazon Simple Notification Service (Amazon SNS) topic as the target to signal success or failure to CloudFormation. Set an appropriate timeout on the lifecycle hook.
D
Use the Amazon CloudWatch agent to stream the cloud-init logs. Create a subscription filter that includes an AWS Lambda function with an appropriate invocation timeout. Configure the Lambda function to use the SignalResource API operation to signal success or failure to CloudFormation.