cdk for deploying stack with http

This commit is contained in:
Matthew Zhao
2021-03-02 22:57:49 -08:00
parent 78c06f8fc4
commit 9b1a240837
11 changed files with 14377 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
import * as cdk from '@aws-cdk/core';
// import dependencies for ECS and building a VPC
import * as ec2 from "@aws-cdk/aws-ec2";
import * as ecs from "@aws-cdk/aws-ecs";
import * as ecs_patterns from "@aws-cdk/aws-ecs-patterns";
export class DeployStack extends cdk.Stack {
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
// create vpc with 3 subnets
const vpc = new ec2.Vpc(this, "LocalTunnelVPC", {
maxAzs: 3
})
// create the ecs cluster
const cluster = new ecs.Cluster(this, "LocalTunnelCluster", {
vpc: vpc
})
// create LBed Fargate service
new ecs_patterns.ApplicationLoadBalancedFargateService(this, "LocalTunnelService", {
cluster: cluster,
cpu: 512,
desiredCount: 1,
taskImageOptions: {
image: ecs.ContainerImage.fromRegistry("defunctzombie/localtunnel-server:latest")
},
memoryLimitMiB: 2048,
publicLoadBalancer : true,
assignPublicIp: true
})
}
}