Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Launching EC Instance :: A client error (UnauthorizedOperation) occurred when calling the RunInstances operation

I am using AWS CLI and have already configured it using AWS Configure when i launch an EC2 instance using :

C:\>aws ec2 run-instances --dry-run --image-id ami-b5a7ea85 --count 1 --instance
-type t2.micro --key-name ec2_key --iam-instance-profile Arn=arn:aws:iam::132895
064974:instance-profile/ec2Admin

It is giving me :

A client error (UnauthorizedOperation) occurred when calling the RunInstances op
eration: You are not authorized to perform this operation. Encoded authorization
 failure message: 4doSfAQy0gcqKr1O-raIb0C83C2kLWQY8hjZ4gVtwUz6xSAwOtD2wumVnpgsz5
like image 923
Subham Tripathi Avatar asked Dec 03 '14 07:12

Subham Tripathi


People also ask

Why am I receiving the error message you are not authorized to perform this operation when I try to launch an EC2 instance?

The "UnauthorizedOperation" error indicates that permissions attached to the AWS Identity and Access Management (IAM) role or user trying to perform the operation doesn't have the required permissions to launch EC2 instances.

What is EC instance?

An Amazon EC2 instance is a virtual server in Amazon's Elastic Compute Cloud (EC2) for running applications on the Amazon Web Services (AWS) infrastructure.


1 Answers

Do you know what this means?

--iam-instance-profile Arn=arn:aws:iam::132895064974:instance-profile/ec2Admin

If you are launching an EC2 instance with an IAM role, then you need to have IAM administrative privilege. It is discussed in detail here

You can also try to decode the error message and see what it says:

aws sts decode-authorization-message --encoded-message 4doSfAQy0gcqKr1O-raIb0C83C2kLWQY8hjZ4gVtwUz6xSAwOtD2wumVnpgsz5
like image 57
helloV Avatar answered Sep 21 '22 14:09

helloV