https://github.com/sambaiz/ecs-boilerplate
ECS上でアプリケーションを動かすBoilerplateを作った。CDKでデプロイする。以前Digdagを動かしたときのを汎用的にしたもの。
CDKでECS+Fargate上にDigdagを立ててCognito認証を挟む - sambaiz-net
new ECSStack(app, 'ECSBoilerplateSampleStack', {
/*
// If vpcAttributes is not specified, new VPC is created.
vpcAttributes: {
vpcId: '',
availabilityZones: [],
publicSubnetIds: [],
privateSubnetIds: [],
},
// DNS record. Even if this is not specified, you can access with ELB domain (***.elb.amazonaws.com)
route53: {
zoneId: '',
zoneName: 'example.com',
recordName: 'foo',
},
// Certificate Manager ARN. Required if accessing with HTTPS
acmArn: 'arn:aws:acm:****'
// default values
containerPort: 8080,
cpu: 256,
memoryLimitMiB: 512,
minCapacity: 1,
maxCapacity: 5,
scaleCPUPercent: 80
*/
});
CDKがECRへのpushまでやってくれるのでcdk deploy
すれば動き始め、削除するときもStackを消せばよい。
$ cat Makefile
.PHONY: deploy destroy
deploy:
cd cdk && npm install && npm run build && npm run cdk -- deploy
destroy:
cd cdk && npm install && npm run cdk -- destroy