C3L: Web Container
This is a basic CDK construct for running a stateless, load-balanced, auto-scaled, TLS-secured http container on Fargate in a precreated VPC.
Please refer to general C3L documentation here.
Install this package:
npm i @c3l/web-container
The following shows a sample usage, using @c3l/three-tier-vpc as underlying network:
import cdk = require('@aws-cdk/cdk');
import { ThreeTierVpc } from '@c3l/three-tier-vpc';
import { WebContainer } from '../lib/web-container';
export class TestStack extends cdk.Stack {
constructor(scope: cdk.App, id: string, props?: cdk.StackProps) {
super(scope, id, props);
const network = new ThreeTierVpc(this, 'ContainerNetwork',{})
new WebContainer(this, 'WebContainer', {
network: network.vpc,
image: 'crccheck/hello-world',
domain: 'container.hello-world.sh',
zone: 'Z2S9HZFROM1LZW',
zoneName: 'hello-world.sh',
port: 8000,
environment: {
'SOME_CONFIG_VALUE': 'none'
}
})
}
}