Systems Manager Automation enables you to run a sequence of workflows (e.g., AWS API calls, provisioning instances, creating buckets, and firing off Lambda functions) through the convenience of a single SSM Automation document. In this hands-on lab, we’ll dive into a custom AWS SSM Automation document and see how it works. AWS Automation can help you automate mundane or repetitive tasks for maintenance or deployment of your hybrid infrastructure. Via a series of steps/actions defined in either JSON or YAML, SSM Automation offers useful plugins to carry out commands/API calls — thus opening up many possibilities for a hands-off approach to your hybrid infrastructure management.
Successfully complete this lab by achieving the following learning objectives:
- Log in to the AWS Management Console and Navigate to Systems Manager
- Log in to the AWS Management Console using the credentials provided.
- Navigate to the Systems Manager console.
- In the left-hand menu, click Automation (under Application Management).
- Create Automation Document
- Click Execute automation.
- Click Create Document, and choose the Editor tab.
- Click Edit. If a warning pops up, it’s safe to ignore, so click OK.
- Copy the SSM Automation document JSON here.
- Paste the contents of the JSON document into the form under Editor, and click Create automation. You’ll then be taken back to the Documents SSM page.
- Provide Inputs and Execute Automation Document
- On the upper part of the screen, click the Owned by me tab to list the Automation document we just created.
- Click Execute automation. You’ll be taken to the configuration and input page for the Automation document.
- Leave EC2IamRole set to MyEC2SSMRole.
- In the Application dropdown, select the application you want to deploy. (In the lab video, we deploy mariadb-server.)
- Click Execute to run your automation.
- Track Automation Progress Status
Once you click Execute, you’ll be taken to the main Automation page, where it will list all the steps in the automation, as well as actions and status against those steps.
Wait for the Automation status, which should be on top right side of the screen, to display Success.
Note: Automation can fail if any of the mandatory steps fail.
- Use Session Manager to Log in to SSM Automation’s Spun-Up EC2 Instance
Navigate to Session Manager, click Start Session, and select the EC2 instance tagged SSM-Created-EC2.
Click Start session to start a shell session with the instance, and verify the Automation document successfully ran through and deployed as planned.
mariadb-serverinput, use the following to verify:
sudo systemctl status mariadb
This should show an
mysql -uroot -pmysecureencryptedpassword
This should log you in to the database shell prompt.
httpdinput, use the following to verify:
sudo systemctl status httpd
This should show an
This should return a blob of HTML output confirming the web server is working.