I have created a Redis Elasticache cluster in AWS and would like to read and write data to the cluster using Python script which will eventually become a Lambda function. I've read that the typical way to connect to the cluster is EC2. I have setup an EC2 instance and connected to it successfully using SSH and key pair.
My questions are:
- Do I need an EC2 instance or can I connect directly to the cluster using Python?
- If I need to connect via EC2, what is the best way to do it so I can read and write the data from the Redis cluster or are there any examples? At the moment I have to go to EC2 and then Redis in an SSH session. I was thinking I would have to run the same commands in Python but njot sure how I would execute a redis command through an EC2 connection in Python.
Thanks for any help