7
votes

I am trying to create an EC2 instance and on the last step of launching I try to create a key pair ( which will generate a .pem file for login) and I get the below error. Error Error creating Key Pair: You are not authorized to perform this operation.

Can anyone tell me what authentication should I give to my IAM right now I have Admin access.

Not very sure what is causing the Issue.

-Rashmi

3

3 Answers

2
votes

Try adding AmazonEC2FullAccess CreateKeyPair policy.

If you are not sure how to do it:

Log in to IAM, then choose necessary user and on Permissions tab click Add permission button. On next page click on Attach existing policies directly button and look for CreateKeyPair policy. Attach it. This worked for me.

1
votes

Yes Giving AmazonEC2FullAccess to the IAM user group solved the issue.

enter image description here

Above screen shows that when you create the group you are supposed to give access to the service.

0
votes

It's a good practice to grant access only to required resources, not to all of them. To create key pair it is enough to grant EC2:CreateKeyPair permission.