Last active
December 28, 2021 11:49
-
-
Save nathanpeck/2e5c9d9b1da4289fb722afaa4119070d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class MyEcsConstructStack extends cdk.Stack { | |
constructor(scope: cdk.App, id: string, props?: cdk.StackProps) { | |
super(scope, id, props); | |
const vpc = new ec2.VpcNetwork(this, 'MyVpc', { | |
maxAZs: 3 // Default is all AZs in region | |
}); | |
const cluster = new ecs.Cluster(this, 'MyCluster', { | |
vpc: vpc | |
}); | |
// Create a load-balanced Fargate service and make it public | |
new ecs.LoadBalancedFargateService(this, 'MyFargateService', { | |
cluster: cluster, // Required | |
cpu: '512', // Default is 256 | |
desiredCount: 6, // Default is 1 | |
image: ecs.ContainerImage.fromAsset(this, 'MyImage', { directory: './my-app-dir' }), | |
memoryMiB: '2048', // Default is 512 | |
publicLoadBalancer: true // Default is false | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment