参考ページ
チュートリアル: Hello World アプリケーションのデプロイ
次の環境で確認しました。
$ python --version
Python 3.9.7
$ sam --version
SAM CLI, version 1.31.0
プログラムの作成
sam init --name sample-sam-app --runtime python3.9 --dependency-manager pip -
-app-template hello-world
ビルド
cd sample-sam-app
sam build
デプロイ
sam deploy --stack-name sample-sam-app \
--region ap-northeast-1 \
--guided
次のようなメッセージが出てきます。
Value https://123456o4of.execute-api.ap-northeast-1.amazonaws.com/Prod/hello/
テスト
$ curl https://123456o4of.execute-api.ap-northeast-1.amazonaws.com/Prod/hello/
{"message": "hello world"}
http https://123456o4of.execute-api.ap-northeast-1.amazonaws.com/Prod/hello/
API Gateway が出来ていることを確認する方法
aws apigateway get-rest-apis | grep \"name\"