Upgrade to Pro — share decks privately, control downloads, hide ads and more …

はてなブログ タグとCDK / The epic of AWS CDK and Hatena Blog Tag

aereal
July 18, 2019

はてなブログ タグとCDK / The epic of AWS CDK and Hatena Blog Tag

@ AWS Cloud Development Kit -CDK- Meetup

aereal

July 18, 2019
Tweet

More Decks by aereal

Other Decks in Programming

Transcript

  1. CFnを使う? • 紋切り型のコードが多い • e.g. Security Group • クロススタック参照を使う際に変更順序に気を遣う •

    適⽤しようとして初めて「こっちを先に更新してね」 と⾔われる • 差分チェックが……
  2. self-contained vs layered • ECS (コンテナ実⾏環境) はアプリケーション観点では ⾊々なコンポーネントを隠してくれている • ⼀⽅、構成管理の観点ではECSを通してコンポーネント間

    の繋がりを意識しなくてはならない • ALB, VPC, Security Group, etc. • そこに明確に引ける線はない =
 構成管理とデプロイのツールを分けないほうが得策
  3. まとめ • はてなブログ タグの構成管理はすべてCDKで⾏っています • ECSサービス・クラスタ、RDS、StepFunctions, Lambda, etc. • いわゆるインフラだけではなく


    アプリケーションのデプロイもCDKで • いろいろデフォルトのプロジェクト構成から
 変えていることもあるので質問お待ちしております
  4. • AWS Construct library • “This library includes constructs that

    represent all the resources available on AWS. For example, the s3.Bucket class represents an Amazon S3 bucket, and the dynamodb.Table class represents an Amazon DynamoDB table.” • CFnのresourceに相当する • Constructs • “Constructs are the basic building blocks of AWS CDK apps. A construct represents a "cloud component" and encapsulates everything AWS CloudFormation needs to create the component.” • 1つ以上のCFn resourceをカプセル化したもの • より⾼⽔準なインターフェース・機能
  5. 秩序⽴ったlayeringとその恩恵 • 関⼼の分離 • 普段はconstructsを触って背後のコンポーネントを隠蔽 • いざという時はAWS constructsに降りるとCFnの知識がそのまま活 かせる •

    layerの性質に応じた効率化 • 例: AWS constructsはリソース定義からコード⽣成している • もしconstructsと別れていなければどこから⼈間が⼿を⼊れていい か判断しづらい
  6. CDKへの期待 • Higher-order construct • constructsの変更はmutationを伴いpureではない • あるconstructを加⼯するリーズナブルなソリューション がほしい •

    近いものだとAspectsがあるが、スコープを限定したい • https://docs.aws.amazon.com/ja_jp/cdk/latest/guide/ aspects.html