Amplify Gen 2 ( Amplify ) でアプリを構築中に学んだことを残す。
RDS の Credentials の取得
- 原因
- Database の Credentials を動的に生成する場合、Secret Manager から取得して、Database URL を生成する必要がある。
- 対処
- ECS のタスク実行ロールで、自前で生成した SecretsManager を読み取る。 1
The maximum number of VPCs has been reached.
- 原因
- quota 2
- Google Cloud にもあると思うが、警告された記憶がない。
CloudFormationDeploymentError: The CloudFormation deployment has failed.
Resolution: Find more information in the CloudFormation AWS Console for this stack.
Cause: ❌ Deployment failed: Error: The stack named amplify-zzzzzzzzzzzzzzz-hoge464-branch-9999999999 failed creation, it may need to be manually deleted from the AWS console: ROLLBACK_COMPLETE: Resource handler returned message: "The maximum number of VPCs has been reached. (Service: Ec2, Status Code: 400, Request ID: 9e18c0c5-4744-46de-b19f-42eacc4d74f5)" (RequestToken: b6f61210-ecc2-54d7-fba1-1c23284f4608, HandlerErrorCode: GeneralServiceException), Embedded stack arn:aws:cloudformation:ap-northeast-1:000000000000:stack/amplify-zzzzzzzzzzzzzzz-hoge464-branch-9999999999-fugaCustomResourcesF3BA9C19-1UGIK5IOKLCC6/0f57f6d0-3e7a-11ef-bfcf-066d2b45ed53 was not successfully created: The following resource(s) failed to create: [fugaAmpxVPCC6A56BA2].
exec /usr/local/bin/docker-entrypoint.sh: exec format error
- 原因
- 対処
- CPU Architecture、OS を定義する。
const taskDefinition = new ecs.FargateTaskDefinition(
customResourceStack,
'FargateTaskDefinition',
{
memoryLimitMiB: 512,
cpu: 256,
runtimePlatform: {
cpuArchitecture: ecs.CpuArchitecture.X86_64, // add
operatingSystemFamily: ecs.OperatingSystemFamily.LINUX, // add
},
},
);
Conclusion
悩みが尽きることはない。