18

I'm trying to set up the EC2 API tools and I'm stuck because I cannot figure out where I can obtain the file pointed to by the EC2_PRIVATE_KEY environment variable (I believe I have the EC2_CERT).

Of the multitude of different access credentials visible in the EC2 user interface, which one do I need to make the command line tools work?

3 Answers3

24

Ok, turns out that I need to generate a new X.509 certificate, and then I'll be able to download both the EC2_PRIVATE_KEY and the EC2_CERT files.

This link proved useful: http://paulstamatiou.com/how-to-getting-started-with-amazon-ec2

7

The private key is only downloadable at the moment you create the certificate.

fastmultiplication
  • 231
  • 1
  • 2
  • 9
1

http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html

Note

Amazon EC2 doesn't keep a copy of your private key; therefore, if you lose a private key, there is no way to recover it. If you lose the private key for an instance store-backed instance, you can't access the instance; you should terminate the instance and launch another instance using a new key pair. If you lose the private key for an EBS-backed Linux instance, you can regain access to your instance. For more information, see Connecting to Your Linux Instance if You Lose Your Private Key.

And here are steps for recovery (by generating a new key pairs):

https://forums.aws.amazon.com/thread.jspa?threadID=102074