A CloudFormation template deploys an application to Amazon Linux EC2 instances using user data shell scripts. Instances have an instance profile with AmazonSSMManagedInstanceCore. After updating user data in the template and performing a stack update, running EC2 instances did not receive the updated application. What combination of actions will ensure the running instances get the application updates? (Choose two.)
Choose an answer
Tap an option to check your answer.
Correct answer: Refactor the user data to use the cfn-init helper script, and update user data to install and configure cfn-hup and cfn-init so they watch and apply metadata changes., Refactor the user data commands into an AWS Systems Manager document and use Systems Manager State Manager to create an association between the document and the EC2 instances..
Why this is the answer
The problem describes a scenario where user data updates are not applied to running EC2 instances. User data scripts execute only once when an instance is launched. Refactoring user data to use cfn-init and cfn-hup is a correct solution. cfn-init processes metadata from the CloudFormation template, and cfn-hup daemon runs on the instance, monitoring for changes to the instance's metadata and triggering cfn-init to apply updates when detected. This ensures running instances receive updates without replacement. Refactoring user data commands into an AWS Systems Manager document and using State Manager is also correct. State Manager allows you to define and maintain a desired state for your instances. An association can be created to run the SSM document periodically or on demand, applying updates to running instances. The other options are incorrect: Formatting user data as MIME multipart or using scripts-user does not change the fundamental behavior that user data runs only at launch. Creating a new launch template and Auto Scaling group with AutoScalingScheduledAction would replace instances, not update existing ones. Using an AWS CLI call within user data to run an SSM document via Run Command would still only execute at launch. State Manager is needed for continuous management.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed