1
1
{
2
2
"Parameters" : {
3
- "MyHostedZone " : {
4
- "Default" : " myregionalhostedzoneid " ,
3
+ "ACMCertificateArn " : {
4
+ "Default" : " cert-arn-in-us-east-1 " ,
5
5
"Type" : " String"
6
6
},
7
- "MyDomainName" : {
8
- "Default" : " api-edge.com" ,
9
- "Type" : " String"
10
- },
11
- "MyDomainCert" : {
12
- "Default" : " my-edge-api-arn" ,
7
+ "DomainName" : {
8
+ "Default" : " example.com" ,
13
9
"Type" : " String"
14
10
}
15
11
},
36
32
]
37
33
}
38
34
},
39
- "MyFunctionImplicitGetPermissionProd " : {
35
+ "MyFunctionFetchPermissionProd " : {
40
36
"Type" : " AWS::Lambda::Permission" ,
41
37
"Properties" : {
42
38
"Action" : " lambda:invokeFunction" ,
46
42
},
47
43
"SourceArn" : {
48
44
"Fn::Sub" : [
49
- " arn:aws:execute-api:${AWS::Region}:${AWS::AccountId}:${__ApiId__}/${__Stage__}/POST/implicit " ,
45
+ " arn:aws:execute-api:${AWS::Region}:${AWS::AccountId}:${__ApiId__}/${__Stage__}/POST/fetch " ,
50
46
{
51
47
"__Stage__" : " *" ,
52
48
"__ApiId__" : {
53
- "Ref" : " ServerlessRestApi "
49
+ "Ref" : " MyApi "
54
50
}
55
51
}
56
52
]
57
53
}
58
54
}
59
55
},
60
- "RecordSetGroup2102f285a7" : {
56
+ "ApiGatewayDomainName0caaf24ab1" : {
57
+ "Type" : " AWS::ApiGateway::DomainName" ,
58
+ "Properties" : {
59
+ "CertificateArn" : " cert-arn-in-us-east-1" ,
60
+ "EndpointConfiguration" : {
61
+ "Types" : [
62
+ " EDGE"
63
+ ]
64
+ },
65
+ "DomainName" : " example.com"
66
+ }
67
+ },
68
+ "MyApiProdStage" : {
69
+ "Type" : " AWS::ApiGateway::Stage" ,
70
+ "Properties" : {
71
+ "DeploymentId" : {
72
+ "Ref" : " MyApiDeployment967cf1a6ff"
73
+ },
74
+ "RestApiId" : {
75
+ "Ref" : " MyApi"
76
+ },
77
+ "StageName" : " Prod"
78
+ }
79
+ },
80
+ "RecordSetGroupbd00d962a4" : {
61
81
"Type" : " AWS::Route53::RecordSetGroup" ,
62
82
"Properties" : {
63
- "HostedZoneId" : " myregionalhostedzoneid " ,
83
+ "HostedZoneId" : " ZQ1UAL4EFZVME " ,
64
84
"RecordSets" : [
65
85
{
66
86
"AliasTarget" : {
67
- "EvaluateTargetHealth " : true ,
68
- "HostedZoneId " : {
87
+ "HostedZoneId " : " Z2FDTNDATAQYW2 " ,
88
+ "DNSName " : {
69
89
"Fn::GetAtt" : [
70
- " ApiGatewayDomainNameb4325e3ba6 " ,
71
- " RegionalHostedZoneId "
90
+ " Distribution " ,
91
+ " DomainName "
72
92
]
73
- },
93
+ }
94
+ },
95
+ "Type" : " A" ,
96
+ "Name" : " example.com"
97
+ },
98
+ {
99
+ "AliasTarget" : {
100
+ "HostedZoneId" : " Z2FDTNDATAQYW2" ,
74
101
"DNSName" : {
75
102
"Fn::GetAtt" : [
76
- " ApiGatewayDomainNameb4325e3ba6 " ,
77
- " RegionalDomainName "
103
+ " Distribution " ,
104
+ " DomainName "
78
105
]
79
106
}
80
107
},
81
- "Type" : " A " ,
82
- "Name" : " api-edge .com"
108
+ "Type" : " AAAA " ,
109
+ "Name" : " example .com"
83
110
}
84
111
]
85
112
}
86
113
},
87
- "ServerlessRestApiBasePathMapping " : {
114
+ "MyApifetchBasePathMapping " : {
88
115
"Type" : " AWS::ApiGateway::BasePathMapping" ,
89
116
"Properties" : {
90
- "DomainName" : " api-edge.com" ,
117
+ "BasePath" : " fetch" ,
118
+ "DomainName" : " example.com" ,
91
119
"RestApiId" : {
92
- "Ref" : " ServerlessRestApi "
120
+ "Ref" : " MyApi "
93
121
},
94
122
"Stage" : {
95
- "Ref" : " ServerlessRestApiProdStage "
123
+ "Ref" : " MyApiProdStage "
96
124
}
97
125
}
98
126
},
99
- "MyFunctionFetchPermissionProd " : {
100
- "Type" : " AWS::Lambda::Permission " ,
127
+ "Distribution " : {
128
+ "Type" : " AWS::CloudFront::Distribution " ,
101
129
"Properties" : {
102
- "Action" : " lambda:invokeFunction" ,
103
- "Principal" : " apigateway.amazonaws.com" ,
104
- "FunctionName" : {
105
- "Ref" : " MyFunction"
106
- },
107
- "SourceArn" : {
108
- "Fn::Sub" : [
109
- " arn:aws:execute-api:${AWS::Region}:${AWS::AccountId}:${__ApiId__}/${__Stage__}/POST/fetch/another" ,
130
+ "DistributionConfig" : {
131
+ "Origins" : [
110
132
{
111
- "__Stage__" : " *" ,
112
- "__ApiId__" : {
113
- "Ref" : " MyApi"
133
+ "DomainName" : {
134
+ "Ref" : " DomainName"
135
+ },
136
+ "Id" : {
137
+ "Ref" : " DomainName"
138
+ },
139
+ "CustomOriginConfig" : {
140
+ "OriginProtocolPolicy" : " https-only" ,
141
+ "HTTPPort" : 80 ,
142
+ "HTTPSPort" : 443
114
143
}
115
144
}
116
- ]
145
+ ],
146
+ "PriceClass" : " PriceClass_100" ,
147
+ "Enabled" : true ,
148
+ "DefaultCacheBehavior" : {
149
+ "Compress" : true ,
150
+ "TargetOriginId" : {
151
+ "Ref" : " DomainName"
152
+ },
153
+ "ViewerProtocolPolicy" : " redirect-to-https" ,
154
+ "ForwardedValues" : {
155
+ "QueryString" : false
156
+ },
157
+ "SmoothStreaming" : false ,
158
+ "AllowedMethods" : [
159
+ " HEAD" ,
160
+ " DELETE" ,
161
+ " POST" ,
162
+ " GET" ,
163
+ " OPTIONS" ,
164
+ " PUT" ,
165
+ " PATCH"
166
+ ]
167
+ },
168
+ "ViewerCertificate" : {
169
+ "SslSupportMethod" : " sni-only" ,
170
+ "AcmCertificateArn" : {
171
+ "Ref" : " ACMCertificateArn"
172
+ }
173
+ },
174
+ "HttpVersion" : " http2"
117
175
}
118
176
}
119
177
},
120
- "ServerlessRestApiProdStage" : {
121
- "Type" : " AWS::ApiGateway::Stage" ,
122
- "Properties" : {
123
- "DeploymentId" : {
124
- "Ref" : " ServerlessRestApiDeployment5332408c06"
125
- },
126
- "RestApiId" : {
127
- "Ref" : " ServerlessRestApi"
128
- },
129
- "StageName" : " Prod"
130
- }
131
- },
132
- "MyApiDeploymentb23755fe76" : {
178
+ "MyApiDeployment967cf1a6ff" : {
133
179
"Type" : " AWS::ApiGateway::Deployment" ,
134
180
"Properties" : {
135
181
"RestApiId" : {
136
182
"Ref" : " MyApi"
137
183
},
138
- "Description" : " RestApi deployment id: b23755fe76eda84d559e1656bb6251c157662141"
139
- }
140
- },
141
- "MyApifetchBasePathMapping" : {
142
- "Type" : " AWS::ApiGateway::BasePathMapping" ,
143
- "Properties" : {
144
- "BasePath" : " fetch" ,
145
- "DomainName" : " api-regional.com" ,
146
- "RestApiId" : {
147
- "Ref" : " MyApi"
148
- },
149
- "Stage" : {
150
- "Ref" : " MyApiProdStage"
151
- }
184
+ "Description" : " RestApi deployment id: 967cf1a6ff8e58a6e739bf5b7b59a7d658e01a40"
152
185
}
153
186
},
154
187
"MyFunctionRole" : {
175
208
}
176
209
}
177
210
},
178
- "RecordSetGroup3505b49f8a" : {
179
- "Type" : " AWS::Route53::RecordSetGroup" ,
180
- "Properties" : {
181
- "HostedZoneId" : " my-edge-hosted-zone" ,
182
- "RecordSets" : [
183
- {
184
- "AliasTarget" : {
185
- "EvaluateTargetHealth" : true ,
186
- "HostedZoneId" : " Z2FDTNDATAQYW2" ,
187
- "DNSName" : " api-regional.com"
188
- },
189
- "Type" : " AAAA" ,
190
- "Name" : " api-regional.com"
191
- },
192
- {
193
- "AliasTarget" : {
194
- "EvaluateTargetHealth" : true ,
195
- "HostedZoneId" : " Z2FDTNDATAQYW2" ,
196
- "DNSName" : " api-regional.com"
197
- },
198
- "Type" : " AAAA" ,
199
- "Name" : " api-regional.com"
200
- }
201
- ]
202
- }
203
- },
204
- "ServerlessRestApiDeployment5332408c06" : {
205
- "Type" : " AWS::ApiGateway::Deployment" ,
206
- "Properties" : {
207
- "RestApiId" : {
208
- "Ref" : " ServerlessRestApi"
209
- },
210
- "Description" : " RestApi deployment id: 5332408c060674292fe4785c8cfe8b3a70858887" ,
211
- "StageName" : " Stage"
212
- }
213
- },
214
211
"MyApi" : {
215
212
"Type" : " AWS::ApiGateway::RestApi" ,
216
213
"Properties" : {
222
219
}
223
220
},
224
221
"paths" : {
225
- "/fetch/another " : {
222
+ "/fetch" : {
226
223
"post" : {
227
224
"x-amazon-apigateway-integration" : {
228
225
"httpMethod" : " POST" ,
238
235
"openapi" : " 3.0.1"
239
236
}
240
237
}
241
- },
242
- "ApiGatewayDomainNameb4325e3ba6" : {
243
- "Type" : " AWS::ApiGateway::DomainName" ,
244
- "Properties" : {
245
- "EndpointConfiguration" : {
246
- "Types" : [
247
- " REGIONAL"
248
- ]
249
- },
250
- "RegionalCertificateArn" : " my-edge-api-arn" ,
251
- "DomainName" : " api-edge.com"
252
- }
253
- },
254
- "ApiGatewayDomainName80a04c0ec3" : {
255
- "Type" : " AWS::ApiGateway::DomainName" ,
256
- "Properties" : {
257
- "CertificateArn" : " my-regional-cert-arn" ,
258
- "EndpointConfiguration" : {
259
- "Types" : [
260
- " EDGE"
261
- ]
262
- },
263
- "DomainName" : " api-regional.com"
264
- }
265
- },
266
- "MyApiProdStage" : {
267
- "Type" : " AWS::ApiGateway::Stage" ,
268
- "Properties" : {
269
- "DeploymentId" : {
270
- "Ref" : " MyApiDeploymentb23755fe76"
271
- },
272
- "RestApiId" : {
273
- "Ref" : " MyApi"
274
- },
275
- "StageName" : " Prod"
276
- }
277
- },
278
- "ServerlessRestApi" : {
279
- "Type" : " AWS::ApiGateway::RestApi" ,
280
- "Properties" : {
281
- "Body" : {
282
- "info" : {
283
- "version" : " 1.0" ,
284
- "title" : {
285
- "Ref" : " AWS::StackName"
286
- }
287
- },
288
- "paths" : {
289
- "/implicit" : {
290
- "post" : {
291
- "x-amazon-apigateway-integration" : {
292
- "httpMethod" : " POST" ,
293
- "type" : " aws_proxy" ,
294
- "uri" : {
295
- "Fn::Sub" : " arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${MyFunction.Arn}/invocations"
296
- }
297
- },
298
- "responses" : {}
299
- }
300
- }
301
- },
302
- "swagger" : " 2.0"
303
- }
304
- }
305
238
}
306
239
}
307
240
}
0 commit comments