Search code examples
amazon-web-servicesaws-cloudformationamazon-route53amazon-elasticache

change ElastiCache node DNS record in cloud formation template


I need to create CNAME record for ElastiCache Cluster. However, I build redis cluster and there is only one node. As far as I found there is no ConfigurationEndpoint.Address for redis cluster. Is there any chance to change DNS name for node in cluster and how to do it?

Currently template looks like:

  "ElastiCahceDNSRecord" : {
  "Type" : "AWS::Route53::RecordSetGroup",
  "Properties" : {
    "HostedZoneName" : "example.com.",
    "Comment" : "Targered to ElastiCache",
    "RecordSets" : [{
    "Name" : "elche01.example.com.",
    "Type" : "CNAME",
    "TTL" : "300",
    "ResourceRecords" :  [
        {
            "Fn::GetAtt": [ "myelasticache", "ConfigurationEndpoint.Address" ]
        }
    ]

    }]

  }

}


Solution

  • Looks like the ConfigurationEndpoint.Address is only supported for Memcached clusters, not for Redis. Please see this relevant discussion in the AWS forums.

    Also, the AWS Auto Discovery docs (still) state:

    Note

    Auto Discovery is only available for cache clusters running the Memcached engine. Redis cache clusters are single node clusters, thus there is no need to identify and track all the nodes in a Redis cluster.

    Looks like your 'best' solution is to query the individual endpoint(s) in us, in order to determine the addresses to connect to, using AWS::CloudFormation::Init as is suggested on the AWS forums thread.

    UPDATE

    As @slimdrive pointed out below, this IS now possible, through the AWS::ElastiCache::CacheCluster. Please read further below for more details.