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
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.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With