How can I update the AMI in an Auto Scaling configuration after updating code in an EC2 instance? I don't need to use AWS CodeDeploy.
I have simple script, but it is still requires me to manually type the Image ID:
1) Create AMI
aws ec2 create-image --instance-id i-0b09axxx --name "My server" --no-reboot
2) Create new Auto Scaling Launch Configuration
aws autoscaling create-launch-configuration --launch-configuration-name "new-launch-configuration-name" --image-id "new-AMI-id"
3) Update Auto Scaling Launch Configuration with new AMI
aws autoscaling update-auto-scaling-group --auto-scaling-group-name "current-autoscaling-group-name" --launch-configuration-name "new-launch-configuration-name"
4) Delete old Auto Scaling Launch Configuration
aws autoscaling delete-launch-configuration --launch-configuration-name "old-launch-configuration-name"