Created
October 21, 2019 18:34
-
-
Save stewartnoll/405410b419deb3c5504cb69548a34c62 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
service: <your service name here> | |
plugins: | |
- serverless-s3-sync | |
custom: | |
stage: ${opt:stage, 'dev'} | |
bucketName: ${self:custom.stage}-${self:service} | |
s3Sync: | |
- bucketName: ${self:custom.bucketName} | |
localDir: dist | |
provider: | |
name: aws | |
runtime: nodejs6.10 | |
tracing: true | |
stage: ${self:custom.stage} | |
resources: | |
Resources: | |
StaticSite: | |
Type: AWS::S3::Bucket | |
Properties: | |
AccessControl: PublicRead | |
BucketName: ${self:custom.bucketName} | |
WebsiteConfiguration: | |
IndexDocument: index.html | |
StaticSiteS3BucketPolicy: | |
Type: AWS::S3::BucketPolicy | |
Properties: | |
Bucket: | |
Ref: StaticSite | |
PolicyDocument: | |
Statement: | |
- Sid: PublicReadGetObject | |
Effect: Allow | |
Principal: "*" | |
Action: | |
- s3:GetObject | |
Resource: | |
Fn::Join: [ | |
"", [ | |
"arn:aws:s3:::", | |
{ | |
"Ref": "StaticSite" | |
}, | |
"/*" | |
] | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment