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:
  1. 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:

    ssh -i “bastion-keypair.pem” -L 6379:test-redis.1g4asi.clustercfg.aps1.cache.amazonaws.com:6379 ec2-user@bastionhostIP -N 

  2. 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




DevOps Online | Classroom Training|Contact 9390-999-614