AWS Certified SysOps Administrator – Associate — Question 331
A company has developed a service that is deployed on a fleet of Linux-based Amazon EC2 instances that are in an Auto Scaling group. The service occasionally fails unexpectedly because of an error in the application code. The company's engineering team determines that resolving the underlying cause of the service failure could take several weeks.
A SysOps administrator needs to create a solution to automate recovery if the service crashes on any of the EC2 instances.
Which solutions will meet this requirement? (Choose two.)
Answer options
- A. Install the Amazon CloudWatch agent on the EC2 instances. Configure the CloudWatch agent to monitor the service. Set the CloudWatch action to restart if the service health check fails.
- B. Tag the EC2 instances. Create an AWS Lambda function that uses AWS Systems Manager Session Manager to log in to the tagged EC2 instances and restart the service. Schedule the Lambda function to run every 5 minutes.
- C. Tag the EC2 instances. Use AWS Systems Manager State Manager to create an association that uses the AWS-RunShellScript document. Configure the association command with a script that checks if the service is running and that starts the service if the service is not running. For targets, specify the EC2 instance tag. Schedule the association to run every 5 minutes.
- D. Update the EC2 user data that is specified in the Auto Scaling group's launch template to include a script that runs on a cron schedule every 5 minutes. Configure the script to check if the service is running and to start the service if the service is not running. Redeploy all the EC2 instances in the Auto Scaling group with the updated launch template.
- E. Update the EC2 user data that is specified in the Auto Scaling group's launch template to ensure that the service runs during startup. Redeploy all the EC2 instances in the Auto Scaling group with the updated launch template.
Correct answer: A, C
Explanation
Option A is correct because the Amazon CloudWatch agent can monitor internal system logs and services, allowing you to trigger a restart action if the health check fails. Option C is correct because AWS Systems Manager State Manager allows you to define a consistent state for EC2 instances, such as ensuring a service is running, and can execute a script via AWS-RunShellScript on a 5-minute schedule. Options B, D, and E are incorrect because Lambda cannot easily leverage Session Manager for periodic CLI scripts, user data only runs once at instance launch rather than continuously, and ensuring startup execution does not remediate post-launch crashes.