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 Answers 3

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

3
  • Hey - thanks so much for answering your own question! It's really helpful for others when we arrive here from Google. :) PW Jun 20, 2011 at 21:13
  • I can't find where "AWS Access Identifiers page" is!
    – Stewie
    May 29, 2012 at 17:49
  • Same problem and solution: stackoverflow.com/questions/10369547/…
    – realjin
    Mar 4, 2015 at 3:24
7

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

2
  • Very helpful. I can only have two access keys so I deleted one, created another and then downloaded the credentials as a CSV. Worked great! Thanks! Jan 25, 2013 at 19:50
  • How do I download the private key from Amazon AWS? Jan 28, 2014 at 16:53
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

You must log in to answer this question.