0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

10日目:AWS無料枠使い倒し「CloudFormationでインフラをコード化」

0
Last updated at Posted at 2025-12-09

CloudFormationでインフラをコード化する方法

予定コスト: $0.00(テンプレ作成)


✅ この記事でやること

テンプレ作成→デプロイ→ChangeSetの考え方まで。


✅ 前提(準備)

CLI権限、スタック名の命名ルール。


テンプレート作成

最小VPCテンプレを作成。(yml)

cat > vpc.yaml <<'YAML'
AWSTemplateFormatVersion: '2010-09-09'
Description: Minimal VPC
Resources:
  VPC:
    Type: AWS::EC2::VPC
    Properties:
      CidrBlock: 10.1.0.0/16
YAML

デプロイ

スタックをデプロイ。

aws cloudformation deploy --template-file vpc.yaml --stack-name demo-vpc

ChangeSet例(差分確認)

変更適用前に差分を確認する運用。

aws cloudformation create-change-set --stack-name demo-vpc --template-body file://vpc.yaml --change-set-name demo-vpc-cs
aws cloudformation describe-change-set --stack-name demo-vpc --change-set-name demo-vpc-cs --output table

💡 豆知識 (Tips)

  • Outputs/Exportsで別スタックへ値を渡す設計
  • パラメータ化で再利用性を高める

⚠️ 落とし穴

  • 手作業変更のドリフト(IaCに取り込めない)
  • Delete時に残るリソース(手動作成の付随資産)

🧾 今日のコスト

$0.00(テンプレ作成のみ)


✅ まとめ

  • 本日のゴールを確認
  • 無料枠を意識して運用
  • 次回に繋がるポイントを整理

✅ 次回予告(11日目)

「RDS無料枠でデータベースを構築」

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?