LoginSignup
0
0

More than 3 years have passed since last update.

スタックの有無で待つ状態を切り替える

Last updated at Posted at 2020-07-28

スタックの有無で wait するコマンドを切り替える。

#!/bin/bash
set -eu

STACK_NAME="foobar"
IS_UPDATE=0

set +e
aws cloudformation describe-stacks --stack-name ${STACK_NAME}  > /dev/null 2>&1
if [ $? -eq 0 ]; then
  IS_UPDATE=1
fi
set -e

aws cloudformation deploy --stack-name ${STACK_NAME} --template-file /path/to/template.yml                                                                                                                                                                          

if [ $IS_UPDATE -eq 1 ]; then
  aws cloudformation wait stack-update-complete --stack-name ${STACK_NAME}
else
  aws cloudformation wait stack-create-complete --stack-name ${STACK_NAME}
fi

echo waited

参考

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