Share
Embed
AWSCDKを通してAWSを学ぶ/learn AWS through AWS CDK
JAWS-UG CDK支部 LT会3回目の発表で使用したスライドです。
tomoki10
September 08, 2022
Annual Pro sale · Save $30
Have presentations of your own?
Share with private links, password protection, and more control over your work.
Transcript
29 slides
-
ࣗݾհ @tmk2154 @tomoki10 • ࠤ౻ஐथ • Ϋϥεϝιουגࣜձࣾ • CXࣄۀຊ෦ Delivery෦
• ݱࡏɿαʔόʔαΠυ݉ΠϯϑϥΤϯδχΞ ݉QAͱ͔AWSΞΧϯτͷηΩϡϦςΟ • झຯɿVALORANTɺࢄา • ͖ͳAWSαʔϏεɿLambdaɺCDK -
ҎԼͷΑ͏ͳΈΛͬͨํΛରʹൃද͠·͢ • AWS CDK࢝ΊΑ͏͔ΜͰΔ • AWS CDKͰ͖Δ·ͰͬͯͲΜͳײͩͬͨ͡ͷʁ • AWSͷྺֶ࢙ͼํΛΓ͍ͨ ҎԼͷํର֎
• AWS CLI/SDK/CloudFormation/CDK ͷࢥͱྺ࢙ͷશཧղऀ ʢٯʹڭ͑ͯཉ͍͠ʣ 3 ରͱ͢Δࢹௌऀ -
2ͭͷଆ໘ͰCDKΛܦ༝ͯ͠AWSΛֶͿ • AWSࣗମͷྺ࢙ΛֶͿ • AWSͲΜͳֶͰαʔϏεΛ࡞͖ͬͯͨͷ͔ • ͍͔ʹͯ͠AWS CDKʹͨͲΓண͍ͨͷ͔Δ • AWS
CDKΛ௨ͯ͠AWSαʔϏεࣗମΛֶͿ • AWS CDKΛ͍ͲͷΑ͏ʹͯ͠AWSαʔϏεΛߏங͍ͯ͠Δ͔ • AWS CDKͷίʔυ͔Βٯࢉͯ͠αʔϏεΛֶͿज़ 4 ൃදͷ༰ͱత -
·ͣ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 -
͋Δͷ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 API First ͷઃܭΞϓϩʔν 1. શͯͷνʔϜ͜Ε͔ΒαʔϏεΠϯλϑΣʔεΛ௨ͯ͠σʔλΛެ։͢Δ 2. νʔϜඞͣ͜ΕΒͷΠϯλϑΣʔεΛհͯ͠ίϛϡχέʔγϣϯ͢Δ 3.
ଞͷܗࣜʹΑΔΞΫηεڐՄ͞Εͳ͍: ଓෆՄɺผνʔϜͷσʔλετΞʹΞΫηεෆՄɺϝϞϦڞ༗ෆՄɺόοΫυΞԿͰෆՄɻ αʔϏεΠϯλʔϑΣʔεΛ௨ͨ͠NWܦ༝ͰͷίϛϡχέʔγϣϯͷΈڐՄ͞ΕΔ 4. ͲͷςΫϊϩδʔΛ͏͔͍·ͤΜɻ HTTPͰCorbaͰPubSubϞσϧͰɺΧελϜϓϩτίϧͰͳ͍ɻؾʹ͠·ͤΜɻ 5. શͯͷαʔϏεΠϯλϑΣʔεྫ֎ͳ͘ɺجૅ͔Β֦ுՄೳͳΑ͏ʹઃܭ͠ͳ͚ΕͳΒͳ͍ ͭ·ΓɺνʔϜ։ൃνʔϜ֎Ͱ։ൃऀ͕ΠϯλʔϑΣʔεΛ֦ுՄೳͳΑ͏ܭըͱઃܭ͠ͳ͚ΕͳΒͳ͍ 6. ͜ΕΛͰ͖ͳ͍ͷղޏ͠·͢ 7. ྑ͍1Λʂ -
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. -
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 ந -
ҎԼͷ AWS API ͷهࣄ͕͓͢͢ΊͰ͢ ΫϥυαʔϏεͱԿͳͷ͔͔ΒAPIͷཪଆΛେ·͔ʹհ 11 AWS ͷ API ͱԿͳͷ͔
ʮAWS ͷ API Λཧղ͠Α͏ !ॳڃฤ ~ API ͷΈͱར༻ํ๏Λཧղ͠Α͏ʯ https://aws.amazon.com/jp/builders-flash/202209/way-to-operate-api/ هࣄΑΓҾ༻ -
ҎԼͷ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 هࣄΑΓҾ༻ -
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 ந -
ΠϯϑϥͷߏஙΦϯϓϨͱൺͯޮԽ͕ͨ͠·ͩ՝͍ͬͯͨ • AWS CLI/SDKͷ߹ • γεςϜͷෳࡶԽʹԠͯ͡ߏஙखॱ͕૿͑ଓ͚Δ 2011౦ژϦʔδϣϯͷαʔϏε10~20छྨ※ ࣌Ͱ͜ͷ՝ೝࣝ͞Ε͍ͯͨʢ2022ݱࡏͰ200छྨҎ্ʣ • ߏஙखॱͰൃੜ࣌ɺΓ͠༻ʹෳࡶͳ݅ذͷߟྀ͕ඞཁ
• CLISDKͰͷߏஙΛϓϩάϥϜͰޮԽ͢ΔͨΊʹಠࣗͷϓϩάϥϜΛ֤PJͰ࡞ • Ϛωʔδϝϯτίϯιʔϧͷ߹ • ը໘ΩϟϓνϟͰखॱΛͯ͠ը໘͕มߋ͑͠ͳ͘ͳΔ • ख࡞ۀ͕ଟ͘࡞ۀ࣭Λ୲อͮ͠Β͍ • ෳϦʔδϣϯ/ΞΧϯτͷల։࣌ɺ࠶ಉ͡खॱʹΑΔૢ࡞͕ඞཁͰ͕͔͔࣌ؒΔ 14 ͞Εͨ՝ ※ʮΫϥυ͕ຊʹ্ (The Cloud Expands to Japan)ʯhttps://aws.amazon.com/jp/about-aws/whats-new/2011/03/02/announcing-asia-pacific-tokyo-region/ -
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/ -
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/ -
AWSϦιʔεΛߏ͢ΔࡍͷෳࡶੑͷղফͷͨΊCloudFormation͕ొ 18 AWS CloudFormationͷొ AWS API AWS CLI AWS SDK
Ϛωʔδϝϯτ ίϯιʔϧ खॱॻ ϓϩάϥϜ खॱॻ+γΣϧ CloudFormation JSON/YAML AWS ϦιʔεʢEC2ɺVPCͳͲʣ ந -
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ͷαϯϓϧίʔυˠ -
ҎԼ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. ↓งғؾຊޠ༁ ςϯϓϨʔτͨͩͷݹ͍ςΩετϑΝΠϧͰ͢ɻ͋ͳͨςΩετΤσΟλͰฤूͨ͠Γ ιʔείʔυཧͨ͠ΓɺผͷϓϩάϥϜ͔Βੜ͢Δ͜ͱͰ͖·͢ɻ -
ϓϩάϥϜʹΑΔ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, }, ], }); -
༷ʑͳෳࡶੑΛղফͨ͠࠷৽ͷख๏ͱͯ͠CDK͕ొʂ 22 AWS CDKͷొ AWS API AWS CLI AWS SDK
Ϛωʔδϝϯτ ίϯιʔϧ खॱॻ ϓϩάϥϜ खॱॻ+γΣϧ CloudFormation AWS CDK AWS ϦιʔεʢEC2ɺVPCͳͲʣ ந -
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 -
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ͷػೳͰग़དྷΔ༰͔Λे֬ೝ͠ Ͳ͏࣮ͯ͠ݱͰ͖ͳ͍ͱ͖͚ͩ͏ ࡞ ࣮ߦ -
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/ -
ࠓҰԿ͕ղܾ͞Εͨͷ͔֬ೝ • ղܾͨ͠՝ • ςϯϓϨʔτͷهड़͕ൺֱత͘ͳΓཧղ͍͢͠ • ಠಛͳه๏Ͱͳ͘൚༻తͳϓϩάϥϜݴޠͰΠϯϑϥΛهड़Ͱ͖Δ • ύϥϝʔλίʔυิΛ͑ΤσΟλ্Ͱ͙͢ʹ֬ೝՄೳ •
ͬͨ՝ • ϓϩάϥϜͷཧղ͕ඞཁ • ࠐΈೖ࣮ͬͨΛ͢Δͱ͔͑ͬͯಡΈͮΒ͘ɺมߋͮ͠Β͘ͳΔʢDRYͷޭࡑʣ • API͕நԽ͞Ε͍ͯΔͷͰཪͰԿ͕͓͖ͯΔ͔͔Γʹ͍͘ • 1࡞ޙ΄΅มߋͷͳ͍Ϧιʔεߏஙͷख͕ؒੜ࢈ੑʹد༩ͮ͠Β͍ʢCLI/SDKͱͷซ༻Λݕ౼ʣ 26 AWS CDK͕ͨΒͨ͠ͷ̎ -
୭͔͕ݴ͍·ͨ͠ʮڝ͏ͳʂ࣋ͪຯΛΠΧͤοοʂʯͱ CDKͷ1ͭͷ࣋ͪຯૉૣ͘ࢼͤͯɺύϥϝʔλࡉ͔֬͘ೝͰ͖Δ͜ͱ ͔̍ΒॳΊͯ̎ʙ̐ͷύϥϝʔλ֬ೝ⁵ಈ࡞֬ೝΛ܁Γฦͯ͠ཧղΛਂΊΔ 27 AWS CDKΛ௨ͯ͠AWSαʔϏεΛֶͿํ๏ Ϛωʔδϝϯτ ίϯιʔϧͰ࡞Δ AWS্Ͱಈ࡞֬ೝ CDKͷίʔυͰ
ύϥϝʔλ͔ΒԿ͕ Ͱ͖Δ͔ΛΔ CDKίʔυͰ ϦιʔεΛ࡞Δ σϑΥϧτઃఆ֬ೝͰ APIͷϕετͳઃఆΕΔ ̐ ̍ ̎ ̏ -
• AWSͷࢥྺ࢙Λ࠶֬ೝ • αʔϏεؒͷ༷౷Ұ → શͯͷAWSαʔϏεAPIԽ͞Ε͍ͯΔʢجຊʣ • APIݺͼग़͠ͷநԽ → AWS
CLI/SDKͷಋೖ • ෳڥߏஙͷखؒύϥϝʔλ૿ՃʹΑΔෳࡶੑͷղফ → CloudFormation • ෳࡶԽͨ͠ςϯϓϨʔτΛநԽ͔͠Γ͘͢/࡞Γ͘͢ → CDK • ৽ͨʹੜ·Εͯ͘ΔෳࡶੑΛநԽͰվળ͢Δྺ࢙ͩͬͨ • CDKͰAWSαʔϏεΛֶͿ • CDKͰ·ͣಈ͘ͷΛ࡞ͬͯΈͯಈ࡞֬ೝ • CDKͷίʔυΛ௨ͯ͠αʔϏε༷ΛֶͿʢಈ࡞֬ೝ⁵ύϥϝʔλ֬ೝͷԟ෮ʣ 29 ·ͱΊ