How can updates to the AMI be deployed to meet these requirements?
Create a change set for a new version of the template, view the changes to the running EC2 instances to ensure that the AMI is correctly updated, and then execute the change set.
Edit the AWS::AutoScaling::LaunchConfiguration resource in the template, changing its DeletionPolicy to Replace.
Edit the AWS::AutoScaling::AutoScalingGroup resource in the template, inserting an UpdatePolicy attribute.
Create a new stack from the updated template. Once it is successfully deployed, modify the DNS records to point to the new stack and delete the old stack.
Explanations:
A change set allows you to preview the changes, but it does not automatically trigger the replacement of EC2 instances or AMI updates. The stack update process is not fully automated through a change set alone.
Editing theLaunchConfigurationwith theDeletionPolicyset toReplacedoes not automatically update EC2 instances. This option does not ensure that the new AMI will be deployed properly.
TheUpdatePolicyattribute on theAutoScalingGroupcan be used to control the rolling update behavior. It ensures that the Auto Scaling group updates EC2 instances by replacing them with new ones using the updated AMI.
Creating a new stack and modifying DNS records would involve more manual steps and is not a direct solution for updating EC2 instances within a running stack. It is inefficient compared to using the UpdateStack method with the proper configuration.