This example follows the SSM Command post on my blog. It creates two SSM Command Documents:
- A multi-platform command document with the script embedded in the document
- A command document that retrieves the script from S3 and executes it on the instance
In order to use this, you need to have terraform on your machine.
Within this directory you'll need a file named secret.tf, which will contain:
locals {
ip_address = "YOUR_IP_ADDRESS/32"
}Ensuring that you replace YOUR_IP_ADDRESS with the IP address of your machine, so that you can connect to it and administrate it - however it is not required for the exercise.
You'll need a key pair for being able to log onto the EC2 machines created.
ssh-keygen -t rsa -b 4096 -m PEM -f vm_base
mv vm_base vm_base.pemUse Terraform to deploy to your account.
terraform init
terraform apply