英文:
How to correct Status Code:400; Error code: Malformed Policy
问题
Unknown field version (Service: Amazon S3;
Status Code: 400; Error Code: MalformedPolicy;
Request ID: VKA1M3MNY37B2DGN; S3 Extended
Request ID: UItdX5yp9vy6KB19HQVjBdkW1fyGh2EvZ+47
Y1KcQ03WExKAqRVJivrw+4cQns6OXo7ax8lwO2Y=; Proxy:
null)
BucketPolicy:
Type: AWS::S3::BucketPolicy
Properties:
PolicyDocument:
Id: MyPolicy
Version: '2012-10-17'
Statement:
- Sid: PublicReadForGetBucketObject
Effect: Allow
Principal: ''
Action: "s3:GetObject"
Resource: !Join
- ""
- - "arn:aws:s3:::"
- !Ref MyWebsite
- /
Bucket: !Ref MyWebsite
I receive the error message above when I deploy my bucket policy.
When I use the yaml lint site it says format is fine but when I use the CLI sam validate --lint
command I get this message:
/Users/travissalmon/Desktop/Web Development/Resume Challenge/cloud-resume-challenge/template.yaml is a valid SAM Template
Not sure what to do.
英文:
Unknown field version (Service: Amazon S3;
Status Code: 400; Error Code: MalformedPolicy;
Request ID: VKA1M3MNY37B2DGN; S3 Extended
Request ID: UItdX5yp9vy6KB19HQVjBdkW1fyGh2EvZ+47
Y1KcQ03WExKAqRVJivrw+4cQns6OXo7ax8lwO2Y=; Proxy: null)
BucketPolicy:
Type: AWS::S3::BucketPolicy
Properties:
PolicyDocument:
Id: MyPolicy
Version: '2012-10-17'
Statement:
- Sid: PublicReadForGetBucketObject
Effect: Allow
Principal: '*'
Action: "s3:GetObject"
Resource: !Join
- ""
- - "arn:aws:s3:::"
- !Ref MyWebsite
- /*
Bucket: !Ref MyWebsite
I receive the error message above when I deploy my bucket policy.
When I use the yaml lint site it says format is fine but when I use the CLI sam validate --lint
command I get this message:
>/Users/travissalmon/Desktop/Web Development/Resume Challenge/cloud-resume-challenge/template.yaml is a valid SAM Template
Not sure what to do.
答案1
得分: 1
I tried this template and it worked with no issues for me.
sam deploy -g: success
This is the script I used.
AWSTemplateFormatVersion: "2010-09-09"
Transform: AWS::Serverless-2016-10-31
Description: Test Code
Resources:
BucketPolicy:
Type: AWS::S3::BucketPolicy
Properties:
PolicyDocument:
Id: MyPolicy
Version: "2012-10-17"
Statement:
- Sid: PublicReadForGetBucketObject
Effect: Allow
Principal: "*"
Action: "s3:GetObject"
Resource: !Join
- ""
- - "arn:aws:s3:::"
- !Ref MyWebsite
- /*
Bucket: !Ref MyWebsite
MyWebsite:
Type: AWS::S3::Bucket
英文:
I tried this template and it worked with no issues for me.
sam validate: success
sam deploy -g: success
This is the script I used.
AWSTemplateFormatVersion: "2010-09-09"
Transform: AWS::Serverless-2016-10-31
Description: Test Code
Resources:
BucketPolicy:
Type: AWS::S3::BucketPolicy
Properties:
PolicyDocument:
Id: MyPolicy
Version: "2012-10-17"
Statement:
- Sid: PublicReadForGetBucketObject
Effect: Allow
Principal: "*"
Action: "s3:GetObject"
Resource: !Join
- ""
- - "arn:aws:s3:::"
- !Ref MyWebsite
- /*
Bucket: !Ref MyWebsite
MyWebsite:
Type: AWS::S3::Bucket
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论