Do I need to provide the key pair to access the EC2 instance when the instance is being launched from an AMI which was taken from an instance that already contained the same key pair?
Asked
Active
Viewed 659 times
1
-
1Can you clarify what you are asking. AWS only has access to the public key portion of the Key Pair. You must keep track of the Private Key Pair (the one you downloaded from AWS). When you create a new instance from a AMI that you created, there is a selection box to select the Key Pair. You can select your existing Key Pair by name. – John Hanley Aug 28 '18 at 15:36
-
1There is also an option where you can upload the public key of your existing key pair to authenticate which I was talking about. – Mostafiz Rahman Aug 29 '18 at 05:16
2 Answers
1
No, in case of same key pair it's not necessary to provide it again. (I just tried and made sure of it)

Mostafiz Rahman
- 8,169
- 7
- 57
- 74
-
-
1Yes, you can SSH without mentioning the key if you are using the default private key. While authenticating with your private key SSH searches for `id_rsa` or `id_dsa` in `~/.ssh` directory by default. If it finds the deefault private key it tries to connect with it. If you explicitly mention the private key location with `-i /key_directory` then it uses the given private key. – Mostafiz Rahman Aug 29 '18 at 05:28
-
1That's semantics - you're still using the key, you just don't have to mention it. – stdunbar Aug 29 '18 at 14:58
-1
An AMI is basically a clone of an existing EC2 so it will be the same key pair used when the AMI was generated. To access it (i.e. ssh
) you will still need the .pem
file that was used when the AMI was generated.

stdunbar
- 16,263
- 11
- 31
- 53