Your SlideShare is downloading. ×
  • Like
Introduction of aws-cli
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Now you can save presentations on your phone or tablet

Available for both IPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Introduction of aws-cli

  • 3,683 views
Published

Introduction of aws-cli

Introduction of aws-cli

Published in Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
3,683
On SlideShare
0
From Embeds
0
Number of Embeds
14

Actions

Shares
Downloads
6
Comments
0
Likes
9

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. AWS Command Line Interface (aws-cli)をつかってみた #awspad 2013-02-18 ひろせ まさあき
  • 2. 自己紹介• ひろせ まさあき @hirose31 • インフラエンジニア :D • 『サーバ/インフラを支える技術』, 2008• 最近の関心事 • NATインスタンスの冗長化 (single subnet, multiAZ) • タダでELBを暖機する方法 • サブネットとかVPCに名前つけたいですぅ
  • 3. aws-cli?
  • 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. aws-cli VS EC2 API tool• 1コマンドで複数サービスに対応• Python (not Java)• 結果がJSON (textも可)• bash, zshの補完可能
  • 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. 使い方 / 環境設定$ 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. 使い方 / help$ aws help$ aws ec2 help$ aws ec2 describe-instances help
  • 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. 使い方 / 補完bash $ complete -C aws_completer awszsh $ source bin/zsh_complete.sh
  • 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. おはまり• AWS_DEFAULT_REGIONが効かない!! • 0.5.0で修正 • https://github.com/aws/aws-cli/pull/36
  • 13. おはまり• ec2 create-tagsが動かない!! • 0.5.0で修正 • https://github.com/aws/aws-cli/issues/33
  • 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. 今後• 対応サービスの追加 EC2 VPC ELB Auto Scaling SQS SNS SESElastic Beanstalk CloudFormation IAM S3 RDS Route 53 CloudFront ElastiCache SimpleDB CloudWatch...
  • 16. 今後• あれ?おかしいな?と思ったら… • https://github.com/aws/aws-cli • issue • pull request
  • 17. Thanks :D