The RecordSet stack

We can create a template for RecordSet, given as follows:

  1. Start the template with the template version and a description (optional).
  2. Define the parameters (of the string type) for the root domain name, the sub-domain name, and the S3 hosted zone ID.

Note that the S3 hosted zone is static, based on the region (for example, Z2FDTNDATAQYW2 for ap-south-1).

  1. Define a resource of the type RecordSetGroup type to add A records for the domains:
Resources:
QuizzerCloudDNS:
Type: AWS::Route53::RecordSetGroup
Properties:
HostedZoneName: !Sub
- ${DomainName}.
- DomainName: !Ref RootDomainName
Comment: Zone apex alias.
RecordSets:
-
Name: !Ref RootDomainName
Type: A
AliasTarget:
HostedZoneId: !Ref RecordHostedZoneId
DNSName: !ImportValue CloudFrontDomainName
-
Name: !Ref SubDomainName
Type: A
AliasTarget:
HostedZoneId: !Ref RecordHostedZoneId
DNSName: !ImportValue CloudFrontDomainName

The HostedZoneName is the domain name, followed by a dot (.), and the RecordHostedZone ID is a constant value for all of the CloudFront distributions

  1. Define an Outputs section to return the URLs (optional).
  2. Execute the aws cloudformation create-stack by passing the parameters, and then verify the following:

After executing the create-stack sub-command, check the status by using the describe-stacks sub-command. Once it is successful, it should return a response with the following Outputs section:

We can verify that everything worked by going to quizzercloud.com and www.quizzercloud.com in a browser, as shown in the following screenshot:

Note that the URL is not secure. Even if we use HTTPS, we will still get a Not Secure message, as we do not have a valid certificate for this domain. We will look at how to fix this in the next recipe.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.37.20