启动EC实例::调用RunInstances操作时发生客户端错误(UnauthorizedOperation)

时间:2014-12-03 07:56:01

标签: amazon-web-services amazon-ec2 aws-cli

我正在使用AWS CLI并已使用AWS Configure配置它 当我使用:

启动EC2实例时
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

它给了我:

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

1 个答案:

答案 0 :(得分:15)

你知道这意味着什么吗?

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

如果要启动具有IAM角色的EC2实例,则需要具有IAM管理权限。详细讨论了here

您还可以尝试解码错误消息并查看其内容:

aws sts decode-authorization-message --encoded-message 4doSfAQy0gcqKr1O-raIb0C83C2kLWQY8hjZ4gVtwUz6xSAwOtD2wumVnpgsz5