How To Copy Key Pairs To Another AWS Region Using The ssh-keygen Command

Published Date Author: , Posted August 4th, 2021 at 2:02:08pm

I wanted to use the same SSH keys for multiple AWS regions. As it turns out, AWS simply stores the public key when you download the private key as a .pem file.

The solution is to simply generate the public key locally from the existing .pem, then import the public key using the same name in a different region.

Step 1: Generate public key from existing private key in .pem format:

Step 2: Import the generated public key into AWS:

Login to the AWS Console and navigate to EC2 -> Key Pairs, then choose Actions -> Import Key Pair in the upper-right corner of the page:

Finally, enter the name for the key pair, and either select the file or paste in the generated public key, then click “Import key pair” at the bottom right:


No comments as yet.

Leave Your Comment  Leave a comment

All fields marked with "*" are required.