LoginSignup
4
0

More than 1 year has passed since last update.

AWS CDK設定

Posted at

はじめに

内容はこちらのページを参考にしたもの Getting started with the AWS CDK

ステップ

1. aws cdkのインストール (※Supportされているnodeのバージョンがあるので注意)

今回はその中の v16.3.0を使用:

node -v
v16.3.0

インストール

npm install -g aws-cdk

バージョンチェック (インストール時によって異なる)

cdk --version
1.128.0 (build 1d3883a)

2. aws cliの設定 (すでにしてあればスキップ)

aws cliのインストールはこちら: AWS CLI バージョン 2 のインストール、更新、アンインストール

profileを分けて管理する場合は --profile <任意のプロファイル名>を指定. ACCESS_KEYとACCESS_SECRETが聞かれるので入力

aws configure

3. CDK Bootstrap

  1. Account IDの取得

    aws sts get-caller-identity
    {
        "UserId": "xxxxxxxxxx",
        "Account": "xxxxxx",
        "Arn": "arn:aws:iam::xxxxxx:user/naka"
    }
    
  2. Regionの取得

    aws configure get region
    ap-northeast-1
    
  3. Bootstrap

    cdk bootstrap aws://ACCOUNT-NUMBER/REGION
    

    結果:

    cdk bootstrap aws://ACCOUNT-NUMBER/ap-northeast-1 --profile naka-personal
     ⏳  Bootstrapping environment aws://ACCOUNT-NUMBER/ap-northeast-1...
     CDKToolkit: creating CloudFormation changeset...
      ✅  Environment aws://ACCOUNT-NUMBER/ap-northeast-1 bootstrapped.
    

    コンソールから確認: S3 BucketとS3 Bucket Policyが作成された

    スクリーンショット 2021-10-20 9.19.34.png

これで設定完了で、 cdk deploy というコマンドで、Deployできるようになった!

参考

4
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
4
0