Generating your ssh keys

By default, Amazon EC2 uses ssh key pairs to give you ssh access to your EC2 instances. You can either generate a key pair in EC2 and download the private key or generate a key yourself using a third-party tool such as OpenSSL and import the public key in EC2. We will use the first method:

$ aws ec2 create-key-pair --key-name EffectiveDevOpsAWS
{
  "KeyMaterial": "-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEAo6vZQ0BxnqdfZOSdcI66KRvypX0NwH5IEi6GUw06+
[...] sj4FAZVLp4OpaIeg+DxHaXUMx jVHiSRmxmXv2NJAaiJr/q4wMq+eUq3WLn/DKbIPWkfB5lqnGF2T/biie7igSvder3xE= -----END RSA PRIVATE KEY-----", "KeyName": "EffectiveDevOpsAWS", "KeyFingerprint": "d2:ec:b5:07:af:83:74:4c:9c:5f:d1:3c:37:86:1b:f0:9c:1b:c1:cf" }

The key is located in the KeyMaterial section of the JSON output. Save this output in a file. I recommend copying the output and using echo <paste> > file as this will interpret the characters:

$ echo "-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEAo6vZQ0BxnqdfZOSdcI66KRvypX0NwH5IEi6GUw06+
[...]
sj4FAZVLp4OpaIeg+DxHaXUMx
jVHiSRmxmXv2NJAaiJr/q4wMq+eUq3WLn/DKbIPWkfB5lqnGF2T/biie7igSvder3xE=
-----END RSA PRIVATE KEY-----" > ~/.ssh/EffectiveDevOpsAWS.pem
$ chmod 600 ~/.ssh/EffectiveDevOpsAWS.pem  
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset