Skip to content

Commit 552d685

Browse files
committed
map the custom domain to cloudfront instead of the api gateway
1 parent 4475721 commit 552d685

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

cloudformation/custom-domain.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ Parameters:
1616
AllowedValues: [ 'dev', 'prod' ]
1717
RecordName:
1818
Type: String
19+
CloudfrontDomain:
20+
Type: String
1921

2022
Conditions:
2123
IsDev: !Equals [!Ref RunEnvironment, 'dev']
@@ -44,7 +46,7 @@ Resources:
4446
Properties:
4547
HostedZoneId: !Ref GWHostedZoneId
4648
Name: !Sub "${RecordName}.${GWBaseDomainName}"
47-
Type: A
48-
AliasTarget:
49-
DNSName: !GetAtt CustomDomainName.RegionalDomainName
50-
HostedZoneId: !GetAtt CustomDomainName.RegionalHostedZoneId
49+
Type: CNAME
50+
TTL: 300
51+
ResourceRecords:
52+
- !Ref CloudfrontDomain

cloudformation/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ Resources:
119119
GWApiId: !Ref AppApiGateway
120120
GWHostedZoneId:
121121
!FindInMap [ApiGwConfig, !Ref RunEnvironment, HostedZoneId]
122+
CloudfrontDomain: !GetAtt [AppFrontendCloudfrontDistribution, DomainName]
122123

123124
LinkryDomainProxy:
124125
Type: AWS::Serverless::Application
@@ -138,6 +139,7 @@ Resources:
138139
GWApiId: !Ref AppApiGateway
139140
GWHostedZoneId:
140141
!FindInMap [ApiGwConfig, !Ref RunEnvironment, HostedZoneId]
142+
CloudfrontDomain: !GetAtt [AppFrontendCloudfrontDistribution, DomainName]
141143

142144
CoreUrlProd:
143145
Type: AWS::Serverless::Application

0 commit comments

Comments
 (0)