- Newest
- Most votes
- Most comments
A ssh private key (PEM key), is a security credentials that you use to prove your identity when connecting to an Amazon EC2 instance. Neither it has relation with AWS Account nor with AWS regions, rather it is related to the machine/instance.
For Linux instances, the private key allows you to securely SSH into your instance. Key pair can be created using the Amazon EC2 console or a third-party tool.
If you specify a key pair at launch, when your instance boots for the first time, the public key material is placed on your Linux instance in an entry within ~/.ssh/authorized_keys
. Additionally you may append the public key on the Linux instance for a specific user, the path to the file is ~/.ssh/authorized_keys
.
To fetch the public key from a private key (PEM), you may execute the following command:
$ ssh-keygen -yf ssh_key_name.pem
Since you are able to use the same private key, you must see same public key hash on both the instances in ~/.ssh/authorized_keys
.
Anyone who has the .pem
can ssh to your instance without the need for any other AWS credentials since the associated public key is available on the instance.
You may refer:
Amazon EC2 key pairs and Linux instances: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html
Add or remove a public key on your instance: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html
You may also refer the following third-party article:
What is SSH Public Key Authentication? https://www.ssh.com/academy/ssh/public-key-authentication
Relevant content
- asked 2 years ago
- asked 2 months ago
- Accepted Answerasked 2 months ago
- asked 4 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 10 months ago
Whay do you mean by account pem ?
Question makes no sense
can you clarify and give more context?
I mean that I am able to use access key of aws account A to access EC2 instance of another aws account B in same region.