Introduction of aws-cli
Upcoming SlideShare
Loading in...5
×
 

Introduction of aws-cli

on

  • 4,505 views

Introduction of aws-cli

Introduction of aws-cli

Statistics

Views

Total Views
4,505
Views on SlideShare
2,972
Embed Views
1,533

Actions

Likes
8
Downloads
6
Comments
0

13 Embeds 1,533

http://d.hatena.ne.jp 1381
http://cloud.feedly.com 66
https://twitter.com 41
http://www.newsblur.com 9
http://karakuridou.net 8
http://www.twylah.com 8
http://newsblur.com 5
http://digg.com 4
http://www.feedspot.com 4
http://summary 3
http://webcache.googleusercontent.com 2
http://reader.aol.com 1
http://feedly.com 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Introduction of aws-cli Introduction of aws-cli Presentation Transcript

  • AWS Command Line Interface (aws-cli)をつかってみた #awspad 2013-02-18 ひろせ まさあき
  • 自己紹介• ひろせ まさあき @hirose31 • インフラエンジニア :D • 『サーバ/インフラを支える技術』, 2008• 最近の関心事 • NATインスタンスの冗長化 (single subnet, multiAZ) • タダでELBを暖機する方法 • サブネットとかVPCに名前つけたいですぅ
  • aws-cli?
  • 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
  • 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  = $aws->ec2(describe-instances, {    instance_ids  => [i-XXXXX, i-YYYYY],   });  
  • 使い方 / 環境設定$ 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
  • 使い方 / 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 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"...}
  • 使い方 / 補完bash $ complete -C aws_completer awszsh $ source bin/zsh_complete.sh
  • 使い方 / 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"}...
  • おはまり• 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","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 リファレンスとにらめっこ
  • 今後• 対応サービスの追加 EC2 VPC ELB Auto Scaling SQS SNS SESElastic Beanstalk CloudFormation IAM S3 RDS Route 53 CloudFront ElastiCache SimpleDB CloudWatch...
  • 今後• あれ?おかしいな?と思ったら… • https://github.com/aws/aws-cli • issue • pull request
  • Thanks :D