Amazon ECS による Web アプリの設定2023年11月19日 | |
はじめにAamazon ECS/AWS Fargate で Web アプリを設定することを考える。ここでは Streamlit を利用した Web アプリを想定。ECR にコンテナイメージを用意しているものとする。 構成コンテナアプリを Fargate で公開する。接続には CloudFront を介する。Fargate と CloudFront のあいだにロードバランサー (ALB) を挟む。 ロードバランサーの設定EC2
エンドポイントの作成VPC
以下も同様に作成。
ECS の設定クラスター
タスク定義
クラスター
うまくいかない場合[クラスター]-[サービス]-[デプロイ] にタスクを起動しようとした形跡があるはずなので、それを確認する。 ※タスクを起動しなおす場合は、CloudFormation にサービスのスタックが残るようなので、名前を変えるか、スタックを削除する。 エラーResourceInitializationError: unable to pull secrets or registry auth: execution resource retrieval failed: unable to retrieve ecr registry auth: service call has been retried 3 time(s): RequestError: send request failed caused by: Post "https://api.ecr.ap-northeast-1.amazonaws.com/": dial tcp 3.112.65.177:443: i/o timeout. Please check your task network configuration. エンドポイント (ecr.api) を設定していないために起こるらしい。 ResourceInitializationError: unable to pull secrets or registry auth: execution resource retrieval failed: unable to retrieve ecr registry auth: service call has been retried 5 time(s): RequestError: send request failed caused by: Post "https://api.ecr.ap-northeast-1.amazonaws.com/": dial tcp: lookup api.ecr.ap-northeast-1.amazonaws.com on 10.108.48.2:53: no such host. Please check your task network configuration. タスクとエンドポイントのサブネットが一致していないために起こるらしい。 CannotPullContainerError: pull image manifest has been retried 5 time(s): failed to resolve ref 292072304900.dkr.ecr.ap-northeast-1.amazonaws.com/codebuild-docker-test2:latest: failed to do request: Head "https://292072304900.dkr.ecr.ap-northeast-1.amazonaws.com/v2/codebuild-docker-test2/manifests/latest": dial tcp 52.196.216.64:443: i/o timeout これもエンドポイント (ecr.dkr) を設定していないために起こるらしい。
CannotPullContainerError: containerd: pull command failed: panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x40 pc=0x1369f41] goroutine 1 [running]: main.(*puller).pullWithClient(0xc000573bc0, {0x18dc8a0, 0xc0005c0cc0}, {0x18d6988, 0xc0003d0000}, 0xc00038ac30, {0x18d6938, 0xc000419840}) /root/go/src/github.com/aws/two/puller/pull.go:198 +0x501 main.(*puller).Pull(0xc000573bc0, {0x18dc8a0, 0xc000397d10}, 0xc00038ac30, {0x18d6938, 0xc000419840}) /root/go/src/github.com/aws/two/puller/pull.go:147 +0x2a7 main.(*puller).pullImage(0x18dc8a0?, {0x18dc8a0, 0xc000397d10}, 0xc00038ac30, {0x18d6938?, 0xc000419840?}) /root/go/src/github.com/aws/two/puller/pull.go:350 +0x47 main.main() /root/go/src/github.com/aws/two/puller/main.go:75 +0x587 : exit status 2
読み取り専用設定のせい? ResourceInitializationError: failed to validate logger args: : signal: killed CloudWatch Logs のエンドポイントが必要。 つながらなかったら、Reachability Analizer で調べる。 CloudFront の設定CloudFront
参考 | |
| PENGUINITIS | |