メインコンテンツまでスキップ

CDKプロジェクトの作成

注記

作成日:2022/05/04

プロジェクト用ディレクトリの作成

ターミナル
mkdir wordpress-cdk
cd wordpress-cdk

CDK Init

Type Scriptで進めます。

ターミナル
cdk init app --language typescript
# Welcome to your CDK TypeScript project

This is a blank project for CDK development with TypeScript.

The `cdk.json` file tells the CDK Toolkit how to execute your app.

## Useful commands

* `npm run build` compile typescript to js
* `npm run watch` watch for changes and compile
* `npm run test` perform the jest unit tests
* `cdk deploy` deploy this stack to your default AWS account/region
* `cdk diff` compare deployed stack with current state
* `cdk synth` emits the synthesized CloudFormation template

Executing npm install...
npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated [email protected]: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added
✅ All done!

以下のファイルが作成されます

ターミナル
tree ./ -I node_modules
./
├── bin
│ └── wordpress-cdk.ts
├── cdk.json
├── jest.config.js
├── lib
│ └── wordpress-cdk-stack.ts
├── package.json
├── package-lock.json
├── README.md
├── test
│ └── wordpress-cdk.test.ts
└── tsconfig.json

3 directories, 9 files

CDK Bootstrap

AWSリージョンごとにBootstrapスタックが必要ですので作成します。
(1アカウント、1リージョンあたり1回実行)

ターミナル
cdk bootstrap