2 Respuestas
- Más nuevo
- Más votos
- Más comentarios
0
Read second answer first and then come back answer #1: it should allow you to fix your CFN template.
0
The following template can be used to host a website.
Also, the part of the access policy that specifies the S3 ARN is "!Sub ${WebsiteBucket.Arn}".
By doing this, you only need to change the S3 bucket name part.
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-sub.html
AWSTemplateFormatVersion: '2010-09-09'
Description: S3 Template
Resources:
WebsiteBucket:
Type: "AWS::S3::Bucket"
DeletionPolicy: Delete
Properties:
BucketName: !Sub 'a-test-uniquebucket-${AWS::AccountId}'
PublicAccessBlockConfiguration:
BlockPublicAcls: false
BlockPublicPolicy: false
IgnorePublicAcls: false
RestrictPublicBuckets: false
OwnershipControls:
Rules:
- ObjectOwnership: ObjectWriter
WebsiteConfiguration:
IndexDocument: index.html
ErrorDocument: error.html
S3AccessPolicy:
Type: AWS::S3::BucketPolicy
DeletionPolicy: Delete
Properties:
Bucket: !Ref WebsiteBucket
PolicyDocument:
Statement:
- Sid: PublicReadGetObject
Effect: Allow
Principal: '*'
Action:
- s3:GetObject
Resource: !Sub ${WebsiteBucket.Arn}/*
Contenido relevante
- OFICIAL DE AWSActualizada hace 2 años
- OFICIAL DE AWSActualizada hace 2 años