hermannsw / aws-sam-practise

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

aws-sam-practise

AWS Serverless Application Model(SAM) を使用したサンプルコードです。

Files

  • src - Lambda functionで使用されるコード.
  • events - Invocation events that you can use to invoke the function.
  • tests - Unit tests for the application code.
  • template.yaml - A template that defines the application's AWS resources.
  • samconfig.toml - sam deploy 実行時に参照される設定ファイル.

Deploy

sam build
sam deploy --guided  # --guidedオプションを使用するのは初回のみ.

Use the SAM CLI to build and test locally

aws-sam-practise$ sam build --use-container
aws-sam-practise$ sam local start-api
aws-sam-practise$ curl http://localhost:3000/

Run functions locally and invoke them with the sam local invoke command.

aws-sam-practise$ sam local invoke HelloWorldFunction --event events/event.json

Fetch, tail, and filter Lambda function logs

aws-sam-practise$ sam logs -n DefaultFunction --stack-name aws-sam-practise --tail

Unit tests

aws-sam-practise$ python -m pytest tests/ -v

Cleanup

aws cloudformation delete-stack --stack-name aws-sam-practise

Memo

DynamoDBのテーブル内容を失わずに可能な変更

  • BillingModeの変更
  • GSIの追加, 変更

Resources

See the AWS SAM developer guide for an introduction to SAM specification, the SAM CLI, and serverless application concepts.

Next, you can use AWS Serverless Application Repository to deploy ready to use Apps that go beyond hello world samples and learn how authors developed their applications: AWS Serverless Application Repository main page

About


Languages

Language:Python 99.0%Language:Dockerfile 1.0%