I need to expose the Reader Endpoint of my Redis ReplicationGroup so it can be used by dependent CloudFormation stacks.
I've previously used the primary endpoint, which is available as a CloudFormation return value, but I now need to use the Reader Endpoint, introduced in June 2019 [https://aws.amazon.com/about-aws/whats-new/2019/06/amazon-elasticache-launches-reader-endpoint-for-redis/].
However the Reader Endpoint does not appear in the Return Values in the CloudFormation documentation [https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticache-replicationgroup.html]
My stack outputs are defined as:
MyReplicationGroup.PrimaryEndPoint.Address
MyReplicationGroup.PrimaryEndPoint.Port
Is the Reader Endpoint available, but not yet documented? Perhaps the following is all I need?
MyReplicationGroup.ReaderEndPoint.Address
MyReplicationGroup.ReaderEndPoint.Port
I'd rather not use the ReadEndPoint.Addresses and ReadEndPoint.Ports as these are lists of replicas, and I then need to programmatically choose which to connect to - the Reader Endpoint will do all that for me (that is the whole point of it).
If a Redis (cluster mode disabled) cluster has multiple nodes, there are three types of endpoints; the primary endpoint, the reader endpoint and the node endpoints.
Redis (Cluster Mode Enabled) endpointsA Redis (cluster mode enabled) cluster has a single configuration endpoint. By connecting to the configuration endpoint, your application is able to discover the primary and read endpoints for each shard in the cluster.
A Replicate endpoint can be either a source or a target. A source endpoint contains the original data (the data you want to copy). A target endpoint is where the replicated data is stored. Source and target can be completely different endpoints.. There is no need to install any additional software other than Replicate.
The AWS::ElastiCache::ReplicationGroup resource creates an Amazon ElastiCache Redis replication group. A Redis (cluster mode disabled) replication group is a collection of cache clusters, where one of the clusters is a primary read-write cluster and the others are read-only replicas.
Reader Endpoint Address is not currently exposed.
But there is a relationship between a Primary Endpoint and a Reader Endpoint which you can utilize.
Suppose you have a primary endpoint one.two.three.com.
Then reader endpoint would be one-ro.two.three.com.
In this way, you can generate the address for a Reader Endpoint with the help of a corresponding Primary Endpoint.
Note: I know this is not the permanent solution but for now as a workaround we can deduce the Reader Endpoint with the help of the Primary Endpoint.
You may have to resort to raising an issue on the Cloudformation coverage roadmap to make the Reader Endpoint attributes available for use in Cloudformation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With