Amazon ElastiCache for Redis is designed for use within Virtual Private Cloud (VPC) and is not meant to be accessed publicly by default. However, you can make your ElastiCache Redis cluster publically accessible by following these steps:
aws elasticache create-cache-subnet-group \
--cache-subnet-group-name <subnet_group_name> \
--cache-subnet-group-description "Public Subnet Group" \
--subnet-ids <comma_separated_subnet_ids>
aws ec2 create-security-group \
--group-name <security_group_name> \
--description "Security group for public access to Redis"
aws ec2 authorize-security-group-ingress \
--group-id <security_group_id> \
--protocol tcp \
--port 6379 \
--cidr <source_ip_range>
Replace <source_ip_range>
with the desired IP range (e.g., 0.0.0.0/0 for open access).
aws elasticache create-cache-cluster \
--cache-cluster-id <cluster_id> \
--engine "redis" \
--cache-node-type <cache_node_type> \
--num-cache-nodes 1 \
--cache-subnet-group-name <subnet_group_name> \
--security-group-ids <comma_separated_security_group_ids> \
--engine-version <redis_engine_version>
aws ec2 create-nat-gateway \
--subnet-id <public_subnet_id> \
--allocation-id <elastic_ip_allocation_id>
aws ec2 create-route \
--route-table-id <route_table_id> \
--destination-cidr-block 0.0.0.0/0 \
--nat-gateway-id <nat_gateway_id>
Please note that making your ElastiCache Redis cluster publicly accessible may expose it to security risks. Make sure to enforce strong authentication and encryption mechanisms for connections to your cluster.
Dragonfly is fully compatible with the Redis ecosystem and requires no code changes to implement.