

Node.js and the Npm command line interface.Session Manager plugin for the AWS CLI.If you don’t have an AWS account, sign up at. Prerequisitesīefore getting started, make sure that you have the following. In the example shown in Figure 1, the bastion host connects to an Amazon RDS database instance in an isolated subnet. AwsBastion-Ec2CdkStack deploys into the private subnet the bastion host, EC2 key pair, security group, and IAM role and policy.Īs we show in the walkthrough, we use the allowedSecurityGroups parameter in cdk.json to define the resources to which the bastion host connects. If you use an existing VPC, you won’t deploy the first stack. AwsBastion-NetworkCdkStack deploys a new VPC, but you can also use an existing VPC. The GitHub repository we provide contains two stacks. Accessing a bastion host in the private subnet They can use the Session Manager plugin for AWS CLI, SSH, or the AWS Systems Manager console.įigure 1. Only IAM users can access the bastion host in the private subnet of the VPC. For more information, refer to Amazon VPC pricing.Īmazon Elastic Compute Cloud (Amazon EC2)įigure 1 shows the high-level architecture of our process. About this blog postĬosts depend on the VPC resources provisioned. Our process follows AWS Security best practices of granting least privilege and using roles to delegate permissions. We use the AWS Systems Manager Session Manager plugin for the AWS Command Line Interface (AWS CLI), SSH (Secure Shell), and the AWS Management Console. We demonstrate how users with that policy can access the bastion host using three operations. Second, we demonstrate using AWS CDK to define the target environment and deploy the bastion host stack into a new or existing VPC.įinally, we create an AWS Identity and Access Management (IAM) policy.

#Bastion host firewall how to#
First, I’ll show you how to configure AWS CDK and clone the GitHub repository I’ve prepared. In this post, we explain how to provision scalable and extendable secure bastion hosts in private subnets using AWS Cloud Development Kit (AWS CDK). But in a non-production environment, if you want to allow a group of developers to access an private resource, you might not want to use a bastion host accessible from the internet. Bastion hosts typically sit in public subnets. Deploying bastion hosts in private subnets is a way to provide temporary and limited access to non-production private resources in a virtual private cloud (VPC).
