Your SlideShare is downloading. ×
0
AWS Command Line Interface (aws-cli)をつかってみた           #awspad          2013-02-18        ひろせ まさあき
自己紹介• ひろせ まさあき @hirose31 • インフラエンジニア :D • 『サーバ/インフラを支える技術』, 2008• 最近の関心事 • NATインスタンスの冗長化 (single subnet, multiAZ) • タダでELB...
aws-cli?
aws-cli• 2012-12公開• 最新 0.5.3 (Developer Preview) • http://aws.amazon.com/cli/ • https://github.com/aws/aws-cli • http://do...
aws-cli          VS      EC2 API tool• 1コマンドで複数サービスに対応• Python (not Java)• 結果がJSON (textも可)• bash, zshの補完可能
AWS::CLIWrapper  Perl module, wrapping aws-cliuse	  AWS::CLIWrapper;	  my	  $aws	  = AWS::CLIWrapper->new;	  my	  $res	  =...
使い方 / 環境設定$ export AWS_ACCESS_KEY_ID=<access_key>$ export AWS_SECRET_ACCESS_KEY=<secret_key>$ export AWS_DEFAULT_REGION=us...
使い方 / help$ aws help$ aws ec2 help$ aws ec2 describe-instances help
使い方 / 引数• string   • そのまま文字列• list   •     --instance-ids i-AAA i-BBB (space separaed)   ×     i-AAA i-BBB (NOT quoted as ...
使い方 / 補完bash      $ complete -C aws_completer awszsh      $ source bin/zsh_complete.sh
使い方 / jq     • jq      • lightweight and flexible command-line            JSON processor        • http://stedolan.github.co...
おはまり• AWS_DEFAULT_REGIONが効かない!! • 0.5.0で修正 • https://github.com/aws/aws-cli/pull/36
おはまり• ec2 create-tagsが動かない!! • 0.5.0で修正 • https://github.com/aws/aws-cli/issues/33
おはまりかも?と思ったら       aws --debug SERVICE COMMAND ...$ aws --debug ec2 describe-instances --filters {"name":"tag:Name","value...
今後• 対応サービスの追加          EC2 VPC ELB           Auto Scaling           SQS SNS SESElastic Beanstalk CloudFormation           ...
今後• あれ?おかしいな?と思ったら… • https://github.com/aws/aws-cli • issue • pull request
Thanks :D
Upcoming SlideShare
Loading in...5
×

Introduction of aws-cli

3,877

Published on

Introduction of aws-cli

Published in: Technology
0 Comments
9 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
3,877
On Slideshare
0
From Embeds
0
Number of Embeds
15
Actions
Shares
0
Downloads
7
Comments
0
Likes
9
Embeds 0
No embeds

No notes for slide

Transcript of "Introduction of aws-cli"

  1. 1. AWS Command Line Interface (aws-cli)をつかってみた #awspad 2013-02-18 ひろせ まさあき
  2. 2. 自己紹介• ひろせ まさあき @hirose31 • インフラエンジニア :D • 『サーバ/インフラを支える技術』, 2008• 最近の関心事 • NATインスタンスの冗長化 (single subnet, multiAZ) • タダでELBを暖機する方法 • サブネットとかVPCに名前つけたいですぅ
  3. 3. aws-cli?
  4. 4. aws-cli• 2012-12公開• 最新 0.5.3 (Developer Preview) • http://aws.amazon.com/cli/ • https://github.com/aws/aws-cli • http://docs.aws.amazon.com/cli/latest/ userguide/cli-chap-welcome.html
  5. 5. aws-cli VS EC2 API tool• 1コマンドで複数サービスに対応• Python (not Java)• 結果がJSON (textも可)• bash, zshの補完可能
  6. 6. AWS::CLIWrapper Perl module, wrapping aws-cliuse  AWS::CLIWrapper;  my  $aws  = AWS::CLIWrapper->new;  my  $res  = $aws->ec2(describe-instances, {    instance_ids  => [i-XXXXX, i-YYYYY],   });  
  7. 7. 使い方 / 環境設定$ export AWS_ACCESS_KEY_ID=<access_key>$ export AWS_SECRET_ACCESS_KEY=<secret_key>$ export AWS_DEFAULT_REGION=us-west-2 or$ export AWS_CONFIG_FILE=/path/to/config_file
  8. 8. 使い方 / help$ aws help$ aws ec2 help$ aws ec2 describe-instances help
  9. 9. 使い方 / 引数• string • そのまま文字列• list • --instance-ids i-AAA i-BBB (space separaed) × i-AAA i-BBB (NOT quoted as single string) × i-AAA, i-BBB (NOT comma separated) × ["i-AAA", "i-BBB"] (NOT JSON)• structure • JSON• list + structure = space separated + JSON • --filters {"name":"tag:Name","values": ["web*","db*"]} {"name"...}
  10. 10. 使い方 / 補完bash $ complete -C aws_completer awszsh $ source bin/zsh_complete.sh
  11. 11. 使い方 / jq • jq • lightweight and flexible command-line JSON processor • http://stedolan.github.com/jq/$ aws ec2 describe-instances | jq .reservationSet[].instancesSet[] | {instanceId, instanceType}{ "instanceType": "m2.2xlarge", "instanceId": "i-AAA"}{ "instanceType": "c1.xlarge", "instanceId": "i-BBB"}...
  12. 12. おはまり• AWS_DEFAULT_REGIONが効かない!! • 0.5.0で修正 • https://github.com/aws/aws-cli/pull/36
  13. 13. おはまり• ec2 create-tagsが動かない!! • 0.5.0で修正 • https://github.com/aws/aws-cli/issues/33
  14. 14. おはまりかも?と思ったら aws --debug SERVICE COMMAND ...$ aws --debug ec2 describe-instances --filters {"name":"tag:Name","values":["web*","db*"]}...AWSAccessKeyId=XXX&Action=DescribeInstances&Filter.1.Name=tag%3AName&Filter.1.Value.1=web%2A&Filter.1.Value.2=db%2A&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2013-02-17T15%3A47%3A36.787450&Version=2012-12-01... で、API リファレンスとにらめっこ
  15. 15. 今後• 対応サービスの追加 EC2 VPC ELB Auto Scaling SQS SNS SESElastic Beanstalk CloudFormation IAM S3 RDS Route 53 CloudFront ElastiCache SimpleDB CloudWatch...
  16. 16. 今後• あれ?おかしいな?と思ったら… • https://github.com/aws/aws-cli • issue • pull request
  17. 17. Thanks :D
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×