从 EC2 实例调用Get-EC2Instance
并获取
Get-EC2Instance : You are not authorized to perform this operation.
我需要将哪个 IAM 操作添加到我的策略中?
答案1
我在 PowerShell 中也遇到了同样的未授权问题Get-EC2Instance
。要使其正常工作,请将以下权限附加到您的角色策略。看起来DescribeNetworkInterfaces
除了之外还需要该权限DescribeInstances
。
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"ec2:DescribeInstances",
"ec2:DescribeNetworkInterfaces"
],
"Resource": "*"
}
]
}