Skip to content

Commit 2d26df2

Browse files
authored
Setup CFN for Linkry Domain names (#37)
* add domain name for linkry * update cfn
1 parent 54a5804 commit 2d26df2

File tree

1 file changed

+57
-9
lines changed

1 file changed

+57
-9
lines changed

cloudformation/main.yml

Lines changed: 57 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Parameters:
2525

2626
Conditions:
2727
IsProd: !Equals [!Ref RunEnvironment, 'prod']
28+
IsDev: !Equals [!Ref RunEnvironment, 'dev']
2829
ShouldAttachVpc:
2930
!Equals [true, !Ref VpcRequired]
3031

@@ -39,10 +40,14 @@ Mappings:
3940
ApiCertificateArn: arn:aws:acm:us-east-1:427040638965:certificate/63ccdf0b-d2b5-44f0-b589-eceffb935c23
4041
HostedZoneId: Z04502822NVIA85WM2SML
4142
ApiDomainName: "aws.qa.acmuiuc.org"
43+
LinkryApiDomainName: "aws.qa.acmuiuc.org"
44+
LinkryApiCertificateArn: arn:aws:acm:us-east-1:427040638965:certificate/63ccdf0b-d2b5-44f0-b589-eceffb935c23
4245
prod:
4346
ApiCertificateArn: arn:aws:acm:us-east-1:298118738376:certificate/6142a0e2-d62f-478e-bf15-5bdb616fe705
4447
HostedZoneId: Z05246633460N5MEB9DBF
45-
ApiDomainName: "aws.acmuiuc.org" # CHANGE ME
48+
ApiDomainName: "aws.acmuiuc.org"
49+
LinkryApiDomainName: "acm.illinois.edu"
50+
LinkryApiCertificateArn: arn:aws:acm:us-east-1:298118738376:certificate/a902d70d-1991-400e-8be9-65befa8fa324
4651
EnvironmentToCidr:
4752
dev:
4853
SecurityGroupIds:
@@ -93,7 +98,7 @@ Resources:
9398
Environment:
9499
Variables:
95100
RunEnvironment: !Ref RunEnvironment
96-
VpcConfig:
101+
VpcConfig:
97102
Ipv6AllowedForDualStack: !If [ShouldAttachVpc, True, !Ref AWS::NoValue]
98103
SecurityGroupIds: !If [ShouldAttachVpc, !FindInMap [EnvironmentToCidr, !Ref RunEnvironment, SecurityGroupIds], !Ref AWS::NoValue]
99104
SubnetIds: !If [ShouldAttachVpc, !FindInMap [EnvironmentToCidr, !Ref RunEnvironment, SubnetIds], !Ref AWS::NoValue]
@@ -107,7 +112,7 @@ Resources:
107112

108113
IamGroupRolesTable:
109114
Type: 'AWS::DynamoDB::Table'
110-
DeletionPolicy: "Retain"
115+
DeletionPolicy: "Retain"
111116
Properties:
112117
BillingMode: 'PAY_PER_REQUEST'
113118
TableName: infra-core-api-iam-grouproles
@@ -123,7 +128,7 @@ Resources:
123128

124129
IamUserRolesTable:
125130
Type: 'AWS::DynamoDB::Table'
126-
DeletionPolicy: "Retain"
131+
DeletionPolicy: "Retain"
127132
Properties:
128133
BillingMode: 'PAY_PER_REQUEST'
129134
TableName: infra-core-api-iam-userroles
@@ -139,7 +144,7 @@ Resources:
139144

140145
EventRecordsTable:
141146
Type: 'AWS::DynamoDB::Table'
142-
DeletionPolicy: "Retain"
147+
DeletionPolicy: "Retain"
143148
Properties:
144149
BillingMode: 'PAY_PER_REQUEST'
145150
TableName: infra-core-api-events
@@ -164,7 +169,7 @@ Resources:
164169

165170
CacheRecordsTable:
166171
Type: 'AWS::DynamoDB::Table'
167-
DeletionPolicy: "Retain"
172+
DeletionPolicy: "Retain"
168173
Properties:
169174
BillingMode: 'PAY_PER_REQUEST'
170175
TableName: infra-core-api-cache
@@ -183,7 +188,7 @@ Resources:
183188

184189
AppApiGateway:
185190
Type: AWS::Serverless::Api
186-
DependsOn:
191+
DependsOn:
187192
- AppApiLambdaFunction
188193
Properties:
189194
Name: !Sub ${ApplicationPrefix}-gateway
@@ -194,7 +199,7 @@ Resources:
194199
Name: AWS::Include
195200
Parameters:
196201
Location: ./phony-swagger.yml
197-
Domain:
202+
Domain:
198203
DomainName: !Sub
199204
- "${ApplicationPrefix}.${BaseDomainName}"
200205
- BaseDomainName: !FindInMap
@@ -296,4 +301,47 @@ Resources:
296301
- !Ref AWS::AccountId
297302
- ":"
298303
- !Ref AppApiGateway
299-
- "/*/*/*"
304+
- "/*/*/*"
305+
306+
LinkryCustomDomainName:
307+
Type: AWS::ApiGateway::DomainName
308+
Properties:
309+
RegionalCertificateArn: !FindInMap [ApiGwConfig, !Ref RunEnvironment, LinkryApiCertificateArn]
310+
EndpointConfiguration:
311+
Types:
312+
- REGIONAL
313+
DomainName: !Sub
314+
- "go.${BaseDomainName}"
315+
- BaseDomainName: !FindInMap
316+
- ApiGwConfig
317+
- !Ref RunEnvironment
318+
- LinkryApiDomainName
319+
SecurityPolicy: TLS_1_2
320+
321+
LinkryRoute53RecordSetDev:
322+
Condition: IsDev
323+
Type: AWS::Route53::RecordSet
324+
Properties:
325+
HostedZoneId: !FindInMap [ApiGwConfig, !Ref RunEnvironment, HostedZoneId]
326+
Name: !Sub
327+
- "go.${BaseDomainName}"
328+
- BaseDomainName: !FindInMap
329+
- ApiGwConfig
330+
- !Ref RunEnvironment
331+
- LinkryApiDomainName
332+
Type: A
333+
AliasTarget:
334+
DNSName: !GetAtt LinkryCustomDomainName.RegionalDomainName
335+
HostedZoneId: !GetAtt LinkryCustomDomainName.RegionalHostedZoneId
336+
337+
LinkryApiMapping:
338+
Type: 'AWS::ApiGatewayV2::ApiMapping'
339+
Properties:
340+
DomainName: !Sub
341+
- "go.${BaseDomainName}"
342+
- BaseDomainName: !FindInMap
343+
- ApiGwConfig
344+
- !Ref RunEnvironment
345+
- LinkryApiDomainName
346+
ApiId: !Ref AppApiGateway
347+
Stage: default

0 commit comments

Comments
 (0)