Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Introducing aws ruby sdk

1,664 views

Published on

Published in: Technology, Education
  • Be the first to comment

Introducing aws ruby sdk

  1. 1. Hamamatsu.rb#28
  2. 2. Hamamatsu.rb #28@jacoyutoriusAWS Ruby SDK
  3. 3. Name: Ogi YutoTwitter: @jacoyutoriusLanguage: C# , Ruby
  4. 4. All aws service areProgramableAWSのすべてのサービスはプログラマブル
  5. 5. よく訓練されたAWSユーザーは手(ManagementConsole)を使わないHard aws userDon’t useManagementConsole
  6. 6. マスターになると睨んだだけでEC2が立ち上がる。AWS Mastercan start the instance just glared.
  7. 7. まずは gemのインストールgem install aws-sdk
  8. 8. AWSアカウントのAccessKeyIDとSecretAccessKeyIDを設定AWS.config(:access_key_id => ‘’,:secret_access_key => ‘’)
  9. 9. ap-northeast-1が東京リージョンregion = AWS.regions[‘ap-northeast-1’]
  10. 10. 東京リージョンにあるインスタンスのID・タグ一覧・ステータスを表示region.ec2.instances.each do |instance|puts instance.idputs instance.tags.to_hputs instance.statusend
  11. 11. EC2インスタンスを作成instance = region.ec2.instances.create(:image_id => "ami-fe6ceeff",:key_name => "ec2_key",:instance_type => "t1.micro",:count => 1,:security_group_ids => ["default"])instance.tag("Name" , :value => “yoda")
  12. 12. インスタンスを停止インスタンスを削除instance.stopinstance.terminate
  13. 13. require "aws-sdk"AWS.config(:access_key_id => "",:secret_access_key => "")region = AWS.regions["ap-northeast-1"]region.ec2.instances.each do |instance|puts "Instance #{instance.tags[Name]} . status is#{instance.status}. id = #{instance.id}“endinstance = region.ec2.instances.create(:image_id => "ami-fe6ceeff",:key_name => “ec2_key",:instance_type => "t1.micro",:count => 1,:security_group_ids => ["default"])instance.tag("Name" , :value => “yoda")
  14. 14. Next time…次回…
  15. 15. CloudFormationクラウドフォーメーションで更なる高みへ
  16. 16. #RubyFriendsやろうず
  17. 17. Isnt it great meeting new Ruby friends atconferences, Ruby brigades, meetups, hackathons,or wherever?Wouldnt it be great to share that new friendship?Now you can! Just snap a pic of you and your newfriend(s) together, tweet it with hashtag#RubyFriends, and well include it on the site here.Thanks to Kristopher Murata and the rest ofthe #FridayHug team for sharing their source code. ☺http://rubyfriends.com/

×