To access AWS ElastiCache Redis using the AWS CLI, follow these steps:
Install and configure the AWS CLI: Make sure you have the AWS CLI installed on your system. If not, you can install it using these instructions. After installation, configure the CLI with your AWS credentials using the following command:
List available ElastiCache clusters: Use the following command to list all available ElastiCache clusters:
Find the connection endpoint:
Identify the cache cluster you want to connect to and note down the
ConfigurationEndpoint.Port. The output will be in JSON format.
Connect using an external Redis client:
Although the AWS CLI does not provide a direct way to interact with the Redis data store, you can use any external Redis client to connect to the ElastiCache Redis endpoint. Some popular clients are
node-redis. For example, using
<ConfigurationEndpoint.Port> with the values obtained in step 3.
Please note that by default, AWS ElastiCache Redis instances do not allow connections from outside the VPC. You may need to set up a VPN, bastion host, or VPC peering to establish a connection from an external client.