Save 37% off PRO during our Black Friday Sale! »

AWS CDKについて / about AWS CDK

5e1d0f7877241ad4447c6611d9a51fd7?s=47 cohalz
January 25, 2019

AWS CDKについて / about AWS CDK

YAPC::Tokyo 2019 前夜祭 LTソン

5e1d0f7877241ad4447c6611d9a51fd7?s=128

cohalz

January 25, 2019
Tweet

Transcript

  1. AWS CDKʹ͍ͭͯ YAPC::Tokyo 2019 લ໷ࡇ LTιϯ id:cohalz

  2. ࣗݾ঺հ • id:cohalz / @cohalz • גࣜձࣾ͸ͯͳ SRE(ژ౎) • Perlະܦݧ

  3. AWS CDKฉ͍ͨ͜ͱ͋Δਓ

  4. AWS CDK࢖ͬͯΔਓ

  5. AWS CDKͱ͸ • https://awslabs.github.io/aws-cdk/ • AWSެࣜͷϑϨʔϜϫʔΫ • TypeScriptͰCloudFormationϦιʔεΛॻ͍ͯσϓϩΠ • ։ൃऀϓϨϏϡʔ

    ͷஈ֊
  6. Ϟνϕʔγϣϯ • ڊେͳYAMLಡΈॻ͖͍ͨ͠Ͱ͔͢ʁ • CFnͰෳࡶͳ෼ذͯ͠ͳ͍Ͱ͔͢ʁ

  7. TypeScript • ܕʹΑΔิ׬ • ߴ౓ͳϩδοΫͷ࣮ݱ • ϥΠϒϥϦͷ૊Έ߹Θͤ

  8. ར఺ͦΕ͚ͩʁ

  9. CDK Construct Library • ҰൠతͳύλʔϯΛϥΠϒϥϦͱͯ͠ఏڙ • ར༻ऀͷهड़ྔΛେ෯ʹ࡟ݮ • ެࣜϥΠϒϥϦͷଞʹࣗ࡞΋౰વՄೳ

  10. ࣮ࡍͷίʔυ const vpc = new ec2.VpcNetwork(this, 'MyVpc', { maxAZs: 2

    }); const cluster = new ecs.Cluster(this, 'Cluster', { vpc }); const fargateService = new ecs.LoadBalancedFargateService(this, "FargateService", { cluster, image: ecs.ContainerImage.fromDockerHub("amazon/amazon-ecs-sample"), });
  11. σϓϩΠπʔϧ • cdk deploy • TypeScriptΛॻ͍ͯͦͷ··σϓϩΠͰ͖Δ • cdk diff •

    ਓ͕ؒಡΊΔมߋ఺Λग़͢
  12. ηΩϡϦςΟ • IAMͱSecurity GroupͷมߋΛܯࠂ

  13. CDKͷϝϦοτ • SRE͔Β • ϦιʔεΛςϯϓϨʔτͱͯ͠ఏڙ͠΍͍͢ • ΞϓϦέʔγϣϯΤϯδχΞ͔Β • TypeScriptͩͱ৮Γ΍͍͢ •

    ηΩϡϦςΟͷܯࠂ΋خ͍͠
  14. େมͳ͜ͱ΋͋Δ • Construct Libraryͱ΍͍ͬͯ͘ • தͰԿΛ΍ͬͯΔͷ͔֬ೝ͢Δͷ͸೉͍͠ • ར༻ऀগͳ͍ͷͰ৘ใ͕ͳ͍ • ؾ͕͍ͭͨΒ೔ຊਓτοϓͷίϯτϦϏϡʔλʹͳͬͯͨ

  15. ·ͱΊ • YAMLͰ͸ͳ͘TypeScriptͷ࣌୅ • CDKͷπʔϧ܈͸ຊ౰ʹศར • ։ൃऀϓϨϏϡʔதͳͷͰར༻͸஫ҙ