Dragonfly Cloud announces new enterprise security features - learn more

Question: How to Access AWS ElastiCache Redis Using AWS CLI

Answer

To access AWS ElastiCache Redis using the AWS CLI, follow these steps:

  1. 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:

    aws configure
  2. List available ElastiCache clusters: Use the following command to list all available ElastiCache clusters:

    aws elasticache describe-cache-clusters --engine redis
  3. Find the connection endpoint: Identify the cache cluster you want to connect to and note down the ConfigurationEndpoint.Address and ConfigurationEndpoint.Port. The output will be in JSON format.

  4. 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 redis-cli, redis-py, or node-redis. For example, using redis-cli:

    redis-cli -h <ConfigurationEndpoint.Address> -p <ConfigurationEndpoint.Port>

Replace <ConfigurationEndpoint.Address> and <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.

Was this content helpful?

White Paper

Free System Design on AWS E-Book

Download this early release of O'Reilly's latest cloud infrastructure e-book: System Design on AWS.

Free System Design on AWS E-Book

Switch & save up to 80% 

Dragonfly is fully compatible with the Redis ecosystem and requires no code changes to implement. Instantly experience up to a 25X boost in performance and 80% reduction in cost