EC2实例连接 - IAM策略:畸形的PolicyDocument:策略中的语法错误

发布于 2025-02-10 19:21:28 字数 708 浏览 1 评论 0原文

在创建我的IAM策略时,我正在遇到“畸形的pocydocument”错误。这是用于配置EC2实例连接。

{
    "Version": "2022-6-26",
    "Statement": [
      {
        "Effect": "Allow",
        "Action": "ec2-instance-connect:SendSSHPublicKey",
        "Resource": "arn:aws:ec2:us-east-1:123456789:instance/*",
        "Condition": {
            "StringEquals": {
                "ec2:osuser": "ktian"
            }
        }
      },
      {
        "Effect": "Allow",
        "Action": "ec2:DescribeInstances",
        "Resource": "*"
      }
    ]
}

这是我使用的创建策略命令:

aws iam create-policy --policy-name IAM-policy --policy-document file://iam-policy.json

据我所知,策略文件中的实际语法还可以,文件本身是否还有其他问题?

I'm running into the 'MalformedPolicyDocument' error while creating my IAM policy. This is for configuring ec2 instance connect.

{
    "Version": "2022-6-26",
    "Statement": [
      {
        "Effect": "Allow",
        "Action": "ec2-instance-connect:SendSSHPublicKey",
        "Resource": "arn:aws:ec2:us-east-1:123456789:instance/*",
        "Condition": {
            "StringEquals": {
                "ec2:osuser": "ktian"
            }
        }
      },
      {
        "Effect": "Allow",
        "Action": "ec2:DescribeInstances",
        "Resource": "*"
      }
    ]
}

Here's the create policy command I used:

aws iam create-policy --policy-name IAM-policy --policy-document file://iam-policy.json

As far as I can see the actual syntax in the policy file is ok, is there some another issue in the file itself?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

蓦然回首 2025-02-17 19:21:28

版本2022-6-26不正确最新版本17 。

Version 2022-6-26 is incorrect. The latest version available is 2012-10-17.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文