S3 bucket policy errors I have the following bucket policy for Amazon S3, which is giving the following error:


  Error: Invalid bucket policy syntax.


Either it is a JSON syntax error or a Policy error.

This is the policy I am trying and failing with:

{
    "Version": "2012-10-17",
    "Statement": [{
        "Effect": "Allow",
        "Action": [
            "s3:ListBucket",
            "s3:GetBucketLocation",
            "s3:ListBucketMultipartUploads"
        ],
        "Resource": "arn:aws:s3:::&lt;my bucket&gt;",
        "Principal": {
            "AWS": [
                "arn:aws:iam::560184616970:user/&lt;my username&gt;"
            ]
        },
        "Statement": [{
            "Effect": "Allow",
            "Action": [
                "s3:AbortMultipartUpload",
                "s3:DeleteObject",
                "s3:DeleteObjectVersion",
                "s3:GetObject",
                "s3:GetObjectAcl",
                "s3:GetObjectVersion",
                "s3:GetObjectVersionAcl",
                "s3:PutObject",
                "s3:PutObjectAcl",
                "s3:PutObjectAclVersion"
            ],
            "Resource": "arn:aws:s3:::&lt;my-bucket&gt;/*",
            "Principal": {
                "AWS": [
                    "arn:aws:iam::560184616970:user/&lt;my-username&gt;"
                ]
            },
            "Statement": [{
                "Effect": "Allow",
                "Action": "s3:ListAllMyBuckets",
                "Resource": "*"
            }]
        }]
    }]
}


Can anyone give me guidance here?
It looks like you tried to compile multiple policies into one.
Each original had a statement with its array of statements and you nested them.

This (untested) should work with each statement block within the array of Statement of the policy:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "s3:ListBucket",
        "s3:GetBucketLocation",
        "s3:ListBucketMultipartUploads"
      ],
      "Resource": "arn:aws:s3:::&lt;my bucket&gt;",
      "Principal": {
        "AWS": [
          "arn:aws:iam::560184616970:user/&lt;my username&gt;"
        ]
      }
    },
    {
      "Effect": "Allow",
      "Action": [
        "s3:AbortMultipartUpload",
        "s3:DeleteObject",
        "s3:DeleteObjectVersion",
        "s3:GetObject",
        "s3:GetObjectAcl",
        "s3:GetObjectVersion",
        "s3:GetObjectVersionAcl",
        "s3:PutObject",
        "s3:PutObjectAcl",
        "s3:PutObjectAclVersion"
      ],
      "Resource": "arn:aws:s3:::&lt;my-bucket&gt;/*",
      "Principal": {
        "AWS": [
          "arn:aws:iam::560184616970:user/&lt;my-username&gt;"
        ]
      }
    },
    {
      "Effect": "Allow",
      "Action": "s3:ListAllMyBuckets",
      "Resource": "*"
    }
  ]
}


An alternative could be to use aws bucket policy generator