$30 off During Our Annual Pro Sale. View Details »

AWSCDKを通してAWSを学ぶ/learn AWS through AWS CDK

tomoki10
September 08, 2022

AWSCDKを通してAWSを学ぶ/learn AWS through AWS CDK

JAWS-UG CDK支部 LT会3回目の発表で使用したスライドです。

tomoki10

September 08, 2022
Tweet

More Decks by tomoki10

Other Decks in Technology

Transcript

  1. JAWS-UG CDKࢧ෦ ୈ3ճ໨ AWS CDKΛ௨ͯ͠AWSΛֶͿ CXࣄۀຊ෦ Delivery෦ 2022/09/07 ࠤ౻ஐथ 1

  2. ࣗݾ঺հ @tmk2154 @tomoki10 • ࠤ౻ஐथ • Ϋϥεϝιουגࣜձࣾ • CXࣄۀຊ෦ Delivery෦

    • ݱࡏɿαʔόʔαΠυ݉ΠϯϑϥΤϯδχΞ ݉QAͱ͔AWSΞΧ΢ϯτͷηΩϡϦςΟ౳ • झຯɿVALORANTɺࢄา • ޷͖ͳAWSαʔϏεɿLambdaɺCDK
  3. ҎԼͷΑ͏ͳ೰ΈΛ΋ͬͨํΛର৅ʹൃද͠·͢ • AWS CDK࢝ΊΑ͏͔೰ΜͰΔ • AWS CDKͰ͖Δ·ͰͬͯͲΜͳײͩͬͨ͡ͷʁ • AWSͷྺ࢙΍ֶͼํΛ஌Γ͍ͨ ҎԼͷํ͸ର৅֎

    • AWS CLI/SDK/CloudFormation/CDK ͷࢥ૝ͱྺ࢙ͷ׬શཧղऀ
 ʢٯʹڭ͑ͯཉ͍͠ʣ 3 ର৅ͱ͢Δࢹௌऀ
  4. 2ͭͷଆ໘ͰCDKΛܦ༝ͯ͠AWSΛֶͿ • AWSࣗମͷྺ࢙ΛֶͿ • AWS͸ͲΜͳ఩ֶͰαʔϏεΛ࡞͖ͬͯͨͷ͔ • ͍͔ʹͯ͠AWS CDKʹͨͲΓண͍ͨͷ͔஌Δ • AWS

    CDKΛ௨ͯ͠AWSαʔϏεࣗମΛֶͿ • AWS CDKΛ࢖͍ͲͷΑ͏ʹͯ͠AWSαʔϏεΛߏங͍ͯ͠Δ͔ • AWS CDKͷίʔυ͔Βٯࢉͯ͠αʔϏεΛֶͿज़ 4 ൃදͷ಺༰ͱ໨త
  5. 5 ஫ҙ఺ ※ྺ࢙తܦҢʹ͍ͭͯ͸ ؒҧ͍ΛؚΉՄೳੑ͕͋Γ·͢ ΋ؒ͠ҧ͍͋Ε͹मਖ਼͢ΔͷͰ͝࿈བྷ͍ͩ͘͞

  6. ·ͣ͸AWS͕ͲͷΑ͏ͳࢥ૝Ͱ࡞ΒΕ͍ͯΔͷ͔͔ΒৼΓฦΔ
 
 AWSͰ͸ҎԼͷ2ͭͷࢥ૝Λ΋ͬͯ։ൃ͕ਐΊΒΕ͍ͯΔ※1 • API First ͷઃܭΞϓϩʔν
 શͯͷνʔϜ͸αʔϏεΠϯλϑΣʔεΛ௨ͯ͠σʔλΛެ։͢Δ • Two-Pizza

    Teams
 ίϥϘϨʔγϣϯ޲্ͷͨΊ2ͭͷϐβΛ෼͚߹͑Δఔ౓ͷਓ਺Ͱ
 νʔϜΛߏ੒͢Δ※2 6 AWSͷࢥ૝ ※1ࢀߟʮAWS ͸ MACH ΞϥΠΞϯεʹࢀՃ͠·ͨ͠ʯhttps://aws.amazon.com/jp/blogs/news/aws-joins-mach-alliance/ ※2ʮIntroduction to DevOps on AWS - Two-Pizza Teamsʯhttps://docs.aws.amazon.com/whitepapers/latest/introduction-devops-aws/two-pizza-teams.html
  7. ͋Δ೔ͷJeff Bezos͞ΜͷࢦࣔͷҾ༻※͕Α͘આ໌ʹ࢖ΘΕΔ 7 API First ͷઃܭΞϓϩʔν ※ʮStevey's Google Platforms Rantʯhttps://gist.github.com/chitchcock/1281611

    1.All teams will henceforth expose their data and functionality through service interfaces. 2.Teams must communicate with each other through these interfaces. 3.There will be no other form of interprocess communication allowed: 
 no direct linking, no direct reads of another team's data store, no shared-memory model,
 no back-doors whatsoever. The only communication allowed is via
 service interface calls over the network. 4.It doesn't matter what technology they use. 
 HTTP, Corba, Pubsub, custom protocols -- doesn't matter. Bezos doesn't care. 5.All service interfaces, without exception, must be designed from the ground up to be externalizable.
 That is to say, the team must plan and design to be able to expose the interface to
 developers in the outside world. No exceptions. 6.Anyone who doesn't do this will be fired. 7.Thank you; have a nice day!
  8. งғؾ೔ຊޠ༁ 8 API First ͷઃܭΞϓϩʔν 1. શͯͷνʔϜ͸͜Ε͔ΒαʔϏεΠϯλϑΣʔεΛ௨ͯ͠σʔλΛެ։͢Δ 2. νʔϜ͸ඞͣ͜ΕΒͷΠϯλϑΣʔεΛհͯ͠ίϛϡχέʔγϣϯ͢Δ 3.

    ଞͷܗࣜʹΑΔΞΫηε͸ڐՄ͞Εͳ͍:
 ௚઀઀ଓ΋ෆՄɺผνʔϜͷσʔλετΞʹΞΫηε΋ෆՄɺϝϞϦڞ༗΋ෆՄɺόοΫυΞ͸ԿͰ΋ෆՄɻ
 αʔϏεΠϯλʔϑΣʔεΛ௨ͨ͠NWܦ༝ͰͷίϛϡχέʔγϣϯͷΈڐՄ͞ΕΔ 4. ͲͷςΫϊϩδʔΛ࢖͏͔͸໰͍·ͤΜɻ
 HTTPͰ΋CorbaͰ΋PubSubϞσϧͰ΋ɺΧελϜϓϩτίϧͰ΋໰୊ͳ͍ɻؾʹ͠·ͤΜɻ 5. શͯͷαʔϏεΠϯλϑΣʔε͸ྫ֎ͳ͘ɺجૅ͔Β֦ுՄೳͳΑ͏ʹઃܭ͠ͳ͚Ε͹ͳΒͳ͍
 ͭ·ΓɺνʔϜ͸։ൃνʔϜ֎Ͱ΋։ൃऀ͕ΠϯλʔϑΣʔεΛ֦ுՄೳͳΑ͏ܭըͱઃܭ͠ͳ͚Ε͹ͳΒͳ͍ 6. ͜ΕΛͰ͖ͳ͍΋ͷ͸ղޏ͠·͢ 7. ྑ͍1೔Λʂ
  9. 2004೥͙Β͍ͷهࣄ※Ͱ͸طʹݴ͍ͬͯͨɻ࣌ؒͷ౎߹ͰׂѪ 9 Two-Pizza Teams ※ʮIntroduction to DevOps on AWS -

    Two-Pizza Teamsʯhttps://docs.aws.amazon.com/ja_jp/whitepapers/latest/introduction-devops-aws/two-pizza-teams.html ެࣜࢿྉΑΓҾ༻ɿ ʮIntroduction to DevOps on AWS - Two-Pizza Teamsʯ※ The smaller the team the better the collaboration. Collaboration is also very important as the software releases are moving faster than ever. And a team’s ability to deliver the software can be a differentiating factor for your organization against your competition. Imagine a situation in which a new product feature needs to be released or a bug needs to be fixed you want this to happen as quickly as possible so you ca have a smaller go-to-market timed. This is also important as you don’t want the transformation to be a slow-moving process rather than an agile approach where waves of changes start to make an impact.
  10. AWS APIΛ௚઀ૢ࡞͢ΔͷͰ͸ͳ͘IFͱͯ͠CLI/SDK͕ఏڙʢ2006೥※ʣ
 ͜ΕΒΛ׆༻͢Δ͜ͱͰαʔϏεΛޮ཰తʹߏங͕Ͱ͖Δ 10 AWS APIͷ׆༻ AWS API AWS CLI

    AWS SDK ϓϩάϥϜ खॱॻ+γΣϧ AWS ϦιʔεʢEC2ɺVPCͳͲʣ ※Googleͷ೔෇ࢦఆݕࡧͰʮ2006೥ʯΛઃఆ͠ӈهͷαΠτΛ֬ೝ https://docs.aws.amazon.com/cli/latest/reference/s3api/get-bucket-notification.html ந ৅ ౓
  11. ҎԼͷ AWS API ͷهࣄ͕͓͢͢ΊͰ͢
 Ϋϥ΢υαʔϏεͱ͸Կͳͷ͔͔ΒAPIͷཪଆΛେ·͔ʹ঺հ 11 AWS ͷ API ͱ͸Կͳͷ͔

    ʮAWS ͷ API Λཧղ͠Α͏ !ॳڃฤ ~ API ͷ࢓૊Έͱར༻ํ๏Λཧղ͠Α͏ʯ
 https://aws.amazon.com/jp/builders-flash/202209/way-to-operate-api/ هࣄΑΓҾ༻
  12. ҎԼͷAWS SDKͷهࣄ͕͓͢͢ΊͰ͢
 AWS SDK Go Version 1 Λ୊ࡐʹιʔεϦʔσΟϯάͷίπͳͲ΋঺հ 12 AWS

    APIΛCLI/SDK͸Ͳ͏࢖͍ͬͯΔͷ͔஌Γ͍ͨ ʮAWS SDK ͷཪଆΛݟͯΈΑ͏ ! ~ AWS SDK for Go (v1) ͷίʔυͱͱ΋ʹ (લฤ)ʯ
 https://aws.amazon.com/jp/builders-flash/202203/backstage-aws-sdk-01/?awsf.filter-name=*all هࣄΑΓҾ༻
  13. AWS APIΛWebը໘্͔Β௚ײతʹૢ࡞͢Δ͜ͱ͕Մೳʹʂʢ2009೥※ʣ 13 AWS Ϛωδϝϯτίϯιʔϧͷొ৔ AWS API AWS CLI AWS

    SDK Ϛωʔδϝϯτ
 ίϯιʔϧ खॱॻ ϓϩάϥϜ खॱॻ+γΣϧ AWS ϦιʔεʢEC2ɺVPCͳͲʣ ※ʮAmazon EC2ΛGUIͰૢ࡞͢Δެࣜ؅ཧπʔϧɹAWS Management Consoleʯhttps://blog.takuros.net/entry/20090115/1231985458 ந ৅ ౓
  14. Πϯϑϥͷߏங͸ΦϯϓϨͱൺ΂ͯޮ཰Խ͕ͨ͠·ͩ՝୊͸࢒͍ͬͯͨ • AWS CLI/SDKͷ৔߹ • γεςϜͷෳࡶԽʹԠͯ͡ߏஙखॱ͕૿͑ଓ͚Δ
 2011೥౦ژϦʔδϣϯͷαʔϏε਺͸10~20छྨ※ ౰࣌Ͱ΋͜ͷ՝୊͸ೝࣝ͞Ε͍ͯͨʢ2022೥ݱࡏͰ͸200छྨҎ্ʣ • ߏஙखॱͰ໰୊ൃੜ࣌ɺ੾Γ໭͠༻ʹෳࡶͳ৚݅෼ذͷߟྀ͕ඞཁ

    • CLI΍SDKͰͷߏஙΛϓϩάϥϜͰޮ཰Խ͢ΔͨΊʹಠࣗͷϓϩάϥϜΛ֤PJͰ࡞੒ • Ϛωʔδϝϯτίϯιʔϧͷ৔߹ • ը໘ΩϟϓνϟͰखॱΛ࢒ͯ͠΋ը໘͕มߋ͠࢖͑ͳ͘ͳΔ • ख࡞ۀ͕ଟ͘࡞ۀ඼࣭Λ୲อͮ͠Β͍ • ෳ਺Ϧʔδϣϯ/ΞΧ΢ϯτ΁ͷల։࣌ɺ࠶౓ಉ͡खॱʹΑΔૢ࡞͕ඞཁͰ͕͔͔࣌ؒΔ 14 ࢒͞Εͨ՝୊ ※ʮΫϥ΢υ͕೔ຊʹ্཮ (The Cloud Expands to Japan)ʯhttps://aws.amazon.com/jp/about-aws/whats-new/2011/03/02/announcing-asia-pacific-tokyo-region/
  15. 15 ͜Ε͸ԿͰ͠ΐ͏ʁ

  16. 16 ͜Ε͸ԿͰ͠ΐ͏ʁ Jeff Barr͞ΜͷԞ͞Μͷ”༗໊ͳ”ΪϦγϟͷΠʔελʔϒϨουʂ
 CloudFormationͷGAهࣄ※Ͱొ৔ ※ʮAWS CloudFormation – Create Your

    AWS Stack From a Recipeʯhttps://aws.amazon.com/jp/blogs/aws/cloudformation-create-your-aws-stack-from-a-recipe/
  17. AWSϦιʔεΛελοΫͱ͍͏୯ҐͰ؅ཧ
 Ұճͷؔ਺ݺͼग़͠ͰελοΫશମΛߏ੒Մೳʢ2011೥※ʣ 17 AWS CloudFormationͷొ৔ ※ը૾౳Ҿ༻ݩʮAWS CloudFormation – Create Your

    AWS Stack From a Recipeʯhttps://aws.amazon.com/jp/blogs/aws/cloudformation-create-your-aws-stack-from-a-recipe/
  18. AWSϦιʔεΛߏ੒͢ΔࡍͷෳࡶੑͷղফͷͨΊCloudFormation͕ొ৔ 18 AWS CloudFormationͷొ৔ AWS API AWS CLI AWS SDK

    Ϛωʔδϝϯτ
 ίϯιʔϧ खॱॻ ϓϩάϥϜ खॱॻ+γΣϧ CloudFormation JSON/YAML AWS ϦιʔεʢEC2ɺVPCͳͲʣ ந ৅ ౓
  19. CloudFormation͕ղܾͨ͠՝୊/ະղܾͷ՝୊ • ղܾͨ͠՝୊ • ൚༻త͔ͭ܁Γฦ͠ՄೳͳϓϩηεͰෳࡶͳγεςϜ͕ߏஙՄೳ • ӡ༻΍։ൃ؀ڥͳͲͷਖ਼֬ͳίϐʔ͕࡞੒Մೳ • ߏஙࣦഊ࣌ͷϩʔϧόοΫ͕Մೳʢ͋Δఔ౓ʣ •

    ະղܾͷ՝୊ • ςϯϓϨʔτͷهड़͕৑௕ʹͳΓ΍͘͢ෳࡶԽ͠΍͍͢※ • ಠಛͳهड़ʹ׳ΕΔͨΊͷ͕͔͔࣌ؒΔ • ύϥϝʔλͷ֬ೝ͕ஞҰඞཁ 19 AWS CloudFormation͕΋ͨΒͨ͠΋ͷ Description: This template deploys a VPC, with a pair of public and private subnets spread across two Availability Zones. It deploys an internet gateway, with a default route on the public subnets. It deploys a pair of NAT gateways (one in each AZ), and default routes for them in the private subnets. Parameters: EnvironmentName: Description: An environment name that is prefixed to resource names Type: String VpcCIDR: Description: Please enter the IP range (CIDR notation) for this VPC Type: String Default: 10.192.0.0/16 PublicSubnet1CIDR: Description: Please enter the IP range (CIDR notation) for the public subnet in the first Availability Zone Type: String Default: 10.192.10.0/24 PublicSubnet2CIDR: Description: Please enter the IP range (CIDR notation) for the public subnet in the second Availability Zone Type: String Default: 10.192.11.0/24 PrivateSubnet1CIDR: Description: Please enter the IP range (CIDR notation) for the private subnet in the first Availability Zone Type: String Default: 10.192.20.0/24 PrivateSubnet2CIDR: Description: Please enter the IP range (CIDR notation) for the private subnet in the second Availability Zone Type: String Default: 10.192.21.0/24 Resources: VPC: Type: AWS::EC2::VPC Properties: CidrBlock: !Ref VpcCIDR EnableDnsSupport: true EnableDnsHostnames: true Tags: - Key: Name Value: !Ref EnvironmentName InternetGateway: Type: AWS::EC2::InternetGateway Properties: Tags: - Key: Name Value: !Ref EnvironmentName InternetGatewayAttachment: Type: AWS::EC2::VPCGatewayAttachment Properties: InternetGatewayId: !Ref InternetGateway VpcId: !Ref VPC PublicSubnet1: Type: AWS::EC2::Subnet Properties: VpcId: !Ref VPC AvailabilityZone: !Select [ 0, !GetAZs '' ] CidrBlock: !Ref PublicSubnet1CIDR MapPublicIpOnLaunch: true Tags: - Key: Name Value: !Sub ${EnvironmentName} Public Subnet (AZ1) PublicSubnet2: Type: AWS::EC2::Subnet Properties: VpcId: !Ref VPC AvailabilityZone: !Select [ 1, !GetAZs '' ] CidrBlock: !Ref PublicSubnet2CIDR MapPublicIpOnLaunch: true Tags: - Key: Name Value: !Sub ${EnvironmentName} Public Subnet (AZ2) PrivateSubnet1: Type: AWS::EC2::Subnet Properties: VpcId: !Ref VPC AvailabilityZone: !Select [ 0, !GetAZs '' ] CidrBlock: !Ref PrivateSubnet1CIDR MapPublicIpOnLaunch: false Tags: - Key: Name Value: !Sub ${EnvironmentName} Private Subnet (AZ1) PrivateSubnet2: Type: AWS::EC2::Subnet Properties: VpcId: !Ref VPC AvailabilityZone: !Select [ 1, !GetAZs '' ] CidrBlock: !Ref PrivateSubnet2CIDR MapPublicIpOnLaunch: false Tags: - Key: Name Value: !Sub ${EnvironmentName} Private Subnet (AZ2) NatGateway1EIP: Type: AWS::EC2::EIP DependsOn: InternetGatewayAttachment Properties: Domain: vpc NatGateway2EIP: Type: AWS::EC2::EIP DependsOn: InternetGatewayAttachment Properties: Domain: vpc NatGateway1: Type: AWS::EC2::NatGateway Properties: AllocationId: !GetAtt NatGateway1EIP.AllocationId NatGateway2: Type: AWS::EC2::NatGateway Properties: AllocationId: !GetAtt NatGateway2EIP.AllocationId SubnetId: !Ref PublicSubnet2 PublicRouteTable: Type: AWS::EC2::RouteTable Properties: VpcId: !Ref VPC Tags: - Key: Name Value: !Sub ${EnvironmentName} Public Routes DefaultPublicRoute: Type: AWS::EC2::Route DependsOn: InternetGatewayAttachment Properties: RouteTableId: !Ref PublicRouteTable DestinationCidrBlock: 0.0.0.0/0 GatewayId: !Ref InternetGateway PublicSubnet1RouteTableAssociation: Type: AWS::EC2::SubnetRouteTableAssociation Properties: RouteTableId: !Ref PublicRouteTable SubnetId: !Ref PublicSubnet1 PublicSubnet2RouteTableAssociation: Type: AWS::EC2::SubnetRouteTableAssociation Properties: RouteTableId: !Ref PublicRouteTable SubnetId: !Ref PublicSubnet2 PrivateRouteTable1: Type: AWS::EC2::RouteTable Properties: VpcId: !Ref VPC Tags: - Key: Name Value: !Sub ${EnvironmentName} Private Routes (AZ1) DefaultPrivateRoute1: Type: AWS::EC2::Route Properties: RouteTableId: !Ref PrivateRouteTable1 DestinationCidrBlock: 0.0.0.0/0 NatGatewayId: !Ref NatGateway1 PrivateSubnet1RouteTableAssociation: Type: AWS::EC2::SubnetRouteTableAssociation Properties: RouteTableId: !Ref PrivateRouteTable1 SubnetId: !Ref PrivateSubnet1 PrivateRouteTable2: Type: AWS::EC2::RouteTable Properties: VpcId: !Ref VPC Tags: - Key: Name Value: !Sub ${EnvironmentName} Private Routes (AZ2) DefaultPrivateRoute2: Type: AWS::EC2::Route Properties: RouteTableId: !Ref PrivateRouteTable2 DestinationCidrBlock: 0.0.0.0/0 NatGatewayId: !Ref NatGateway2 PrivateSubnet2RouteTableAssociation: Type: AWS::EC2::SubnetRouteTableAssociation Properties: RouteTableId: !Ref PrivateRouteTable2 SubnetId: !Ref PrivateSubnet2 NoIngressSecurityGroup: Type: AWS::EC2::SecurityGroup Properties: GroupName: "no-ingress-sg" GroupDescription: "Security group with no ingress rule" VpcId: !Ref VPC Outputs: VPC: Description: A reference to the created VPC Value: !Ref VPC PublicSubnets: Description: A list of the public subnets Value: !Join [ ",", [ !Ref PublicSubnet1, !Ref PublicSubnet2 ]] PrivateSubnets: Description: A list of the private subnets Value: !Join [ ",", [ !Ref PrivateSubnet1, !Ref PrivateSubnet2 ]] PublicSubnet1: Description: A reference to the public subnet in the 1st Availability Zone Value: !Ref PublicSubnet1 PublicSubnet2: Description: A reference to the public subnet in the 2nd Availability Zone Value: !Ref PublicSubnet2 PrivateSubnet1: Description: A reference to the private subnet in the 1st Availability Zone Value: !Ref PrivateSubnet1 PrivateSubnet2: Description: A reference to the private subnet in the 2nd Availability Zone Value: !Ref PrivateSubnet2 NoIngressSecurityGroup: Description: Security group with no ingress rule Value: !Ref NoIngressSecurityGroup ※VPCͷαϯϓϧίʔυˠ
  20. ҎԼCloudFormationͷGAهࣄ(2011೥)͔ΒҾ༻ɿ 20 CloudFormation͕࠷ऴతʹ໨ࢦ͍ͯͨ͠΋ͷʁ Ҿ༻ݩʮAWS CloudFormation – Create Your AWS Stack

    From a Recipeʯhttps://aws.amazon.com/jp/blogs/aws/cloudformation-create-your-aws-stack-from-a-recipe/ AWS is programmable, so it should be possible to build even complex systems (sometimes called “stacks”) using repeatable processes. ↓งғؾ೔ຊޠ༁ AWS͸ϓϩάϥϚϒϧͳͷͰɺ܁Γฦ͠ՄೳͳϓϩηεͰෳࡶͳαʔϏε
 ʢ࣌ʑελοΫͱݺ͹ΕΔʣ΋ߏஙՄೳͳ͸ͣͰ͢ɻ The templates are just plain old text files. You can edit them with a text editor, keep them under source code control, or even generate them from another program. ↓งғؾ೔ຊޠ༁ ςϯϓϨʔτ͸ͨͩͷݹ͍ςΩετϑΝΠϧͰ͢ɻ͋ͳͨ͸ςΩετΤσΟλͰฤूͨ͠Γ
 ιʔείʔυ؅ཧͨ͠ΓɺผͷϓϩάϥϜ͔Βੜ੒͢Δ͜ͱ΋Ͱ͖·͢ɻ
  21. ϓϩάϥϜʹΑΔAWSͷϦιʔε؅ཧ͕͍ͭʹެ͔ࣜΒఏڙʂ(2019೥) 21 AWS CDK(Cloud Development Kit)ͷొ৔ AWS API AWS ϦιʔεʢEC2ɺVPCͳͲʣ

    AWS CDK VSCode AWS CloudFormation const myVpc = new ec2.Vpc(this, `${id}-Vpc`, { cidr: props.vpcCidr, maxAzs: 2, natGateways: 1, flowLogs: {}, subnetConfiguration: [ { cidrMask: 24, name: "Public", subnetType: ec2.SubnetType.PUBLIC, }, { cidrMask: 24, name: "Protected", subnetType: ec2.SubnetType.PRIVATE_ISOLATED, }, ], });
  22. ༷ʑͳ໰୊΍ෳࡶੑΛղফͨ͠࠷৽ͷख๏ͱͯ͠CDK͕ొ৔ʂ 22 AWS CDKͷొ৔ AWS API AWS CLI AWS SDK

    Ϛωʔδϝϯτ
 ίϯιʔϧ खॱॻ ϓϩάϥϜ खॱॻ+γΣϧ CloudFormation AWS CDK AWS ϦιʔεʢEC2ɺVPCͳͲʣ ந ৅ ౓
  23. AWS಺ AWS֎ TerraformͳͲ΋هࡌɻSAMɺChalice͸αʔόϨεؔ࿈͚ͩͰ༻్͸ݶఆత 23 ͓·͚ Terraform΍ଞͷαʔϏεͱͷؔ܎ AWS API or AWS

    Cloud Control API AWS Chalice Python CloudFormation AWS CDK AWS Ϧιʔε ந ৅ ౓ Terraform HCL CDK for Terraform AWS SAM ෳ਺ͷ
 ϓϩάϥϜݴޠ Pulumi
  24. AWS CDK (CloudFormation)Ͱະఏڙͷػೳ͸AWS SDKܦ༝Ͱ࢖͑Δ 24 ͓·͚2 CDK(Cfn)ͰະఏڙͷAPIΛ࢖͏ํ๏ AWS API AWS

    Lambda CloudFormation AWS CDK AWS SDK AWS CDKͰAwsCustomResourceͳͲΛ ࢖͏͜ͱͰLambdaͱSDKܦ༝Ͱ೚ҙͷ AWS API͕ίʔϧՄೳ ελοΫͷ࡞੒/ߋ৽/࡟আ࣌ʹ࣮ߦՄೳ ஫ҙɿ
 CDKͷػೳͰग़དྷΔ಺༰͔Λे෼֬ೝ͠
 Ͳ͏ͯ͠΋࣮ݱͰ͖ͳ͍ͱ͖͚ͩ࢖͏ ࡞੒ ࣮ߦ
  25. CDKͷGA࣌ͷهࣄ※ΑΓҾ༻ɿ 25 AWS CDK͕΋ͨΒͨ͠΋ͷ w ΠϯϑϥετϥΫνϟͱΞϓϦέʔγϣϯίʔυΛಉ͡ϦϙδτϦʹอ؅͢Δ w ͞·͟·ͳ؀ڥɺ"84ΞΧ΢ϯτɺ"84ϦʔδϣϯʹΘ࣮ͨͬͯߦ͞ΕΔΠϯϑϥετϥΫνϟͷมߋΛ࠶ݱ͔ͭ༧ଌͰ͖ΔΑ͏ʹ͢Δ w ܧଓతͳςετ͕Ͱ͖ΔΑ͏ʹɺεςʔδϯά؀ڥͰຊ൪؀ڥΛ࠶ݱ͢Δ

    w ετϨεςετͷ࣮ߦʹඞཁͳ͚࣌ؒͩ࢖༻͢ΔύϑΥʔϚϯεςετ؀ڥͰɺຊ൪؀ڥΛ࠶ݱ͢Δ w σϓϩΠʹΠϯϑϥετϥΫνϟͷߋ৽ؚ͕·ΕΔΑ͏ʹɺίʔυͷมߋͱಉ͡πʔϧΛ࢖༻ͯ͠ΠϯϑϥετϥΫνϟͷมߋΛϦϦʔε͢Δ w ίʔυϨϏϡʔ΍খ͞ͳมߋΛසൟʹσϓϩΠ͢ΔͳͲͷΠϯϑϥετϥΫνϟ؅ཧʹɺιϑτ΢ΣΞ։ൃͷϕετϓϥΫςΟεΛద༻͢Δ • Two-Pizza Teams ͷݪଇͰνʔϜΛߏ੒͢Δ͜ͱͰࢢ৔౤ೖͷλΠϛϯάΛۃݶ·ͰૣΊΔ • CDKͳΒ͹ΠϯϑϥͱΞϓϦͷߏஙΛϦϙδτϦ಺ͷίʔυͰ؅ཧͰ͖σϓϩΠ΋౷ҰͰ͖
 ΠϯϑϥͱΞϓϦͷߋ৽ΛνʔϜ಺Ͱ׬શʹίϯτϩʔϧͰ͖Δ → CDKࣗମ͕ਅʹʮ Two-Pizza Teamsʯ͕ٻΊΔ࢟ʹۙͮͨ͘ΊͷαʔϏεʹͳ͍ͬͯΔʂ ʮAWS Ϋϥ΢υ։ൃΩοτ (CDK) – TypeScript ͱ Python ༻͕͝ར༻Մೳʹʯ https://aws.amazon.com/jp/blogs/news/aws-cloud-development-kit-cdk-typescript-and-python-are-now-generally-available/
  26. ࠓҰ౓Կ͕ղܾ͞Εͨͷ͔֬ೝ • ղܾͨ͠՝୊ • ςϯϓϨʔτͷهड़͕ൺֱత୹͘ͳΓཧղ͠΍͍͢ • ಠಛͳه๏Ͱͳ͘൚༻తͳϓϩάϥϜݴޠͰΠϯϑϥΛهड़Ͱ͖Δ • ύϥϝʔλ͸ίʔυิ׬Λ࢖͑͹ΤσΟλ্Ͱ͙͢ʹ֬ೝՄೳ •

    ࢒ͬͨ՝୊ • ϓϩάϥϜͷཧղ͕ඞཁ • ࠐΈೖ࣮ͬͨ૷Λ͢Δͱ͔͑ͬͯಡΈͮΒ͘ɺมߋͮ͠Β͘ͳΔʢDRYͷޭࡑʣ • API͕ந৅Խ͞Ε͍ͯΔͷͰཪͰԿ͕͓͖ͯΔ͔෼͔Γʹ͍͘ • 1౓࡞੒ޙ΄΅มߋͷͳ͍Ϧιʔε͸ߏஙͷख͕ؒੜ࢈ੑʹد༩ͮ͠Β͍ʢCLI/SDKͱͷซ༻Λݕ౼ʣ 26 AWS CDK͕΋ͨΒͨ͠΋ͷ̎
  27. ୭͔͕ݴ͍·ͨ͠ʮڝ͏ͳʂ࣋ͪຯΛΠΧͤοοʂʯͱ CDKͷ1ͭͷ࣋ͪຯ͸ૉૣ͘ࢼͤͯɺύϥϝʔλ΋ࡉ͔֬͘ೝͰ͖Δ͜ͱ
 ͔̍ΒॳΊͯ̎ʙ̐ͷύϥϝʔλ֬ೝ⁵ಈ࡞֬ೝΛ܁Γฦͯ͠ཧղΛਂΊΔ 27 AWS CDKΛ௨ͯ͠AWSαʔϏεΛֶͿํ๏ Ϛωʔδϝϯτ ίϯιʔϧͰ࡞Δ AWS্Ͱಈ࡞֬ೝ CDKͷίʔυͰ

    ύϥϝʔλ͔ΒԿ͕ Ͱ͖Δ͔Λ஌Δ CDKίʔυͰ ϦιʔεΛ࡞Δ σϑΥϧτઃఆ֬ೝͰ APIͷϕετͳઃఆ΋஌ΕΔ ̐ ̍ ̎ ̏
  28. JAWS DaysͰCDKࢧ෦ओ࠵ͷॳ৺ऀ޲͚ϋϯζΦϯ΍Γ·͢ʂ 10/08(౔) 15:40~17:40 ʹ؀ڥߏஙʢCloud9ʣ͔Β࣮ࢪ͠·͢ʂ 28 Ͱ΋CDK࢖͏؀ڥ͕ͳ͍ΜͩΑͳ͋

  29. • AWSͷࢥ૝΍ྺ࢙Λ࠶֬ೝ • αʔϏεؒͷ࢓༷౷Ұ → શͯͷAWSαʔϏε͸APIԽ͞Ε͍ͯΔʢجຊ͸ʣ • APIݺͼग़͠ͷந৅Խ → AWS

    CLI/SDKͷಋೖ • ෳ਺؀ڥߏஙͷखؒ΍ύϥϝʔλ૿ՃʹΑΔෳࡶੑͷղফ → CloudFormation • ෳࡶԽͨ͠ςϯϓϨʔτΛந৅Խ͠෼͔Γ΍͘͢/࡞Γ΍͘͢ → CDK • ৽ͨʹੜ·Εͯ͘ΔෳࡶੑΛந৅ԽͰվળ͢Δྺ࢙ͩͬͨ • CDKͰAWSαʔϏεΛֶͿ • CDKͰ·ͣಈ͘΋ͷΛ࡞ͬͯΈͯಈ࡞֬ೝ • CDKͷίʔυΛ௨ͯ͠αʔϏε࢓༷ΛֶͿʢಈ࡞֬ೝ⁵ύϥϝʔλ֬ೝͷԟ෮ʣ 29 ·ͱΊ