An error occurred (InvalidKeyPair.NotFound) when calling the RunInstances operation: The key pair 'key123.pem' does not exist

+1 vote

Hello everyone,

I am trying to create one EC2 instance from command line. But it shows me the below error.

C:\Users\NADIM AKTHAR>aws ec2 run-instances --image-id ami-0447a12f28fddb066 --instance-type t2.micro --count 1 --subnet-id subnet-51167d1d --key-name key123.pem
An error occurred (InvalidKeyPair.NotFound) when calling the RunInstances operation: The key pair 'key123.pem' does not exist

How can I solve this error?

Jun 2 in AWS by akhtar
• 28,160 points
319 views

1 answer to this question.

0 votes

Hi@akhtar,

In your command don't use .pem extension in your key. AWS stores key without any extension. Otherwise you will get this error.

answered Jun 2 by MD
• 65,240 points

Related Questions In AWS

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer