awscli 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -162,6 +162,63 @@ module AwsCli
162
162
  @ec2.create_instance options
163
163
  end
164
164
 
165
+ desc 'create_centos', 'Create a centos based instance, ebs_backed with root being 100GB (user has to manually execute resize2fs /dev/sda to reclaim extra storage on root device)'
166
+ method_option :count, :aliases => '-c', :type => :numeric, :default => 1, :desc => 'Number of instances to launch'
167
+ method_option :groups,:aliases => '-g', :banner => 'SG1 SG2 SG3',:type => :array, :default => %w(default), :desc => "Name of security group(s) for instances (not supported for VPC). Default: 'default'"
168
+ method_option :flavor_id, :aliases => '-t', :default => 'm1.small', :desc => 'Type of the instance to boot'
169
+ method_option :key_name, :aliases => '-k', :required => true, :desc => 'Name of the keypair to use'
170
+ method_option :tags, :type => :hash, :default => {'Name' => "awscli-centos-#{Time.now.to_i}"}, :desc => "Tags to identify server"
171
+ def create_centos
172
+ create_ec2_object
173
+ centos_amis = {
174
+ 'us-east-1' => 'ami-a96b01c0', #Virginia
175
+ 'us-west-1' => 'ami-51351b14', #Northern California
176
+ 'us-west-2' => 'ami-bd58c98d', #Oregon
177
+ 'eu-west-1' => 'ami-050b1b71', #Ireland
178
+ 'ap-southeast-1' => 'ami-23682671', #Singapore
179
+ 'ap-southeast-2' => 'ami-ffcd5ec5', #Sydney
180
+ 'ap-northeast-1' => 'ami-3fe8603e', #Tokyo
181
+ 'sa-east-1' => 'ami-e2cd68ff', #Sao Paulo
182
+ }
183
+ options[:count].times do
184
+ @ec2.create_instance :image_id => centos_amis[parent_options[:region]],
185
+ :block_device_mapping => %w(/dev/sda=:100:true::),
186
+ :groups => options[:groups],
187
+ :flavor_id => options[:flavor_id],
188
+ :key_name => options[:key_name],
189
+ :tags => options[:tags]
190
+ end
191
+ end
192
+
193
+ desc 'create_ubuntu', 'Create a ubuntu based instance, ebs_backed with root being 100GB (user has to manually execute resize2fs /dev/sda1 to reclaim extra storage on root device)'
194
+ method_option :count, :aliases => '-c', :type => :numeric, :default => 1, :desc => 'Number of instances to launch'
195
+ method_option :groups,:aliases => '-g', :banner => 'SG1 SG2 SG3',:type => :array, :default => %w(default), :desc => "Name of security group(s) for instances (not supported for VPC). Default: 'default'"
196
+ method_option :flavor_id, :aliases => '-t', :default => 'm1.small', :desc => 'Type of the instance to boot'
197
+ method_option :key_name, :aliases => '-k', :required => true, :desc => 'Name of the keypair to use'
198
+ method_option :tags, :type => :hash, :default => {'Name' => "awscli-ubuntu-#{Time.now.to_i}"}, :desc => "Tags to identify server"
199
+ def create_ubuntu
200
+ create_ec2_object
201
+ ubuntu_amis = {
202
+ 'us-east-1' => 'ami-9b85eef2', #Virginia
203
+ 'us-west-1' => 'ami-9b2d03de', #Northern California
204
+ 'us-west-2' => 'ami-77be2f47', #Oregon
205
+ 'eu-west-1' => 'ami-f5736381', #Ireland
206
+ 'ap-southeast-1' => 'ami-085b155a', #Singapore
207
+ 'ap-southeast-2' => 'ami-37c0530d', #Sydney
208
+ 'ap-northeast-1' => 'ami-57109956', #Tokyo
209
+ 'sa-east-1' => 'ami-a4fb5eb9', #Sao Paulo
210
+ }
211
+ options[:count].times do
212
+ @ec2.create_instance :image_id => ubuntu_amis[parent_options[:region]],
213
+ :block_device_mapping => %w(/dev/sda1=:100:true::),
214
+ :groups => options[:groups],
215
+ :flavor_id => options[:flavor_id],
216
+ :key_name => options[:key_name],
217
+ :tags => options[:tags],
218
+ :wait_for => true if options[:count] == 1
219
+ end
220
+ end
221
+
165
222
  desc "start", "start instances"
166
223
  long_desc <<-LONGDESC
167
224
  Start selected running instances.
@@ -94,8 +94,8 @@ module Awscli
94
94
  #parse options
95
95
  abort "Invalid block device mapping format, expecting 'devicename=blockdevice' format" unless group =~ /\S=\S/
96
96
  device_name, block_device = group.split("=")
97
- abort "Invalid device name, expectiing '/dev/sd[a-z]'" unless device_name =~ /^\/dev\/sd[a-z]$/
98
- abort "Invalud block device format, expecting 'ephemeral[0..3]|none|[snapshot-id]:[volume-size]:[true|false]:[standard|io1[:iops]]'" unless block_device =~ /^(snap-.*|ephemeral\w{1,3}|none|:.*)$/
97
+ abort "Invalid device name, expecting '/dev/sd[a-z]'" unless device_name =~ /^\/dev\/sd[a-z][0-9]$/
98
+ abort "Invalid block device format, expecting 'ephemeral[0..3]|none|[snapshot-id]:[volume-size]:[true|false]:[standard|io1[:iops]]'" unless block_device =~ /^(snap-.*|ephemeral\w{1,3}|none|:.*)$/
99
99
  mapping['DeviceName'] = device_name
100
100
  case block_device
101
101
  when 'none'
@@ -1,3 +1,3 @@
1
1
  module Awscli
2
- VERSION = '0.1.6'
2
+ VERSION = '0.1.7'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awscli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-08 00:00:00.000000000 Z
12
+ date: 2013-06-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -91,6 +91,22 @@ dependencies:
91
91
  - - ! '>='
92
92
  - !ruby/object:Gem::Version
93
93
  version: 1.10.0
94
+ - !ruby/object:Gem::Dependency
95
+ name: multi_json
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :runtime
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
94
110
  - !ruby/object:Gem::Dependency
95
111
  name: highline
96
112
  requirement: !ruby/object:Gem::Requirement
@@ -178,7 +194,7 @@ files:
178
194
  homepage: http://github.com/ashrithr/awscli
179
195
  licenses:
180
196
  - MIT
181
- post_install_message: Thanks for installing!, This gem is still in development.
197
+ post_install_message:
182
198
  rdoc_options: []
183
199
  require_paths:
184
200
  - lib