Open1
AWS CDK
CDK ローカル環境の構築
$ aws configure
AWS Access Key ID: ...
AWS Secret Access Key: ...
Default region name: ap-northeast-1
Default output format: json
Access key などは IAM のユーザーから取得または作成
$ aws sts get-caller-identity
{
"UserId": "",
"Account": "",
"Arn": "arn:aws:iam::xxxxxxxxx:user/foobar"
}
CDK project の作成
cdk init sample-app --language typescript
cdk synth
cdk bootstrap
cdk deploy
bootstrap の時に権限エラーになってしまう場合は
IAM -> ユーザー -> 許可 -> 許可を追加 -> AWSCloudFormationFullAccess を選択
サンプルコードの削除
[project]/lib/[project]-stack.ts
の中身をコメントアウトしてもう一度cdk deploy
VPC, EC2 インスタンスのセットアップ
これはほとんど手順通りにすればいい
RDS セットアップ
RDS のデプロイには少し時間かかるかも
ELB セットアップ ファイル分割
## クリーンアップ
Lambda
CDK watch
API Gateway
CfnOutput