Starting EC2 instances
In the previous recipes, we only retrieved facts about our currently running infrastructure. But we still had to create the necessary resources so that something shows up using the console. While this is a painless process in the web browser, in this recipe, we want to explore how to launch an EC2 instance using boto3.
Getting ready
Open your code editor and start by creating a file called create_ec2.py
. Next, navigate your terminal to the same directory that you just created the create_ec2.py
file in.
You'll have to have the authentication set up as described in the Setting up the library to interact with your AWS account recipe.
Additionally, you will need a previously set up SSH key pair. This is not the key pair that we used for authenticating to the API, but rather an SSH key that can be used to log into the instance itself via SSH once launched. You can create this key pair in the console. You can find a guide on how to do this at https...