Powershell SDK 中“Get-EC2Instance”命令的 IAM 操作

jay*_*yco 5 amazon-ec2 amazon-iam

Get-EC2Instance从 EC2 实例调用并获取

Get-EC2Instance : You are not authorized to perform this operation.
Run Code Online (Sandbox Code Playgroud)

我需要将哪个 IAM 操作添加到我的策略中?

小智 0

我在 PowerShell 中也遇到了同样的未经授权的问题Get-EC2Instance。要使其发挥作用,请将以下权限附加到您的角色策略。看起来DescribeNetworkInterfaces除了 之外还需要许可DescribeInstances

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": [
                "ec2:DescribeInstances",
                "ec2:DescribeNetworkInterfaces"
            ],
            "Resource": "*"
        }
    ]
}
Run Code Online (Sandbox Code Playgroud)