OK, here we go! Amazon Elastic Compute Cloud (EC2) is the heart of AWS. It consists of many different assets you need to understand before an EC2 instance (server) becomes operational. The different features will be introduced in the order in which they are needed.
A key pair is one of the ways AWS handles security. It is also the only way to get into your fresh instance the first time you launch it. You can create a Secure Shell (SSH) key pair and pass it on to the instance you launch. The public key will be stored in the instance in the right place, while you keep the private key to log in to your instance.
You can create a key pair through the AWS Console. Go to Key Pairs and click Create Key Pair. Give it a name and store the downloaded private key somewhere safe (Figure 2-5)—you won’t be able to download it again.
You can also import your own existing SSH key pair to AWS using
ec2-import-keypair command, like in the following
ec2-import-keypair --region us-east-1 --public-key-file .ssh/id_rsa.pub arjan
arjan is the name of the key pair. You
have to import your key pair to each region where you will use
Remember when we set up the command-line tools? If you look at that script, you can see we created a directory for the other certificates. This is a good place to store the key pair too. It also gives you a way to organize your files if you work with multiple AWS accounts.
Figure 2-5. Create a key pair