Home > Software engineering >  JSON Syntax Error: Fix the JSON syntax error while creating policy
JSON Syntax Error: Fix the JSON syntax error while creating policy

Time:01-30

I am following a tutorial in AWS and came across to create a policy. But I am getting a json error. It doesn't tell me much and not sure how to fix it.

enter image description here

I tried to paste it in the VS code to get the idea but vs code is complaining about Invalid escape character in string.json(261)

CodePudding user response:

You are missing the " at cloudformation

it should be

"Action": [
"cloudformation:*",
"iam\;PassRole"
]

CodePudding user response:

Resolved

{
"Version": "2012-10-17",
"Statement": [
    {
        "Action": [
            "cloudformation:*",
            "iam:PassRole"
        ],
        "Resource": "*",
        "Effect": "Allow"
    },
    {
        "Action": [
            "s3:Get*",
            "s3:Put*",
            "s3:ListBucket"
        ],
        "Resource": [
            "arn:aws:s3:::artifact-bucket-{DEV_ACCOUNT_ID}",
            "arn:aws:s3:::artifact-bucket-{DEV_ACCOUNT_ID}/*"
        ],
        "Effect": "Allow"
    },
    {
        "Action": [ 
            "kms:DescribeKey", 
            "kms:GenerateDataKey*", 
            "kms:Encrypt", 
            "kms:ReEncrypt*", 
            "kms:Decrypt" 
        ], 
        "Resource": "{KEY_ARN}",
        "Effect": "Allow"
    }
]

}

Found this here https://github.com/aws-samples/aws-cross-account-cicd-pipeline

  • Related