Skip to content

Instantly share code, notes, and snippets.

@crisboarna
crisboarna / app.ts
Created April 9, 2023 14:16
Accessing isolated network estate on AWS: Part 1 - Bastion Host: App Stack
#!/usr/bin/env node
import 'source-map-support/register';
import * as cdk from 'aws-cdk-lib';
import { VpcStack } from '../lib/vpc-stack';
import { BastionStack } from '../lib/bastion-stack';
const app = new cdk.App();
const vpc = new VpcStack(app, 'VpcStack');
const bastion = new BastionStack(app, 'BastionStack', { vpc: vpc.vpc });
@crisboarna
crisboarna / bastion-stack.ts
Created April 9, 2023 14:14
Accessing isolated network estate on AWS: Part 1 - Bastion Host: Bastion Stack
import * as cdk from 'aws-cdk-lib';
import * as ec2 from 'aws-cdk-lib/aws-ec2';
import {Construct} from "constructs";
export class BastionStack extends cdk.Stack {
constructor(scope: Construct, id: string, props: { vpc: ec2.Vpc }, stackProps?: cdk.StackProps) {
super(scope, id, stackProps);
const { vpc } = props;
@crisboarna
crisboarna / vpc-stack.ts
Created April 9, 2023 14:06
Accessing isolated network estate on AWS: Part 1 - Bastion Host: VPC Stack
import * as cdk from 'aws-cdk-lib';
import * as ec2 from 'aws-cdk-lib/aws-ec2';
import {Construct} from "constructs";
export class VpcStack extends cdk.Stack {
public readonly vpc: ec2.Vpc;
constructor(scope: Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);