import * as cdk from '@aws-cdk/core' ; 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' ; import path = require ( 'path' ) ; export class CdkStack extends cdk . Stack { constructor ( scope , id , props ? ) { super ( scope , id , props ) ; const vpc = new ec2 . Vpc ( this , 'MyVpc' , { maxAzs : 3 } ) ; const cluster = new ecs . Cluster ( this , 'MyCluster' , { vpc : vpc } ) ; const fargate = new ecs_patterns . ApplicationLoadBalancedFargateService ( this , 'MyFargateService' , { cluster : cluster , cpu : 512 , desiredCount : 1 , taskImageOptions : { image : ecs . ContainerImage . fromAsset ( path . join ( __dirname , '../src/' ) ) , environment : { "name" : "Serverless Fargate" , } , } , memoryLimitMiB : 2048 , } ) ; } }