Connecting to DocumentDB or ElasticCache-Redis from your Local Machine
DocumentDB on AWS or Redis will not allow direct connections from your
local network. So we need to connect to bastion host in that VPC and from
there we have to connect to the database(DocumentDB/Redis) on AWS.
So
follow the steps below to connect to the Database endpoint:
Establish a tunnel to the database endpoint using putty(on Windows)
or ssh tunnel(Mac/Linux). In putty we need to give bastion host ip
address, ssh private key file, and in tunnel give local port number
and remote endpoint and port and click on add, then save the
connection and open it. Mac users can keep running tunnel as below:
Now you will be able to connect to Database endpoint using hostname
as localhost and respective port
*for example to connect to redis database: use $redis-cli -h localhost
-p 6379