事前確認
CDKのバージョン比較確認
$ npx cdk doctor
ℹ️ CDK Version: 2.166.0 (build 7bb9203) ← 今のCDKバージョンが出てくる
<snip>
ℹ️ No CDK environment variables
****************************************************
*** Newer version of CDK is available [2.1029.2] *** ← 最新は 2.1029.2 だよ
*** Upgrade recommended (npm install -g aws-cdk) ***
****************************************************
↓ 今使っているバージョンに関連する“既知の注意点や将来の仕様変更”の告知
NOTICES
<snip>
事前の情報取得
※ メモ:実施環境は、Macです
※ メモ:alias date="date '+%Y/%m/%d %H:%M:%S'"
※ メモ:上記を読み込ませている環境なのもあり、/bin/date とややこしい指定をしてます
$ mkdir cdk-diff-logs
$ npx cdk synth > cdk-diff-logs/synth_$(/bin/date +%Y%m%d)_before
$ npx cdk diff > cdk-diff-logs/diff_$(/bin/date +%Y%m%d)_before
※ .gitignore
cdk-diff-logs/ ← 新規追加
切り戻し手順
$ npm install -D aws-cdk@2.166.0
$ npx cdk --version
$ npx cdk doctor
$ npx cdk synth > cdk-diff-logs/synth_$(/bin/date +%Y%m%d)_after
$ npx cdk diff > cdk-diff-logs/diff_$(/bin/date +%Y%m%d)_after
バージョンアップ作業
$ npm install -D aws-cdk@2.1029.2
$ npx cdk --version
$ npx cdk doctor
$ npx cdk synth > cdk-diff-logs/synth_$(/bin/date +%Y%m%d)_after
$ diff -u cdk-diff-logs/synth_$(/bin/date +%Y%m%d)_before cdk-diff-logs/synth_$(/bin/date +%Y%m%d)_after
$ npx cdk diff > cdk-diff-logs/diff_$(/bin/date +%Y%m%d)_after
$ diff -u cdk-diff-logs/diff_$(/bin/date +%Y%m%d)_before cdk-diff-logs/diff_$(/bin/date +%Y%m%d)_after
※ 今回は差分がなかったので、cdk deploy は実施してない