-
Notifications
You must be signed in to change notification settings - Fork 0
/
domain-template.yml
63 lines (61 loc) · 1.6 KB
/
domain-template.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
AWSTemplateFormatVersion: '2010-09-09'
Description: |
Deploys a custom domain for a API
Parameters:
ServiceName:
Description: The name of the service that you are deploying
Type: String
Default: whos-that-pokemon
Stage:
Description: The Stage/Environment you are building in.
Type: String
Default: prod
AllowedValues:
- local-dev
- dev
- test
- prod
ApiDomain:
Description: The domain
Type: String
Default: whosthatpokemon.xyz
ApiDomainCertificate:
Description: The certificate arn for the domain that are you using
Type: String
Default: arn:aws:acm:us-east-1:934679804324:certificate/e9d4580c-1ff4-4836-9a7e-9a9e532be2e6
Resources:
ApiGatewayCustomDomainName:
Type: AWS::ApiGateway::DomainName
Properties:
DomainName:
Fn::Sub: api.${ApiDomain}
EndpointConfiguration:
Types:
- REGIONAL
RegionalCertificateArn:
Ref: ApiDomainCertificate
ApiGatewayCustomDomainMapping:
Type: AWS::ApiGateway::BasePathMapping
DependsOn:
- ApiGatewayCustomDomainName
Properties:
BasePath: "v1"
DomainName:
Fn::Sub: api.${ApiDomain}
RestApiId:
Fn::ImportValue:
Fn::Sub: ${Stage}-${ServiceName}-api-id
Stage:
Fn::Sub: ${Stage}
CustomDomainRecord:
Type: AWS::Route53::RecordSet
Properties:
Type: CNAME
HostedZoneName:
Fn::Sub: ${ApiDomain}.
Name:
Fn::Sub:
api.${ApiDomain}
ResourceRecords:
- Fn::Sub: ${ApiGatewayCustomDomainName.RegionalDomainName}
TTL: 300