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

Sub*_*thi 7 amazon-ec2 amazon-web-services 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
Run Code Online (Sandbox Code Playgroud)

它给了我:

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
Run Code Online (Sandbox Code Playgroud)

hel*_*loV 18

你知道这意味着什么吗?

--iam-instance-profile Arn=arn:aws:iam::132895064974:instance-profile/ec2Admin
Run Code Online (Sandbox Code Playgroud)

如果要启动具有IAM角色的EC2实例,则需要具有IAM管理权限.这里将详细讨论

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

aws sts decode-authorization-message --encoded-message 4doSfAQy0gcqKr1O-raIb0C83C2kLWQY8hjZ4gVtwUz6xSAwOtD2wumVnpgsz5
Run Code Online (Sandbox Code Playgroud)