Finding connection endpoints
Your application connects to your cluster using endpoints. An endpoint is a node or cluster's unique address.
Which endpoints to use
For ElastiCache serverless cache with Memcached, simply acquire the cluster endpoint DNS and port from the console.
From the AWS CLI, use the describe-serverless-caches
command to acquire the Endpoint information.
Linux
aws elasticache describe-serverless-caches --serverless-cache-name CacheName
Windows
aws elasticache describe-serverless-caches --serverless-cache-name CacheName
The output from the above operation should look something like this (JSON format):
{ "ServerlessCaches": [ { "ServerlessCacheName": "serverless-memcached", "Description": "test", "CreateTime": 1697659642.136, "Status": "available", "Engine": "memcached", "MajorEngineVersion": "1.6", "FullEngineVersion": "21", "SecurityGroupIds": [ "sg-083eda453e1e51310" ], "Endpoint": { "Address": "serverless-memcached-01.amazonaws.com", "Port":11211 }, "ARN": "<the ARN>", "SubnetIds": [ "subnet-0cf759df15bd4dc65", "subnet-09e1307e8f1560d17" ], "SnapshotRetentionLimit": 0, "DailySnapshotTime": "03:00" } ] }
For an instance based Memcached cluster, if you use Automatic Discovery then you can use the cluster's configuration endpoint to configure your Memcached client. This means you must use a client that supports Automatic Discovery.
If you don't use Automatic Discovery, you must configure your client to use the individual node endpoints for reads and writes. You must also keep track of them as you add and remove nodes.
The following sections guide you through discovering the endpoints you'll need for the engine you're running.
All Memcached endpoints are read/write endpoints. To connect to nodes in a Memcached cluster your application can use either the endpoints for each node, or the cluster's configuration endpoint along with Automatic Discovery. To use Automatic Discovery you must use a client that supports Automatic Discovery.
When using Automatic Discovery, your client application connects to your Memcached cluster using the configuration endpoint. As you scale your cluster by adding or removing nodes, your application will automatically "know" all the nodes in the cluster and be able to connect to any of them. Without Automatic Discovery your application would have to do this, or you'd have to manually update endpoints in your application each time you added or removed a node.
To copy an endpoint, choose the copy icon directly in front of the endpoint address. For information on using the endpoint to connect to a node, see Connecting to nodes .
Configuration and node endpoints look very similar. The differences are highlighted with bold following.
myclustername.xxxxxx
.cfg.usw2.cache.amazonaws.com:port
# configuration endpoint contains "cfg"
myclustername.xxxxxx
.0001.usw2.cache.amazonaws.com:port
# node endpoint for node 0001
Important
If you choose to create a CNAME for your Memcached configuration endpoint,
in order for your automatic discovery client to recognize the CNAME as a configuration endpoint,
you must include .cfg.
in the CNAME.
You can use the AWS CLI for Amazon ElastiCache to discover the endpoints for nodes and clusters.
Finding Endpoints for Nodes and Clusters (AWS CLI)
You can use the AWS CLI to discover the endpoints for a cluster and its nodes with the
describe-cache-clusters
command.
For Memcached clusters, the command returns the configuration endpoint.
If you include the optional parameter --show-cache-node-info
,
the command will also return the endpoints of the individual nodes in the cluster.
The following command retrieves the configuration endpoint (ConfigurationEndpoint
) and
individual node endpoints (Endpoint
) for the Memcached cluster mycluster.
For Linux, macOS, or Unix:
aws elasticache describe-cache-clusters \ --cache-cluster-id
mycluster
\ --show-cache-node-info
For Windows:
aws elasticache describe-cache-clusters ^ --cache-cluster-id
mycluster
^ --show-cache-node-info
Output from the above operation should look something like this (JSON format).
{
"CacheClusters": [
{
"Engine": "memcached",
"CacheNodes": [
{
"CacheNodeId": "0001",
"Endpoint": {
"Port": 11211,
"Address": "mycluster.amazonaws.com"
},
"CacheNodeStatus": "available",
"ParameterGroupStatus": "in-sync",
"CacheNodeCreateTime": "2016-09-22T21:30:29.967Z",
"CustomerAvailabilityZone": "us-west-2b"
},
{
"CacheNodeId": "0002",
"Endpoint": {
"Port": 11211,
"Address": "mycluster.amazonaws.com"
},
"CacheNodeStatus": "available",
"ParameterGroupStatus": "in-sync",
"CacheNodeCreateTime": "2016-09-22T21:30:29.967Z",
"CustomerAvailabilityZone": "us-west-2b"
},
{
"CacheNodeId": "0003",
"Endpoint": {
"Port": 11211,
"Address": "mycluster.amazonaws.com"
},
"CacheNodeStatus": "available",
"ParameterGroupStatus": "in-sync",
"CacheNodeCreateTime": "2016-09-22T21:30:29.967Z",
"CustomerAvailabilityZone": "us-west-2b"
}
],
"CacheParameterGroup": {
"CacheNodeIdsToReboot": [],
"CacheParameterGroupName": "default.memcached1.4",
"ParameterApplyStatus": "in-sync"
},
"CacheClusterId": "mycluster",
"PreferredAvailabilityZone": "us-west-2b",
"ConfigurationEndpoint": {
"Port": 11211,
"Address": "mycluster.amazonaws.com"
},
"CacheSecurityGroups": [],
"CacheClusterCreateTime": "2016-09-22T21:30:29.967Z",
"AutoMinorVersionUpgrade": true,
"CacheClusterStatus": "available",
"NumCacheNodes": 3,
"ClientDownloadLandingPage": "https://console.aws.amazon.com/elasticache/home#client-download:",
"CacheSubnetGroupName": "default",
"EngineVersion": "1.4.24",
"PendingModifiedValues": {},
"PreferredMaintenanceWindow": "mon:09:00-mon:10:00",
"CacheNodeType": "cache.m4.large",
}
]
}
Important
If you choose to create a CNAME for your Memcached configuration endpoint,
in order for your auto discovery client to recognize the CNAME as a configuration endpoint,
you must include .cfg.
in the CNAME. For example, mycluster
in your php.ini file for the .cfg.
localsession.save_path
parameter.
For more information, see the topic describe-cache-clusters.
You can use the Amazon ElastiCache API to discover the endpoints for nodes and clusters.
Finding Endpoints for Nodes and Clusters (ElastiCache API)
You can use the ElastiCache API to discover the endpoints for a cluster and its nodes with the
DescribeCacheClusters
action.
For Memcached clusters, the command returns the configuration endpoint.
If you include the optional parameter ShowCacheNodeInfo
,
the action also returns the endpoints of the individual nodes in the cluster.
The following command retrieves the configuration endpoint (ConfigurationEndpoint
) and
individual node endpoints (Endpoint
) for the Memcached cluster mycluster.
https://elasticache.us-west-2.amazonaws.com/ ?Action=DescribeCacheClusters &CacheClusterId=mycluster &ShowCacheNodeInfo=true &SignatureVersion=4 &SignatureMethod=HmacSHA256 &Timestamp=20150202T192317Z &Version=2015-02-02 &X-Amz-Credential=<credential>
Important
If you choose to create a CNAME for your Memcached configuration endpoint,
in order for your auto discovery client to recognize the CNAME as a configuration endpoint,
you must include .cfg.
in the CNAME. For example, mycluster
in your php.ini file for the .cfg.
localsession.save_path
parameter.