Sushant Bajracharya
Sushant Bajracharya

Reputation: 400

Getting the list of aws regions

I am trying to populate the aws regions in a dropdown and I followed this issue as well but I keep getting error like

    [AWS EC2 403 1.950727 0 retries] describe_regions() AWS::EC2::Errors::UnauthorizedOperation You are not authorized to perform this operation.

AWS::EC2::Errors::UnauthorizedOperation: You are not authorized to perform this operation.

I have the correct access keys but I have no idea why this is happening.

Upvotes: 1

Views: 186

Answers (2)

Karl Laurentius Roos
Karl Laurentius Roos

Reputation: 4399

Judging by the error message you are getting all you have to do is make sure that the IAM user that owns the key has access to ec2:: DescribeRegions.

Upvotes: 1

Piyush Patil
Piyush Patil

Reputation: 14533

This is the policy that needs to be added for you to have access to describe regions for ec2 instance. Create this custom policy in AWS IAM (Root User or a AWS Console Admin Will be able to do that).

{
"Version": "2012-10-17",
"Statement": [{
  "Effect": "Allow",
  "Action": "ec2:Describe*",
  "Resource": "*"
}]
}

Upvotes: 2

Related Questions