S3 Bucket Policy

Why I am getting this Error This policy contains invalid Json?

{

“Version”:“2019-02-11”,

“Id”:“http referer policy example”,

“Statement”:[

{

“Sid”:“Allow get requests originating from www.example.com and example.com.”,

“Effect”:“Allow”,

“Principal”:“*”,

“Action”:[“s3:PutObject”,“s3:GetObject”],

“Resource”:“arn:aws:s3:::pininterest/*”,

“Condition”:{

“StringLike”:{“aws:Referer”:[https://young-fortress-50796.herokuapp.com/*"]}

}

}

]

}

I see your URL is missing a double quote at the beginning.

Try using jsonlint.com

Thanks

Fixed but now getting Access Denied Error

{

“Version”:“2012-10-17”,

“Id”:“266865133225”,

“Statement”:[

{

“Sid”:“1”,

“Effect”:“Allow”,

“Principal”:“*”,

“Action”:[“s3:PutObject”,“s3:GetObject”],

“Resource”:“arn:aws:s3:::pininterest/*”,

“Condition”:{

“StringLike”:{“aws:Referer”:[“https://young-fortress-50796.herokuapp.com/*”]}

}

}

]

}

This policy must be applied to a user, group, or IAM role (and maybe other options).

Also, are you sure that your application is only using the granted actions? It’s not trying to list buckets, list objects or other?

Check the IAM documentation. It’s really thorough and should help you spot what’s missing