Cannot create key pair for ec2 instance.

0

It throws this error: You are not authorized to perform this operation. Encoded authorization failure message:

asked a year ago424 views
5 Answers
1

Is the permission to create key pairs attached to your IAM user, etc.?
If ec2:CreateKeyPair is not attached to the IAM policy, an error will occur.
https://docs.aws.amazon.com/service-authorization/latest/reference/list_amazonec2.html

profile picture
EXPERT
answered a year ago
profile picture
EXPERT
reviewed a year ago
0

Log in to the AWS Management Console and navigate to the IAM service. Select the relevant user for whom you want to add the policy. Click on the "Permissions" tab. Click on the "Add permission" button. On the next page, select the option "Attach existing policies directly". In the search bar, type "CreateKeyPair" and select the policy from the list of results. Review the policy details and click on the "Add permissions" button to attach the policy to the user. Reference: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html

profile picture
answered a year ago
  • I have always given EC2FulAccess and there were no problems, but now. I don't have that ec2:CreateKeyPair policy I will attach 2 screenshots below

0

Hi. What you have attached is ECSFullAcess(not EC2FullAccess) and it seemes no ec2:CreateKeyPair action included on it.

https://docs.aws.amazon.com/AmazonECS/latest/userguide/security-iam-awsmanpol.html

profile picture
EXPERT
answered a year ago
  • I recently resolved this issue, but I highly appretiate your help and assistance with my problem. Very stupid mistake...

0

Enter image description here

answered a year ago
0

Enter image description here

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions