Programming AWS with Perl at YAPC::Asia 2013

40
Programming AWS with Perl 2013921アマゾン データ サービス ジャパン 株式会社 テクニカルエバンジェリスト 堀内康弘 (@horiuchi)

description

YAPC::Asia 2013での発表資料です。 33ページ目のデモに使ったサンプルスクリプトはこちら。 https://github.com/horiyasu/yapcasia2013/blob/master/create_vpc.pl

Transcript of Programming AWS with Perl at YAPC::Asia 2013

  • 1. Programming AWS with Perl 2013921 (@horiuchi)
  • 2. Who am I ? ( ) 1978 AWS 130 35 120(AWS) Amazon Web Services http://aws.typepad.com/aws_japan/ 10+ years web engineer in startups Director of V-cube (perl), 2001 - 2006 CTO of FlipClip (perl), 2006 - 2009 CTO of gumi (python), 2009 - 2012 @horiuchi horiyasu ! 2012
  • 3. Perl KENTCGI Shibuya.pm Sledge MIME::Lite::TTSledgeCPAN Python PythonPerl
  • 4. Agenda AWS? AWS Command Line Interface AWS::CLIWrapper
  • 5. AWS?
  • 6. 190 20,000
  • 7. Gartner Magic Quadrant for Cloud Infrastructure as a Service (August 19, 2013) Gartner Magic Quadrant for Cloud Infrastructure as a Service, Lydia Leong, Douglas Toombs, Bob Gill, Gregor Petri, Tiny Haynes, August 19, 2013. This Magic Quadrant graphic was published by Gartner, Inc. as part of a larger research note and should be evaluated in the context of the enPre report.. The Gartner report is available upon request from Steven Armstrong ([email protected]). Gartner does not endorse any vendor, product or service depicted in its research publicaPons, and does not advise technology users to select only those vendors with the highest raPngs. Gartner research publicaPons consist of the opinions of Gartner's research organizaPon and should not be construed as statements of fact. Gartner disclaims all warranPes, expressed or implied, with respect to this research, including any warranPes of merchantability or tness for a parPcular purpose. 7
  • 8. The Forrester Wave: Enterprise Public Cloud Plaorms, Q2 2013 Forrester Wave: Enterprise Public Cloud Plaorms For Coders, Q2 13 Forrester Wave: Enterprise Public Cloud Plaorms For DevOps Pros, Q2 13 Forrester Wave: Enterprise Public Cloud Plaorms For AD&D Leaders, Q2 13 The Forrester Wave is copyrighted by Forrester Research, Inc. Forrester and Forrester Wave are trademarks of Forrester Research, Inc. The Forrester Wave is a graphical representaPon of Forrester's call on a market and is plobed using a detailed spreadsheet with exposed scores, weighPngs, and comments. Forrester does not endorse any vendor, product, or service depicted in the Forrester Wave. InformaPon is based on best available resources. Opinions reect judgment at the Pme and are subject to change.
  • 9. AWS GovCloud 9 25 41 8
  • 10. 2007 2008 2009 2010 2011 2012 159 82 61 48 24 9 AWS Elastic Beanstalk Amazon SES AWS CloudFormation Amazon RDS for Oracle AWS Direct Connect AWS GovCloud Amazon ElastiCache VPC VPC SMS Amazon SNS Amazon CloudFront Amazon Route 53 S3 RDS Multi-AZ RDSDB AWS Import/Export Amazon RDS Amazon VPC Amazon EMR EC2 Auto Scaling EC2 Direct Connect6 DynamoDB VPCRDS AWS Trusted Advisor VPCCloudFormation AWS Storage Gateway Amazon Glacier CloudFront Amazon CloudSearch AWSMarketplace Red Hat Reserved Instance EC2 Multi-AZ Oracle RDS RDS SQL Server EC2 RIMarketplace VM Export VPCIP Provisioned IOPS Oracle Data Pump AWS Data Pipeline
  • 11. 1 2 3 4 5 2019 21 18 14 AWS Management Console Elastic Transcoder Amazon EC2 M3 Amazon Redshift AWS OpsWorks LinuxAmazon CloudWatch IAM Role Auto Scaling Amazon SQS SNS SQS 50% Amazon EC2 AWSAmazon ElastiCache Amazon DynamoDB AWS Elastic Beanstalk for Node.js Amazon RDS 3TB 30,000 PIOPS EBS Amazon Redshift EC2 ( ) S3 EC2 Windows EC2 AWS Elastic BeanstalkVPCIAM DynamoDB Node.js SDKGA EBS4000IOPS AWS Direct Connect OpsWorksELBCloudWatch DynamoDB Elastic Transcode7 2013592
  • 12. 30 AWS IAM Amazon CloudWatch Web Management Console AWS Elastic Beanstalk AWS Cloud Formation AWS OpsWorks IDE Eclipse Visual Studio & SDKs Java, PHP, .NET, Python, Ruby, node.js & AWS AZRegion & Amazon VPC / Amazon Elastic Load Balancer / Amazon Route 53 /AWS Direct Connect Amazon EC2 Auto Scale Amazon S3 Amazon EBS Amazon Glacier AWS StorageGateway Amazon RDS Amazon DynamoDB Amazon ElastiCache Amazon Redshift Amazon CloudFront Amazon SNS Amazon SQS Amazon SES Elastic MapReduce Amazon Cloud Search Amazon Elastic Transcoder Amazon SWF
  • 13. AWS AWS Management Console AWS
  • 14. API AWS GUICUI SDK AWS
  • 15. DNS CDN
  • 16. API DNS CDN API
  • 17. AWS SDK AWS http://aws.amazon.com/jp/tools/ REST/SOAP API
  • 18. Put,Get DB REST SOAPAWS SDK
  • 19. AWS CLI
  • 20. AWS Command Line Interface (CLI) AWS 201212 20139 1.1.0 (2013921) Python 2.6.x
  • 21. 201392127 EMRCloudFrontCloudSearchData Pipeline
  • 22. $pip install awscli
  • 23. $ cat ~/.aws/cong [default] aws_access_key_id = AKIXXXXYYYYYZZZZ aws_secret_access_key = AWSAWSAWSZZZZZZ region = ap-northeast-1
  • 24. bash tcsh zsh $ complete -C aws_completer aws $ complete aws 'p/*/`aws_completer`/' $ source bin/aws_zsh_completer.sh
  • 25. aws [] # EC2 $ aws ec2 describe-instances # S3 $ aws s3 ls # S3sync $ aws s3 sync . s3://bucketname/dir
  • 26. 3 --output JSONTextTable JSON # EC2JSON $ aws ec2 describe-instances # EC2 $ aws ec2 describe-instances --output text # EC2 $ aws ec2 describe-instances --output table
  • 27. help help $ aws help $ aws ec2 help $ aws ec2 describe-instances help
  • 28. AWS CLI AWS CLI http://aws.amazon.com/cli/ (GitHub) https://github.com/aws/aws-cli http://docs.aws.amazon.com/cli/latest/userguide/cli-chap- welcome.html CLI http://docs.aws.amazon.com/cli/latest/reference/ AWS http://bit.ly/14pcwZM
  • 29. AWS::CLIWRAPPER
  • 30. AWS::CLIWrapper @hirose31 AWS CLI use AWS::CLIWrapper; my $aws = AWS::CLIWrapper->new( region => 'ap-northeast-1', ); my $res = $aws->ec2( describe-instances, { instance_ids => [i-xxxxxx, i-yyyyyyy], } );
  • 31. S3 use AWS::CLIWrapper; use Data::Dumper; my $aws = AWS::CLIWrapper->new( region => 'ap-northeast-1', ); my $res = $aws->s3( ls => {}); print Dumper($res);
  • 32. : ap-northeast-1VPC ID: CIDR: 10.0.0.0/16 Zone: ap-northeast-1 subnet id: CIDR: 10.0.0.0/24 Route table: Network ACL:Internet Gateway id: Web IP IP : VPC
  • 33.
  • 34. AWS CLIAWS AWS CLIAWS::CLIWrapper AWSperl AWS HAPPY CODING!!
  • 35.
  • 36. AWS 12 Amazon EC2 750/Linux 750/ Amazon EC2 750/Windows Server 750/ Amazon EBS 30 GB 200 I/O 1 GB Elastic Load Balancing 750 15 GB 15 GB Amazon S3 5 GB20,000 Get 2,000 Put DynamoDBSimpleDBSWFSQSSNSCloudWatch http://aws.amazon.com/jp/free/
  • 37. 9/28 JAWS FESTA Kansai 2013 9/28 () AWS (JAWS-UG) http://jfk2013.jaws-ug.jp/
  • 38. 175! Gameday! Hackathon! Boot Camp! ! ! ! re:Invent 2013 ! http://bit.ly/reinvent2013japan 1112 () 1115 () 4 ! ! ! ! ! !