How can you make your local Django development server think it's running inside your AWS network using SSH tunneling?
My scenario, I'm running a local Django server i.e. python manage.py runserver and Redis as cache backend (Elasticache). When my app runs in the AWS environment it has access to Elasticache, but, Locally it won't (and that's a good thing). If for some reason I want to test my local environment with Elasticache I need to somehow use SSH tunneling to make AWS think it's running inside the VPC network.
I've tried to get this working by using below. I've confirmed I can connect locally using SSH tunneling with Redis Desktop Manager so 100% I know AWS supports this, my problem is now doing the same thing with Django.
This is what I've tried:
> python manage.py runserver 8000
> ssh -i mykey.pem [email protected] -L 6379:localhost:6379
I get the message "Error 60 connecting to" message when I visit http://127.0.0.1:8000/.
What I'm I doing wrong here?
Notes:
[email protected]is not the Redis server, just another EC2 instance on AWS that has access Elasticache that I want to use as a tunnel.- The
mykey.pemhas access and the correct permission. - The ec2 instance has all the correct permissions and ports for access.
- Tested SSH tunneling with Redis Desktop Manager and this works for that software.
- Elasticache and the EC2 instances are all in the same region and can connect to each other.
6379:localhost:6379, but instead something like6379:redis-servers.ip.address:6379, but that's just a guess. Usessh -vvto debug tunneling problems, it will print out a bunch of stuff to stderr. - koniiiik