aws-serverless-appsync-app
aws-serverless-appsync-app copied to clipboard
Step 5: An error occurred (MalformedPolicy) when calling the PutBucketPolicy operation: Policy has invalid resource

bucketpolicy.json:
{
"Version":"2012-10-17",
"Statement":[
{
"Sid":"AddPerm",
"Effect":"Allow",
"Principal": "*",
"Action":["s3:GetObject"],
"Resource":["arn:aws:s3:::barton-travel-site/*"]
}
]
}
Command:
aws s3api put-bucket-policy --bucket barton-travel-site --policy file://bucketpolicy.json
Output:
An error occurred (MalformedPolicy) when calling the PutBucketPolicy operation: Policy has invalid resource
I went here and added policy manually:

Did you resolve? I'm sorry because I have same problem,too. I want to know the solution.
How can this be resolved via the aws cli?
root@ip-10-0-32-211:~# aws s3api put-bucket-policy --bucket test-update-policy --policy file://policy.json
An error occurred (MalformedPolicy) when calling the PutBucketPolicy operation: Policy has invalid resource root@ip-10-0-32-211:~# aws s3 ls 2020-03-17 13:44:40 cf-templates-15gc0eytikz3y-us-east-1 2019-11-25 02:29:37 elasticbeanstalk-us-east-1-785086296852 2020-03-27 09:31:32 test-update-policy root@ip-10-0-32-211:~# vi policy.json root@ip-10-0-32-211:~# aws s3api put-bucket-policy --bucket test-update-policy --policy file://policy.json
Just mapping S3 bucket name in json file and S3 bucket name in console will be resolve this problem.
I fixed this error by saving the website-bucket-policy.json file