-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.yaml
52 lines (48 loc) · 1.57 KB
/
template.yaml
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
AWSTemplateFormatVersion: "2010-09-09"
Transform: AWS::Serverless-2016-10-31
Description: >
Application superstack
Resources:
Website:
Type: AWS::Serverless::Application
Properties:
Location: website/template.yaml
WebApi:
Type: AWS::Serverless::Application
Properties:
Location: webapi/template.yaml
CDN:
Type: AWS::CloudFront::Distribution
Properties:
DistributionConfig:
Enabled: true
PriceClass: PriceClass_100
DefaultCacheBehavior:
TargetOriginId: website
ViewerProtocolPolicy: redirect-to-https
ForwardedValues:
QueryString: true
CacheBehaviors:
- TargetOriginId: webapi
PathPattern: "/api/*"
ViewerProtocolPolicy: https-only
Compress: true
AllowedMethods: [DELETE, GET, HEAD, OPTIONS, PATCH, POST, PUT]
CachedMethods: [GET, HEAD, OPTIONS]
ForwardedValues:
QueryString: true
Headers: [Accept, Referer, Authorization, Content-Type]
Origins:
- Id: website
DomainName: !GetAtt Website.Outputs.WebsiteDomainName
CustomOriginConfig:
OriginProtocolPolicy: http-only
- Id: webapi
DomainName: !GetAtt WebApi.Outputs.WebApiDomainName
OriginPath: !Sub "/${WebApi.Outputs.WebApiStage}"
CustomOriginConfig:
OriginProtocolPolicy: https-only
Outputs:
MainURL:
Description: "Main URL of the website and API (CDN)"
Value: !Sub "https://${CDN.DomainName}"