ec2manage 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +7 -4
- data/bin/ec2manage +2 -4
- data/lib/ec2manage.rb +27 -4
- data/lib/ec2manage/commander_ext.rb +6 -0
- data/lib/ec2manage/commands.rb +66 -0
- metadata +11 -9
data/README.md
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
ec2manage
|
2
2
|
=========
|
3
3
|
|
4
|
-
|
4
|
+
NOTE: Currently this project is vaporware. Consider this documentation-driven-development.
|
5
|
+
|
6
|
+
ec2manage will be a command line tool for managing EC2 instances.
|
5
7
|
|
6
8
|
It's main goal is to provide the same style of control as the Amazon EC2 API Tools but with additional structure and metadata make administrative decisions easier.
|
7
9
|
|
@@ -22,8 +24,9 @@ Creating machines
|
|
22
24
|
|
23
25
|
Create a new Ubuntu 9 machine with 10GB blank EBS on /dev/sdi1 nicknamed "beta" in the web security group:
|
24
26
|
|
25
|
-
> ec2manage create
|
26
|
-
|
27
|
+
> ec2manage create --zone us-east-1d --ami ami-bb709dd2 --keypair my-keypair \
|
28
|
+
--group web --volume-size 10 --snapshot snap-6a0a8c03 \
|
29
|
+
--device sdi --name beta
|
27
30
|
|
28
31
|
Of course, specifying this every time would be tedious, so you can also build machine templates in JSON. The above machine would look like this:
|
29
32
|
|
@@ -56,7 +59,7 @@ Naming machines
|
|
56
59
|
|
57
60
|
You can get a JSON list of all images and volumes by running ec2manage with no arguments:
|
58
61
|
|
59
|
-
> ec2manage
|
62
|
+
> ec2manage list
|
60
63
|
|
61
64
|
You can also give your instances new nicknames using the rename command:
|
62
65
|
|
data/bin/ec2manage
CHANGED
data/lib/ec2manage.rb
CHANGED
@@ -1,7 +1,30 @@
|
|
1
1
|
module EC2Manage
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
def self.version
|
3
|
+
'0.0.2'
|
4
|
+
end
|
5
|
+
|
6
|
+
def self.name
|
7
|
+
'ec2manage'
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.summary
|
11
|
+
'A command-line manager for EC2 instances.'
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.description
|
15
|
+
<<-EOS.gsub(' ','')
|
16
|
+
ec2manage is a command line tool for managing EC2 instances.
|
17
|
+
|
18
|
+
It's main goal is to provide the same style of control as the
|
19
|
+
Amazon EC2 API Tools but with additional structure and metadata
|
20
|
+
make administrative decisions easier.
|
21
|
+
EOS
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.building?
|
25
|
+
$0.include?("gem") && ARGV[0] == "build"
|
6
26
|
end
|
7
27
|
end
|
28
|
+
|
29
|
+
#require 'ruby-debug'
|
30
|
+
#raise 'Take out the debugger!' if EC2Manage.building?
|
@@ -0,0 +1,66 @@
|
|
1
|
+
require 'ec2manage'
|
2
|
+
require 'commander/import'
|
3
|
+
require 'ec2manage/commander_ext'
|
4
|
+
|
5
|
+
program :name, EC2Manage.name
|
6
|
+
program :version, EC2Manage.version
|
7
|
+
program :description, EC2Manage.summary
|
8
|
+
|
9
|
+
default_command :help
|
10
|
+
|
11
|
+
command :create do |c|
|
12
|
+
c.syntax = '[options]'
|
13
|
+
c.summary = 'Create an instance.'
|
14
|
+
c.description = 'Creates an EC2 instance according to the specified options.'
|
15
|
+
|
16
|
+
c.option '-t', '--template STRING', 'JSON template to use when creating the instance.'
|
17
|
+
c.option '-n', '--name STRING', 'Nickname for the instance.'
|
18
|
+
c.option '-c', '--command STRING', 'Command to run after finishing.'
|
19
|
+
c.option '-z', '--zone STRING', 'Zone in which to create the instance (and volumes).'
|
20
|
+
c.option '-a', '--ami STRING', 'Image to use for the instance.'
|
21
|
+
c.option '-k', '--keypair STRING', 'Keypair to install on the instance.'
|
22
|
+
c.option '-g', '--group STRING', 'Security group to use on the instance.'
|
23
|
+
c.option '-v', '--volume-size STRING', 'Size of volume to attach in GB.'
|
24
|
+
c.option '-s', '--snapshot STRING', 'Snapshot to use for the volume.'
|
25
|
+
c.option '-d', '--device STRING', 'Device to attach the volume on.'
|
26
|
+
|
27
|
+
c.action do |args, options|
|
28
|
+
options.default :template => 'default'
|
29
|
+
debugger; 1
|
30
|
+
say "hello creation of template: #{options.template}"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
command :list do |c|
|
35
|
+
c.summary = 'List all instances.'
|
36
|
+
c.description = 'Lists all instances associated with the current account.'
|
37
|
+
|
38
|
+
c.action do |args, options|
|
39
|
+
say "hello listing"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
command :rename do |c|
|
44
|
+
c.summary = 'Rename an instance or volume.'
|
45
|
+
c.description = 'Renames the specified instance or volume.'
|
46
|
+
c.syntax = '<old-name> <new-name>'
|
47
|
+
|
48
|
+
c.action do |args, options|
|
49
|
+
old_name = args.shift or raise 'Please specify an instance or volume to rename'
|
50
|
+
new_name = args.shift or raise 'Please specify a new name for this instance or volume'
|
51
|
+
say "hello rename"
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
command :delete do |c|
|
56
|
+
c.summary = 'Delete an instance or volume.'
|
57
|
+
c.description = 'Deletes the specified instance or volume.'
|
58
|
+
c.syntax = '<name> [options]'
|
59
|
+
|
60
|
+
c.option '-v', '--volumes', 'Also delete any associated volumes.'
|
61
|
+
|
62
|
+
c.action do |args, options|
|
63
|
+
name = args.shift or raise 'Please specify an instance or volume to delete'
|
64
|
+
say "hello delete"
|
65
|
+
end
|
66
|
+
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 2
|
9
|
+
version: 0.0.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Mat Schaffer
|
@@ -14,21 +14,21 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-07-
|
17
|
+
date: 2010-07-10 00:00:00 -04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
|
-
name:
|
21
|
+
name: commander
|
22
22
|
prerelease: false
|
23
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - "="
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
segments:
|
28
|
+
- 4
|
28
29
|
- 0
|
29
|
-
-
|
30
|
-
|
31
|
-
version: 0.13.7
|
30
|
+
- 3
|
31
|
+
version: 4.0.3
|
32
32
|
type: :runtime
|
33
33
|
version_requirements: *id001
|
34
34
|
- !ruby/object:Gem::Dependency
|
@@ -88,9 +88,11 @@ extra_rdoc_files: []
|
|
88
88
|
files:
|
89
89
|
- README.md
|
90
90
|
- bin/ec2manage
|
91
|
+
- lib/ec2manage/commander_ext.rb
|
92
|
+
- lib/ec2manage/commands.rb
|
91
93
|
- lib/ec2manage.rb
|
92
94
|
has_rdoc: false
|
93
|
-
homepage: http://
|
95
|
+
homepage: http://github.com/matschaffer/ec2manage
|
94
96
|
licenses: []
|
95
97
|
|
96
98
|
post_install_message:
|
@@ -114,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
114
116
|
version: "0"
|
115
117
|
requirements: []
|
116
118
|
|
117
|
-
rubyforge_project:
|
119
|
+
rubyforge_project: nowarning
|
118
120
|
rubygems_version: 1.3.6
|
119
121
|
signing_key:
|
120
122
|
specification_version: 3
|