How can you make the local Django development server assume that it is running on your AWS network using SSH tunneling?
In my scenario, I am running a local Django server, i.e. python manage.py runserver
and Redis as a cache (Elasticache). When my application runs in AWS, it has access to Elasticache, but locally it won’t (and that’s good). If for some reason I want to test my local environment using Elasticache, I need to use SSH tunneling somehow to make AWS assume that it is working inside the VPC network.
I tried to get this to work using below. I have confirmed that I can connect locally using SSH tunneling with Redis Desktop Manager , so 100% I know that AWS supports this, my problem now does the same thing with Django.
Here is what I tried:
> python manage.py runserver 8000 > ssh -i mykey.pem ec2-user@myRandomEC2.com -L 6379:localhost:6379
I get a "Error 60 connect to" message when I visit http://127.0.0.1:8000/
.
What am I doing wrong here?
Notes:
ec2-user@myRandomEC2.com
is not a Redis server, but another AWS EC2 Instance that has access to Elasticache, which I want to use as a tunnel.mykey.pem
has access and the correct permission.- The ec2 exam has all access rights and access ports.
- SSH tunneling with Redis Desktop Manager has been tested, and it works for this software.
- Elasticache and EC2 instances are in the same region and can connect to each other.
source share