Terms Of Use

Privacy Policy

Featured snippets are MIT license

Gears & Masters

DevOpsnipp.com © 2020

medium.png

Route 53 CNAME record

Creates an Route 53 CNAME record.

5

Votes

{
  "AWSTemplateFormatVersion" : "2010-09-09",

  "Description" : "AWS CloudFormation Sample Template Route53_CNAME: Sample template showing how to create an Amazon Route 53 CNAME record.  It assumes that you already have a Hosted Zone registered with Amazon Route 53. **WARNING** This template creates one or more AWS resources. You will be billed for the AWS resources used if you create a stack from this template.",

  "Parameters" : {
    "HostedZone" : {
      "Type" : "String",
      "Description" : "The DNS name of an existing Amazon Route 53 hosted zone",
      "AllowedPattern" : "(?!-)[a-zA-Z0-9-.]{1,63}(?<!-)",
      "ConstraintDescription" : "must be a valid DNS zone name."
    }
  },

  "Resources" : {
    "MyDNSRecord" : {
      "Type" : "AWS::Route53::RecordSet",
      "Properties" : {
        "HostedZoneName" : { "Fn::Join" : [ "", [{"Ref" : "HostedZone"}, "." ]]},
        "Comment" : "CNAME redirect to aws.amazon.com.",
        "Name" : { "Fn::Join" : [ "", [{"Ref" : "AWS::StackName"}, ".", {"Ref" : "AWS::Region"}, ".", {"Ref" : "HostedZone"}, "."]]},
        "Type" : "CNAME",
        "TTL" : "900",
        "ResourceRecords" : ["aws.amazon.com"]
      }
    }
  },
  "Outputs" : {
    "CNAME" : {
      "Description" : "Fully qualified domain name",
      "Value" : { "Ref" : "MyDNSRecord" }
    }
  }
}

Vote Here

You must earn at least 1 vote on your snippets to be allowed to vote