VSCodeプラグインのインストール
すでにローカルPCに任意のフォルダを作成して、CloudFormation.yamlテンプレートを作成して、VSCodeを開いている状態。
初期設定
デフォルトのままだとCloudFormation独自関数を認識できないので、その対応する。
start + tabをクリックする。
CloudFormationテンプレートのフォーマットが完成!
resourcesの下でec2と打ってみる。記述したいフォーマットを選択してEnter。
Base64がエラーと認識されてしまう(下に波線が表示)ので、VSCode設定ファイルを修正する。
Ctrl+Shift+Pをクリックする。
VSCodeを選択、settings.jsonと記載して、Enter。
既存の設定の下に、以下の記述をコピペする。
上書き保存する。Ctrl+Sをクリックする。
{ "yaml.schemas": { "https://d33vqc0rt9ld30.cloudfront.net/latest/gzip/CloudFormationResourceSpecification.json": [ "*.cf.yaml", "*.cf.yml", "cfn/*.yaml", "cfn/*.yml", "cloudformation/*.yaml", "cloudformation/*.yml" ] }, "yaml.customTags": [ "!And sequence", "!Equals sequence", "!If sequence", "!Not sequence", "!Or sequence", "!Base64", "!Cidr sequence", "!FindInMap sequence", "!GetAtt", "!GetAZs", "!ImportValue", "!Join sequence", "!Select sequence", "!Split sequence", "!Sub", "!Ref" ] }
Base64がエラーと認識されていない(下に波線が表示されていない)ことを確認する。
resourcesの下でvpcと打ってみる。記述したいフォーマットを選択してEnter。
作成が完了したら、CloudFormationにアップロードする。