0

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?

ktian
  • 1

1 Answers1

0

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

Marcin
  • 215,873
  • 14
  • 235
  • 294