LoginSignup
0
0

More than 3 years have passed since last update.

AWS SAM CLIでデプロイしてみる

Last updated at Posted at 2021-01-30

前提

AWS CLIを入れておく
https://qiita.com/pino2/items/c0ede5c2b23f7f898a99

SAM CLIでHelloWorldアプリを作っておく

デプロイ実行

$sam deploy --guided

適当に答えていく。コンソールに表示される[]内がデフォルトだが、よしなに答える。

Stack Name:sam-app
AWS Region:ap-northeast-1
Confirm changes before deploy:Y
Allow SAM CLI IAM role creation:Y
HelloWorldFunction may not have authorization defined, Is this okay?:Y
Save arguments to configuration file:Y
SAM configuration file:samconfig.toml
SAM configuration environment:default

コンソールのOutputsのところにエンドポイントのURLが出力される。
〜/Prod/hello/
template.yamlのOutputsが出力される。
Outputsは他のCloudFormationスタックのインプットになったり、コンソールに出力されるもの。単体では設定に反映するわけではない。

上記回答からsamconfig.tomlが作られた。

samconfig.toml

version = 0.1
[default]
[default.deploy]
[default.deploy.parameters]
stack_name = "sam-app"
s3_bucket = "XXX"
s3_prefix = "sam-app"
region = "ap-northeast-1"
confirm_changeset = true
capabilities = "CAPABILITY_IAM"

次回からはguidedオプション無しでいける。

$sam deploy

API Gatewayのステージは、Stage, Prodができていた。どこで設定しているわけでもないが。
〜/Stage/hello/
のエンドポイントもできている。

ステージの概念はなんだろ。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0