Skip to content

gekal-study-aws/cdk-multi-region-resources

Repository files navigation

Multi Region Resources

プロジェクト作成

# npm install -g aws-cdk
npm install -g typescript
cdk init app --language typescript

CDK情報

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

環境作成

$ cdk list
PrimaryRegionStack
SecondRegionStack
PrimaryRegionRouteStack
SecondRegionRouteStack

環境作成

CDK環境初期化

ACCOUNT_ID=$(aws sts get-caller-identity --query 'Account' --output text)
AWS_PRIMARY_REGION=ap-northeast-1
AWS_SECONDARY_REGION=ap-northeast-3

cdk bootstrap aws://$ACCOUNT_ID/$AWS_PRIMARY_REGION
cdk bootstrap aws://$ACCOUNT_ID/$AWS_SECONDARY_REGION
cdk deploy "*" --tags tester=gekal

アーキテクチャー

環境クリア

$ cdk destroy "*"
Are you sure you want to delete: SecondRegionRouteStack, PrimaryRegionRouteStack, SecondRegionStack, PrimaryRegionStack (y/n)? y
SecondRegionRouteStack: destroying...

 ✅  SecondRegionRouteStack: destroyed
PrimaryRegionRouteStack: destroying...

 ✅  PrimaryRegionRouteStack: destroyed
SecondRegionStack: destroying...

 ✅  SecondRegionStack: destroyed
PrimaryRegionStack: destroying...

 ✅  PrimaryRegionStack: destroyed

ヘルプコマンド

  • 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

参照

  1. Using CDK to perform continuous deployments in multi-region Kubernetes environments
  2. interface StackProps

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published