Reputation: 641
I am getting the error above when trying to create a AWS CloudFormation script through the console designer. I am certain that the bucket alberto313131 exists.
Here is the full error:
Template contains errors.: Template format error: Unresolved resource dependencies [arn:aws:s3:::alberto313131/*] in the Resources block of the template
This is the full script, I am using:
Resources:
S3BP1KK1X:
Type: 'AWS::S3::BucketPolicy'
Properties:
Bucket:
Ref: "arn:aws:s3:::alberto313131/*"
PolicyDocument:
Statement:
- Sid: AddPerm
Effect: Allow
Principal: '*'
Action:
- "s3:GetObject"
Resource:
- "arn:aws:s3:::alberto313131/*"
Upvotes: 2
Views: 2510
Reputation: 641
I was able to get past my issue using the logical id.
Resources:
resbucket:
Type: "AWS::S3::Bucket"
Properties:
BucketName: "testathena44"
resbucketpolicy:
Type: "AWS::S3::BucketPolicy"
Properties:
Bucket: !Ref resbucket
PolicyDocument:
Statement:
-
Sid: "ABC123"
Action:
- "s3:GetObject"
Effect: Allow
Resource: !Join ["", ["arn:aws:s3:::", !Ref resbucket, "/*"]]
Principal:
AWS:
- "*"
Upvotes: 0
Reputation: 1212
From the CloudFormation S3 BucketPolicy doco
Properties
Bucket
The name of the Amazon S3 bucket to which the policy applies.
So, you simply provide the bucket name, not the ARN.
Only for the Resource
inside the Statement
section of the PolicyDocument
do you provide the ARN.
Upvotes: 2