{"id":19208627,"url":"https://github.com/heiwa4126/sam-hello-goodbye","last_synced_at":"2026-05-19T02:04:27.106Z","repository":{"id":41259475,"uuid":"397794148","full_name":"heiwa4126/sam-hello-goodbye","owner":"heiwa4126","description":"1個のAWS Lambdaで複数のAPIを受けるAWS SAMのサンプル","archived":false,"fork":false,"pushed_at":"2022-07-01T07:47:01.000Z","size":39,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-05T10:03:59.364Z","etag":null,"topics":["aws-lambda","aws-sam","example","python"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/heiwa4126.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-08-19T02:38:25.000Z","updated_at":"2022-07-01T07:47:32.000Z","dependencies_parsed_at":"2022-09-02T22:31:46.936Z","dependency_job_id":null,"html_url":"https://github.com/heiwa4126/sam-hello-goodbye","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/heiwa4126/sam-hello-goodbye","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heiwa4126%2Fsam-hello-goodbye","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heiwa4126%2Fsam-hello-goodbye/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heiwa4126%2Fsam-hello-goodbye/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heiwa4126%2Fsam-hello-goodbye/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/heiwa4126","download_url":"https://codeload.github.com/heiwa4126/sam-hello-goodbye/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heiwa4126%2Fsam-hello-goodbye/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264804108,"owners_count":23666515,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws-lambda","aws-sam","example","python"],"created_at":"2024-11-09T13:27:13.173Z","updated_at":"2026-05-19T02:04:27.068Z","avatar_url":"https://github.com/heiwa4126.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sam-hello-goodbye\n\n1個のAWS Lambdaで複数のAWS API Gatewayを受けるサンプル([aws_lambda_powertools.event\\_handler](https://awslabs.github.io/aws-lambda-powertools-python/latest/core/event_handler/api_gateway/#api-gateway-rest-api)使用)。\n他AWS API Gatewayでのバリデーションのサンプルにもなっている。\n\n\n# インストール\n\nSAMなのでいつもどおりに\n```sh\nsam build\nsam deploy --guided   # 2回め以降は --guided ぬきで\n```\n\n\n## ローカルのテスト\n\nこのプロジェクトはデプロイしないでも\n```sh\nsam build\nsam local start-api\n# tmuxだったら画面分割して\n./local_test.sh\n```\nで十分。\n\n\n## デプロイした場合のテスト\n\n```bash\n./make_env.sh \u0026\u0026 . ./tmp/env.sh\n```\nで環境変数をセットしたら\n\n```bash\n./remote_test.sh\n```\n\nバリデータのテストは\n```bash\n./validator_test.sh\n```\n\n\n# OpenAPIのエクスポート\n\nデプロイ後\n\n```bash\n./make_env.sh\n./export_as_openapi.sh\n```\n\nで tmpの下に `oas3.json` と `oas3.yaml`(yqコマンドがあれば)ができます。\n\n\n# メモ\n\n## コンソールからAWS API Gatewayでバリデータなどをいじった後\n\n再デプロイしないと反映されない。exportしても変化がない。\n\n以下手順を参照:\n[REST API をステージに再デプロイする](https://docs.aws.amazon.com/ja_jp/apigateway/latest/developerguide/how-to-deploy-api-with-console.html#apigateway-how-to-redeploy-api-console)\n\nCLIもあると思うが調べてない。あとstackのドリフトは再デプロイしても検出できない。\n\nほか一覧: [再デプロイが必要な REST API の更新 - Amazon API Gateway](https://docs.aws.amazon.com/ja_jp/apigateway/latest/developerguide/updating-api.html)\n## validation\n\nvalidationのクエリのほうがうまく動かない。bodyのほうはちゃんとmodelのバリデーションが動く。\n\n[API Gateway 拡張機能 - AWS Serverless Application Model](https://docs.aws.amazon.com/ja_jp/serverless-application-model/latest/developerguide/sam-specification-api-gateway-extensions.html)で\nx-amazon-apigateway-request-validatorをサポートしてないと書いてあるので間違ってない。\n\n全部OpenAPIで書けばできると思うが、[Event: の Api](https://docs.aws.amazon.com/ja_jp/serverless-application-model/latest/developerguide/sam-property-function-api.html)は便利すぎる。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheiwa4126%2Fsam-hello-goodbye","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fheiwa4126%2Fsam-hello-goodbye","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheiwa4126%2Fsam-hello-goodbye/lists"}