
The problem is that in next to no time you find yourself in a situation where a number of people and services need access to things in the datacentre from outside and so by extension the bastion. You can set this up in a moment with no infrastructure. If you’re using AWS then it will probably be running some commodity linux distro and it will probably be using the Amazon provisioned public key. Your Bastion is quite likely going to be one of the first boxes you deploy.
#Terraform bastion windows#
you can also connect to a Windows host using RDP through a Linux ssh bastion or proxy ports for almost anything, SQL, webservers, etc. There are various implementations, for SSH RDP and VPN etc. The idea is that if you want to connect to something in the data centre, you connect to the bastion and then jump on from there to the target. This is a host that is connected both to the VPC/datacentre and also exposed to the internet at large. The standard solution is to use a Bastion Server or ‘Jump Box’. Whilst some things can be done through the console, that doesn’t cut it for machine accounts or automated tooling.
#Terraform bastion upgrade#
Even if you are using hosted services such as Amazon Relational Database Services you don’t want to make them publicly available for every Herbert out there to have a crack at and it may be non-trivial to upgrade the software in production with every minor release. You want to be able to ssh in to the various hosts and services but you don’t want every machine directly exposed to the internet. Typically you arrange your production machines in a datacentre, perhaps a real one but in the scenario here a virtual one, e.g. If you’re using GCP then to be honest you probably don’t need this at all.ĭefinition of a Bastion for those not familiar If you are not using AWS then you might find concentrating on the cloud-config user data stuff more useful as the rest would need to be ported, e.g. Whilst the principles are applicable universally, this specific solution employs a Terraform plan to deploy to AWS.
#Terraform bastion code#
Here I look at the problem, look at a couple of options and present a solution that I implemented providing Bastion ssh as a stateless service on AWS - the code is available on GitHub and also published on the Terraform Module Registry. Maybe it is the in-house file server, maybe something else, but if your infrastructure is in the cloud then it is most likely going to be your Bastion server (or ‘jump box’). pets, etc, are often and loudly repeated, but in many environments you often don’t have to look too far before you find some big fat pet box sprawling somewhere. This article has also been published on Medium The mantras of software as a service, stateless, cattle vs. I also have a presentation and live demonstration on the below, so far given at DevSecOps - London Gathering June 13 2018. So what does this look like in practice?ĭeploying ssh Bastion as a stateless service on AWS with Docker and Terraform.Definition of a Bastion for those not familiar.

Deploying ssh Bastion as a stateless service on AWS with Docker and Terraform.
