-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
73 lines (67 loc) · 2.01 KB
/
serverless.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# Welcome to serverless. Read the docs
# https://serverless.com/framework/docs/
# Serverless.yml is the configuration the CLI
# uses to deploy your code to your provider of choice
# The `service` block is the name of the service
service: serverless-static-website-template
# The `provider` block defines where your service will be deployed
provider:
name: aws
region: eu-central-1
runtime: nodejs8.10
resources:
Resources:
StaticSite:
Type: AWS::S3::Bucket
Properties:
AccessControl: PublicRead
BucketName: ${self:custom.siteName}
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"
},
"/*"
]
]
Outputs:
HttpUrl:
Value: http://${self:custom.siteName}.s3-website.${self:provider.region}.amazonaws.com
HttpsUrl:
Value: https://s3.${self:provider.region}.amazonaws.com/${self:custom.siteName}/index.html
# DnsRecord:
# Type: "AWS::Route53::RecordSet"
# Properties:
# AliasTarget:
# DNSName: ${self:custom.aliasDNSName}
# HostedZoneId: ${self:custom.aliasHostedZoneId}
# HostedZoneName: ${self:custom.siteName}.
# Name:
# Ref: StaticSite
# Type: 'A'
custom:
# hostedZoneName: serverless-zombo.com
# aliasHostedZoneId: Z3AQBSTGFYJSTF # us-east-1
# aliasDNSName: s3-website-us-east-1.amazonaws.com
siteName: serverless-static-website-template
s3Sync:
- bucketName: ${self:service}
localDir: static
plugins:
- serverless-s3-sync