サーバレス Lambdaアプリ構築
Macへのインストール必要
composer
AWS SAM CLI
リポジトリ
デプロイ時のハマりどころ
バケットがすでに存在すると言われる
code: linux
php-example-laravel-public-bucket already exists
→ templates.yml の BucketName を一意のバケット名(存在しないやつ)に書き換える
LambdaのARNに対する権限がないと言われる
code: linux
Resource handler returned message:"User: arn:aws:iam::656277950560:user/developer_201213 is not
authorized to perform:lambda:GetLayerVersion on
resource: arn:aws:lambda:us-east-1:209497400698:layer:php-74-fpm:12
because no resource-based policyallows the lambda:GetLayerVersion
action (Service: Lambda, Status
Code: 403, Request ID: a46e9e1f-b4f8-4502-a7e1-7b2ad61a508b)"
(RequestToken: f2ce804b-f5ab-672d-65b5-abab80ec0971,HandlerErrorCode: AccessDenied)
デプロイ予定のリージョンとlambda ARNのリージョンが異なっていると権限がない模様
→指定のリージョンにあったARNを選択し、templates.ymlのLayers を書き換える(筆者の場合は ap-northeast-1を選択 )