How can I configure and access ElastiCache for Redis from my Lightsail instance?
I want to connect to Amazon ElastiCache for Redis endpoints from my Amazon Lightsail instance. How do I do this?
"I want to connect to Amazon ElastiCache for Redis endpoints from my Amazon Lightsail instance. How do I do this?ResolutionTo connect to an ElastiCache for Redis cluster from a Lightsail instance, do the following:(Optional) Create the Lightsail instance and ElastiCache for Redis resources if you haven't already done so.Configure the security group on the cluster to allow the connection.Turn on VPC peering on your Lightsail instance.Connect to the Redis cluster endpoint from the Lightsail instance.(Optional) Create the Lightsail instance and ElastiCache Redis resourcesFor information on creating a Lightsail instance and connecting to the instance, see Create an Amazon Lightsail instance.For information on creating an ElastiCache for Redis cluster, see Create a cluster.Note: Create the Lightsail and ElastiCache resources in the same Region. You must create the ElastiCache resources on the default VPC.Configure the security group on the cluster to allow the connectionMake sure that the security group of the ElastiCache for Redis cluster allows incoming TCP connections on port 6379 from the Lightsail instance's private IP address.To add inbound port 6379 to your ElastiCache for Redis cluster, do the following:1.    Open the Amazon ElastiCache console, and then select the AWS Region where the cluster is located.2.    In the ElastiCache console dashboard, choose Redis.3.    Select your cluster, and then note the security group associated with the cluster.4.    Open the Amazon VPC console and then select the security group you noted in step 3.5.    Add a new custom TCP rule for port 6379 from the source IP. In this case, the source IP is the private IP of the Lightsail instance.Turn on VPC peering on the Lightsail instanceFor information about turning on the VPC peering connection on the Lightsail instance, see Set up Amazon VPC peering to work with AWS resources outside of Amazon Lightsail.Note: Turn on VPC peering for the Region that you created your resources in.Connect to the Redis cluster endpoint from the Lightsail instance1.    Download and install redis-cli on your Lightsail instance. Redis-cli is a utility that you can use to connect to a cluster or replication group from within the instance.To install redis-cli on an Amazon Linux 2 instance:$ sudo yum install gcc$ sudo wget http://download.redis.io/redis-stable.tar.gz$ sudo tar xvzf redis-stable.tar.gz$ cd redis-stable$ sudo makeFor instructions on installing redis-cli on other Linux distribution, see Download and install redis-cli.2.    To connect to the cluster, run the following command. Replace cluster-endpoint and port number with the endpoint of your cluster and your port number. (The default port for Redis is 6379.)$ src/redis-cli -h cluster-endpoint -c -p port numberThe command returns a Redis command prompt similar to the following:cluster-endpoint: port numberNote: You can test the connection from your Lightsail instance to the Redis cluster endpoint by running the telnet command:$ telnet <redis_endpoint> 6379Follow"