Bucket Policy Error - invalid Json

0

Hello I am trying to find out what's wrong with this JSON Unknown Error An unexpected error occurred. This policy contains invalid Json

{ "Version": "2012-10-17", "Statement": [ { "Sid": "AllowS3ReadAccess", "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::091896477544:role/S3DynamoDBFullAccessRole" }, "Action": "s3:", "Resource": [ "arn:aws:s3:::employee-photo-bucket-al1", "arn:aws:s3:::employee-photo-bucket-al1/" ] } ] }

3 個答案
0

I do not agree with @jschwar313 and @skinsman. The policy looks OK. (apart from the '*' being removed from your question in 2 places)

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "AllowS3ReadAccess", 
      "Effect": "Allow",
      "Principal": {
        "AWS": "arn:aws:iam::091896477544:role/S3DynamoDBFullAccessRole"
      }, 
      "Action": "s3:*", 
      "Resource": [
        "arn:aws:s3:::employee-photo-bucket-al1", 
        "arn:aws:s3:::employee-photo-bucket-al1/*"
      ]
    }
  ]
}

In the example above I have put back the '*' characters in the right spots.

Now two other thing need to be in order for the BucketPolicy to work.

BucketName

The name of the bucket you are applying the policy to must be employee-photo-bucket-al1.

Role reference

Applying the BucketPolicy will only succeed if the role actually exists.

S3DynamoDBFullAccessRole seems to be a role that you created. You can lookup the role in the IAM Console and use the copy button near the arn.

There can be several reasons for the url not being correct but most likely there is a path included in the arn like in this:

arn:aws:iam::123456789012:role/service-role/S3DynamoDBFullAccessRole

Regards Jacco

profile picture
JaccoPK
已回答 1 年前
0

What I did to find those documents was to use the visual editor to create the policy using the JSON provided. AWS responded with an error and the documents I posted. Maybe you can do the same.

已回答 1 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南