-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcf_add_cloud_front.json
111 lines (111 loc) · 2.68 KB
/
cf_add_cloud_front.json
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Add a CloudFront PoP for caching image responses.",
"Parameters": {
"ApiId": {
"Description": "API Gateway ID",
"Type": "String"
}
},
"Resources": {
"ImgyCFDistribution": {
"Type": "AWS::CloudFront::Distribution",
"Properties": {
"DistributionConfig": {
"Origins": [
{
"DomainName": {
"Fn::Join": [
"",
[
{
"Ref": "ApiId"
},
".execute-api.",
{
"Ref": "AWS::Region"
},
".amazonaws.com"
]
]
},
"Id": {
"Ref": "ApiId"
},
"OriginPath": "/api",
"CustomOriginConfig": {
"HTTPSPort": "443",
"OriginProtocolPolicy": "https-only",
"OriginSSLProtocols": [
"TLSv1",
"TLSv1.1",
"TLSv1.2"
]
}
}
],
"Enabled": "true",
"HttpVersion": "http2",
"Comment": "Image Distribution",
"DefaultCacheBehavior": {
"AllowedMethods": [
"GET",
"HEAD"
],
"TargetOriginId": {
"Ref": "ApiId"
},
"ForwardedValues": {
"QueryString": "true",
"Cookies": {
"Forward": "none"
}
},
"ViewerProtocolPolicy": "https-only"
},
"CustomErrorResponses": [
{
"ErrorCode": 500,
"ErrorCachingMinTTL": 10
},
{
"ErrorCode": 501,
"ErrorCachingMinTTL": 10
},
{
"ErrorCode": 502,
"ErrorCachingMinTTL": 10
},
{
"ErrorCode": 503,
"ErrorCachingMinTTL": 10
},
{
"ErrorCode": 504,
"ErrorCachingMinTTL": 10
}
],
"PriceClass": "PriceClass_All"
}
}
}
},
"Outputs": {
"CloudFrontURL": {
"Description": "URL for new CloudFront distribution",
"Value": {
"Fn::Sub": [
"https://${Domain}",
{
"Domain": {
"Fn::GetAtt": [
"ImgyCFDistribution",
"DomainName"
]
}
}
]
}
}
}
}