Launching an instance
There will be scenarios—usually when testing and developing your infrastructure code—when you need quick access to an instance. Creating it via the AWS CLI is the quickest and most consistent way to create one-off instances.
There are other recipes in the book that will require a running instance. This recipe will get you started.
Getting ready
For this recipe, you must have an existing key pair.
In this recipe, we are launching an instance of AWS Linux using an AMI ID in the us-east-1
region. If you are working in a different region, you will need to update your image-id
parameter.
You must have configured your AWS CLI tool with working credentials.
How to do it...
Run the following AWS CLI command, using your own key-pair name:
aws ec2 run-instances \ --image-id ami-9be6f38c \ --instance-type t2.micro \ --key-name <your-key-pair-name>
How it works...
While you can create an instance via the AWS web console, it involves many distracting options. When developing and...