PART-B AWS AMI Automation using (SSM) Systems Manager Automation service Automating the Creation and Management of Amazon Machine Images (AMIs)
Steps to be performed by this automation:
Step 1. Create an Amazon Machine Image (AMI) from the provided instance ID
Step 2. Update the existing launch template version using the AMI created in Step 1
Step 3. Start refreshing instances in the Auto Scaling group using the launch template
Before you begin
Complete the following tasks before you begin this example.
Configure IAM roles for Automation, a capability of AWS Systems Manager. The Systems Manager requires an instance profile role and a service role ARN to process automation. For more information, see Setting up Automation.
Search for Systems Manager service > Click on Documents
Now click on Owned by me
Create a document then click on the automation
Enter the name Choose the Editor tab, and choose Edit.
Click on Editor then Edit
Choose OK when prompted, and delete the content in the Document editor field.
In the Document editor field, paste the following YAML below is the runbook content.
Choose to Create automation button.
- In the navigation pane, choose Automation, and then choose Execute automation.
- In the Choose document page, choose the Owned by me tab.
- Search for the PatchAMIAndUpdateASG runbook, and select the button in the PatchAMIAndUpdateASG card.
- Choose Next.
- Choose Simple execution.
Click on Execute
To see your running executions go to executions pannel
Below you can see the executions
Click on the Execution ID
All steps have run successfully.
 Create a new image -
 StartInstanceRefresh — https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_StartInstanceRefresh.html
 Updating AMIs for Auto Scaling — groupshttps://docs.aws.amazon.com/systems-manager/latest/userguide/automation-tutorial-update-patch-windows-ami-autoscaling.html