How to simply use Bastion Host(Jump Host) in your CircleCI(or any other CI/CD) pipeline without using an extension or complicated configs to deploy an app with/without docker-compose
If you are using CircleCI as your CI/CD tool, probably you have already faced this puzzle or going to face it in the future if you have servers in a private network without a public network connection and you are connecting to them through the Bastion Host when you want to deploy these servers with CircleCI, you need to use extensions called orbs or you can use VPN as mentioned here: https://support.circleci.com/hc/en-us/articles/115014372807-IP-Address-ranges-for-safelisting-Do-you-have-static-IP-addresses-available-
But there is an easy way for this. I will show how to easily use your Bastion Host(Jump Host) to deploy to the servers which are in a private network. Of course, this is not limited to CircleCI. This approach can be used in any other CI/CD tool.
I will be using SSH port forwarding (SSH tunneling). I will be forwarding my local port 9001 through a bastion host, to a remote machine’s port 22 which is in a private network. For detailed info, you can take a look at this: https://www.ssh.com/ssh/tunneling/example
This is an example config.yml file for CircleCI but you can see that it can be used in any other tool too.