Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

single keypair for all regions

Can I use the same key pair file across all regions? I want to keep the ssh access as simple as possible.

I have set up one file for each region. I tried to upload the same file in different region but it did not not work as expected.

like image 840
shantanuo Avatar asked Apr 18 '12 10:04

shantanuo


People also ask

Can I use same key pair in different regions?

Importing the SSH key pair Congratulations, now you can use the same SSH key to access all your instances in the regions where you copied it.

How can I use a single SSH key pair for all my AWS regions?

To use a single SSH key pair for all your AWS Regions, first generate a public SSH key from a private SSH key. Then, import the key into each of your AWS Regions. Note: If you receive errors when running AWS Command Line Interface (AWS CLI) commands, make sure that you're using the most recent AWS CLI version.

Is AWS key pair region specific?

The key pairs that you create using Amazon EC2 are tied to the Region where you created them. You can create your own RSA key pair and upload it to the Region in which you want to use it; therefore, you can make your key pair globally available by uploading it to each Region.

Can you only have one SSH key?

If you use only one key, then even when only one key is loaded in your agent, all sites are open to the rogue. This has nothing to do with the passphrases, you could have several keys with the same passphrase that would make no difference here.


1 Answers

This has meanwhile been enabled by means of importing your own keypair(s), see the introductory post New Amazon EC2 Feature: Bring Your Own Keypair:

You can now import your own RSA keypair (or the public half, to be precise) for use with your Amazon EC2 instances.

Why would you want to do this? Here are a couple of reasons:

  1. Trust - By importing your own keypair you can ensure that you have complete control over your keys.
  2. Security -You can be confident that your private key has never been transmitted over the wire.
  3. Management of Multiple Regions - You can use the same public key across multiple AWS Regions. [emphasis mine]

This approach is quite beneficial/convenient indeed - I'm using it for a while already, and it has considerably simplified EC2 usage across multiple regions and accounts.

Eric Hammond provides more details and a short tutorial in his article Uploading Personal ssh Keys to Amazon EC2:

Amazon recently launched the ability to upload your own ssh public key to EC2 so that it can be passed to new instances when they are launched. Prior to this you always had to use an ssh keypair that was generated by Amazon.

Accordingly, I recommend to follow his article regarding the (few and simple) steps required to achieve this.

like image 169
Steffen Opel Avatar answered Sep 19 '22 21:09

Steffen Opel