Slide 24
Slide 24 text
AWS TECH TALK NIGHT #4 - アーキテクチャ道場 & ライブコーディング
© 2022, Amazon Web Services, Inc. or its affiliates.
Assets でアプリケーションをデプロイ
Amazon S3 - aws_s3_deployment モジュール
new BucketDeployment(this, 'WebAppDeploy', {
destinationBucket: s3Bucket!,
distribution: cloudFrontWebDistribution, // invalidation
sources: [
// Deploy a React frontend app
Source.asset('webapp/dashboard/build'),
],
});
TypeScript
• ローカル zip ファイル
• ローカルディレクトリ
• テキスト / JSON データ (デプロイ時に挿⼊可能)
AWS Lambda - aws_lambda モジュール
new NodejsFunction(this, 'Handler', {
entry: 'lambda/metrics-handler.ts',
handler: 'get',
});
TypeScript
• ローカルのソースコードをバンドル
• aws_lambda_nodejs モジュールの場合は
esbuild で TypeScript をトランスパイル&バンドル
Amazon ECS - aws_ecs モジュール const taskDefinition = new FargateTaskDefinition(this, 'Def', {
cpu: 256,
memoryLimitMiB: 512,
});
taskDefinition.addContainer('Recorder', {
image: ContainerImage.fromAsset('container/recorder'),
});
TypeScript
• ローカルの Dockerfile から
コンテナイメージを作成し
Amazon ECR リポジトリに push してデプロイ
Amazon ECR