The next exercise will be to spin off a new instance using the user data feature. This way, we will have a means to execute a series of instructions on the operating system automatically, as a post-creation process.
We will use a text file as a reference for the bootstrapping scripts. This set of instructions will be executed internally by the cloud-init open source package.
This command will also reference the default security group (you can find the ID by navigating within the console and selecting the current instance properties). To set this up, let's go through the following steps:
- We will provision our new instance by using the following user data input file. You can find this file in the GitHub repository under chapter02/bootstrap.txt:
aws ec2 run-instances --image-id ami-14c5486b --key-name BookShelfApp --instance-type t2.medium --security-group-ids...