DynamoDB アプリケーション用の AWS SAM テンプレート - AWS Lambda

DynamoDB アプリケーション用の AWS SAM テンプレート

を使用してこのアプリケーションをビルドすることができます。。AWS SAMAWS SAM テンプレートの詳細については、AWS SAM 開発者ガイドの「AWS Serverless Application Model テンプレートの基礎」を参照してください。

チュートリアルアプリケーションのサンプル AWS SAM テンプレートを以下に示します。下のテキストを .yaml ファイルにコピーし、以前作成した ZIP パッケージの隣に保存します。Handler および Runtime パラメータ値は、前のセクションで関数を作成したときのものと一致する必要があります。

例 template.yaml
AWSTemplateFormatVersion: '2010-09-09' Transform: AWS::Serverless-2016-10-31 Resources: ProcessDynamoDBStream: Type: AWS::Serverless::Function Properties: Handler: handler Runtime: runtime Policies: AWSLambdaDynamoDBExecutionRole Events: Stream: Type: DynamoDB Properties: Stream: !GetAtt DynamoDBTable.StreamArn BatchSize: 100 StartingPosition: TRIM_HORIZON DynamoDBTable: Type: AWS::DynamoDB::Table Properties: AttributeDefinitions: - AttributeName: id AttributeType: S KeySchema: - AttributeName: id KeyType: HASH ProvisionedThroughput: ReadCapacityUnits: 5 WriteCapacityUnits: 5 StreamSpecification: StreamViewType: NEW_IMAGE

パッケージおよびデプロイコマンドを使用してサーバーレスアプリケーションをパッケージングしてデプロイする方法については、AWS Serverless Application Model 開発者ガイドの「サーバーレスアプリケーションのデプロイ」を参照してください。