Starting EC instance :: Client error (UnauthorizedOperation) occurred while calling the RunInstances operation

I am using the AWS CLI and have already configured it using AWS Configure when I start the 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 

This gives 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 
+5
source share
1 answer

Do you know what that means?

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

If you are running an EC2 instance with the IAM role, you must have the 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 
+7
source

Source: https://habr.com/ru/post/1208214/


All Articles