Which combination of steps will meet these requirements?
(Choose two.)
Configure the user data content to use the Multipurpose Internet Mail Extensions (MIME) multipart format. Set the scripts-user parameter to always in the text/cloud-config section.
Refactor the user data commands to use the cfn-init helper script. Update the user data to install and configure the cfn-hup and cfn-init helper scripts to monitor and apply the metadata changes.
Configure an EC2 launch template for the EC2 instances. Create a new EC2 Auto Scaling group. Associate the Auto Scaling group with the EC2 launch template. Use the AutoScalingScheduledAction update policy for the Auto Scaling group.
Refactor the user data commands to use an AWS Systems Manager document (SSM document). Add an AWS CLI command in the user data to use Systems Manager Run Command to apply the SSM document to the EC2 instances.
Refactor the user data command to use an AWS Systems Manager document (SSM document). Use Systems Manager State Manager to create an association between the SSM document and the EC2 instances.
Explanations:
Using MIME multipart format and setting the scripts-user parameter to always does not guarantee the new application version will be installed on the running instances. User data only executes at instance launch, not on updates, which is the core issue here.
Refactoring user data to use the cfn-init helper script allows for proper application of metadata changes. cfn-init can apply updates and reconfigure the instances based on CloudFormation stack changes.
Using an EC2 launch template and Auto Scaling does not directly address updating applications on running EC2 instances. It focuses more on managing instance lifecycle and scaling, not patching running instances.
Using SSM documents via Run Command requires additional configuration and doesn’t directly address user data to apply changes. It would not automatically apply updates as part of the CloudFormation stack update.
Refactoring user data to use an SSM document with Systems Manager State Manager ensures that the EC2 instances receive and apply the application update consistently across all instances when the stack is updated.