Skip to content

Instantly share code, notes, and snippets.

@Leonti
Last active June 22, 2020 04:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Leonti/0c615ea82aefbf14a8cc124945e96c42 to your computer and use it in GitHub Desktop.
Save Leonti/0c615ea82aefbf14a8cc124945e96c42 to your computer and use it in GitHub Desktop.
S3BucketLogs:
Type: AWS::S3::Bucket
DeletionPolicy: Delete
Properties:
AccessControl: LogDeliveryWrite
BucketName: !Sub '${AWS::StackName}-logs'
S3BucketRoot:
Type: AWS::S3::Bucket
DeletionPolicy: Delete
Properties:
AccessControl: PublicRead
BucketName: !Sub '${AWS::StackName}-root'
LoggingConfiguration:
DestinationBucketName: !Ref S3BucketLogs
LogFilePrefix: 'cdn/'
WebsiteConfiguration:
ErrorDocument: 'index.html'
IndexDocument: 'index.html'
S3BucketPolicy:
Type: AWS::S3::BucketPolicy
Properties:
Bucket: !Ref S3BucketRoot
PolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: 'Allow'
Action: 's3:GetObject'
Principal: '*'
Resource: !Sub '${S3BucketRoot.Arn}/*'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment