I have my application deployed on a private ec2 instance in a private subnet. I have also created a public subnet through which any of my team members can ssh into the private instance. So the same thing I want to do with circle ci first I am making a connection of circleci to a public instance and within that instance it is ssh into a private instance. I have tested the connect locally it is working well, the security group, subnets, VPC everything is cool. but the problem is that circle ci is unable to ssh into the private instance but good in a public instance. I have also edited ~/.ssh/hosts in a public subnet to add an entry to private instance Also I have added the circleci key to both instances.
This is the bash script that circleci is running while deployment.
command: bash ./aws_deploy.sh "$CIRCLE_BRANCH" "$SSH_EC2_IP" "$BETA_EC2_IP"
./aws_deploy.sh
ssh -A -tt -o StrictHostKeyChecking=no $2"
ssh -i sultan-key.pem $3'
cd /var/www/linkedunion-development/
git fetch --all
git checkout -B $1 origin/$1
docker-compose down -v
docker system prune --all --force
docker stop $(docker ps -q)
docker rm $(docker ps -aq)
docker rmi $(docker images -q)
git pull
./git_fetch.sh'"
This is the error circle ci is throwing
Warning: Permanently added '54.215.128.217' (ECDSA) to the list of known hosts. ssh: Could not resolve hostname 10.0.20.108 cd /var/www/linkedunion-development/ git fetch --all git checkout -b nt-migrate-prestagi: Name or service not known Connection to 54.215.128.217 closed.
Exited with code exit status 255
Please help!