awscli 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/README.rdoc +5 -0
- data/Rakefile +44 -0
- data/bin/awscli +32 -0
- data/features/awscli.feature +8 -0
- data/features/step_definitions/awscli_steps.rb +6 -0
- data/features/support/env.rb +15 -0
- data/lib/awscli.rb +44 -0
- data/lib/awscli/cli.rb +21 -0
- data/lib/awscli/cli/ec2.rb +23 -0
- data/lib/awscli/cli/ec2/ami.rb +46 -0
- data/lib/awscli/cli/ec2/ebs.rb +85 -0
- data/lib/awscli/cli/ec2/eip.rb +56 -0
- data/lib/awscli/cli/ec2/instances.rb +195 -0
- data/lib/awscli/cli/ec2/keypairs.rb +60 -0
- data/lib/awscli/cli/ec2/monitoring.rb +35 -0
- data/lib/awscli/cli/ec2/placement.rb +42 -0
- data/lib/awscli/cli/ec2/reservedinstmng.rb +45 -0
- data/lib/awscli/cli/ec2/secgroups.rb +66 -0
- data/lib/awscli/cli/ec2/spot.rb +81 -0
- data/lib/awscli/cli/ec2/subnet.rb +43 -0
- data/lib/awscli/cli/ec2/tags.rb +45 -0
- data/lib/awscli/cli/ec2/vmmng.rb +17 -0
- data/lib/awscli/cli/ec2/vpc.rb +42 -0
- data/lib/awscli/cli/ec2/vpc/connections.rb +0 -0
- data/lib/awscli/cli/ec2/vpc/cust_gateways.rb +0 -0
- data/lib/awscli/cli/ec2/vpc/dhcp.rb +51 -0
- data/lib/awscli/cli/ec2/vpc/internet_gateways.rb +58 -0
- data/lib/awscli/cli/ec2/vpc/net_interfaces.rb +75 -0
- data/lib/awscli/cli/ec2/vpc/network_acls.rb +29 -0
- data/lib/awscli/cli/ec2/vpc/priv_gatewats.rb +0 -0
- data/lib/awscli/cli/ec2/vpc/route_tables.rb +0 -0
- data/lib/awscli/cli/s3.rb +12 -0
- data/lib/awscli/cli/s3/directories.rb +82 -0
- data/lib/awscli/cli/s3/files.rb +77 -0
- data/lib/awscli/connection.rb +55 -0
- data/lib/awscli/ec2.rb +790 -0
- data/lib/awscli/errors.rb +64 -0
- data/lib/awscli/helper.rb +8 -0
- data/lib/awscli/s3.rb +108 -0
- data/lib/awscli/version.rb +3 -0
- data/test/default_test.rb +14 -0
- data/test/test_helper.rb +9 -0
- metadata +182 -0
@@ -0,0 +1,60 @@
|
|
1
|
+
module AwsCli
|
2
|
+
module CLI
|
3
|
+
module EC2
|
4
|
+
require 'awscli/cli/ec2'
|
5
|
+
class KeyPairs < Thor
|
6
|
+
|
7
|
+
desc "list", "List Key Pairs"
|
8
|
+
def list
|
9
|
+
puts "Listing Key Pairs"
|
10
|
+
create_ec2_object
|
11
|
+
@ec2.list_keypairs
|
12
|
+
end
|
13
|
+
|
14
|
+
desc "create", "Create Key Pair"
|
15
|
+
method_option :name, :aliases => "-n", :required => true, :banner => "NAME", :type => :string, :desc => "Name of the key pair to create"
|
16
|
+
method_option :fingerprint, :type => :string, :desc => "Fingerprint for the key(optional)"
|
17
|
+
method_option :private_key, :type => :string, :desc => "Private Key for the key(optional)"
|
18
|
+
def create
|
19
|
+
create_ec2_object
|
20
|
+
@ec2.create_keypair options
|
21
|
+
end
|
22
|
+
|
23
|
+
desc "delete", "Delete Key Pair"
|
24
|
+
method_option :name, :aliases => "-n", :required => true, :banner => "NAME", :type => :string, :desc => "Name of the key pair to delete"
|
25
|
+
def delete
|
26
|
+
create_ec2_object
|
27
|
+
@ec2.delete_keypair options[:name]
|
28
|
+
end
|
29
|
+
|
30
|
+
desc "fingerprint", "Describe Key Fingerprint"
|
31
|
+
method_option :name, :aliases => "-n", :required => true, :banner => "NAME", :type => :string, :desc => "Name of the key pair to delete"
|
32
|
+
def fingerprint
|
33
|
+
create_ec2_object
|
34
|
+
@ec2.fingerprint options[:name]
|
35
|
+
end
|
36
|
+
|
37
|
+
desc "import", "Imports an Key Pair"
|
38
|
+
method_option :name, :aliases => "-n", :required => true, :banner => "NAME", :type => :string, :desc => "Name of the key pair to import"
|
39
|
+
method_option :private_key_path, :aliases => "-p", :banner => "PATH", :type => :string, :desc => "Optionally pass private key path, by default tries to retrieve from user ~/.ssh dir"
|
40
|
+
method_option :public_key_path, :aliases => "-k", :banner => "PATH", :type => :string, :desc => "Optionally pass public key path, by default tries to retrieve from user ~/.ssh dir"
|
41
|
+
def import
|
42
|
+
create_ec2_object
|
43
|
+
@ec2.import_keypair options
|
44
|
+
end
|
45
|
+
|
46
|
+
private
|
47
|
+
|
48
|
+
def create_ec2_object
|
49
|
+
puts "ec2 Establishing Connetion..."
|
50
|
+
$ec2_conn = Awscli::Connection.new.request_ec2
|
51
|
+
puts "ec2 Establishing Connetion... OK"
|
52
|
+
@ec2 = Awscli::EC2::KeyPairs.new($ec2_conn)
|
53
|
+
end
|
54
|
+
|
55
|
+
AwsCli::CLI::Ec2.register AwsCli::CLI::EC2::KeyPairs, :kp, 'kp [COMMAND]', 'EC2 Key Pair Management'
|
56
|
+
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module AwsCli
|
2
|
+
module CLI
|
3
|
+
module EC2
|
4
|
+
require 'awscli/cli/ec2'
|
5
|
+
class MonitoringInstances < Thor
|
6
|
+
|
7
|
+
desc "monitor", "Monitor specified instance(s)"
|
8
|
+
method_option :instance_ids, :aliases => "-i", :type => :array, :required => true, :desc => "Instances Ids to monitor"
|
9
|
+
def monitor
|
10
|
+
create_ec2_object
|
11
|
+
@ec2.monitor options
|
12
|
+
end
|
13
|
+
|
14
|
+
desc "unmonitor", "UnMonitor specified instance(s)"
|
15
|
+
method_option :instance_ids, :aliases => "-i", :type => :array, :required => true, :desc => "Instances Ids to monitor"
|
16
|
+
def unmonitor
|
17
|
+
create_ec2_object
|
18
|
+
@ec2.unmonitor options
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def create_ec2_object
|
24
|
+
puts "ec2 Establishing Connetion..."
|
25
|
+
$ec2_conn = Awscli::Connection.new.request_ec2
|
26
|
+
puts "ec2 Establishing Connetion... OK"
|
27
|
+
@ec2 = Awscli::EC2::Monitoring.new($ec2_conn)
|
28
|
+
end
|
29
|
+
|
30
|
+
AwsCli::CLI::Ec2.register AwsCli::CLI::EC2::MonitoringInstances, :mont, 'mont [COMMAND]', 'EC2 Instances Monitoring Management'
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module AwsCli
|
2
|
+
module CLI
|
3
|
+
module EC2
|
4
|
+
require 'awscli/cli/ec2'
|
5
|
+
class Placement < Thor
|
6
|
+
|
7
|
+
desc "list", "List Placement Groups"
|
8
|
+
def list
|
9
|
+
create_ec2_object
|
10
|
+
@ec2.list
|
11
|
+
end
|
12
|
+
|
13
|
+
desc "create", "Create a new placement group"
|
14
|
+
method_option :name, :aliases => "-n", :required => true, :type => :string, :desc => "Name of the placement group"
|
15
|
+
method_option :strategy, :aliases => "-s", :type => :string, :default => "cluster", :desc => "Placement group strategy. Valid options in ['cluster']"
|
16
|
+
def create
|
17
|
+
create_ec2_object
|
18
|
+
@ec2.create options
|
19
|
+
end
|
20
|
+
|
21
|
+
desc "delete", "Delete a placement group that you own"
|
22
|
+
method_option :name, :aliases => "-n", :required => true, :type => :string, :desc => "Name of the placement group"
|
23
|
+
def delete
|
24
|
+
create_ec2_object
|
25
|
+
@ec2.delete options
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def create_ec2_object
|
31
|
+
puts "ec2 Establishing Connetion..."
|
32
|
+
$ec2_conn = Awscli::Connection.new.request_ec2
|
33
|
+
puts "ec2 Establishing Connetion... OK"
|
34
|
+
@ec2 = Awscli::EC2::Placement.new($ec2_conn)
|
35
|
+
end
|
36
|
+
|
37
|
+
AwsCli::CLI::Ec2.register AwsCli::CLI::EC2::Placement, :place, 'place [COMMAND]', 'EC2 Placement Management'
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module AwsCli
|
2
|
+
module CLI
|
3
|
+
module EC2
|
4
|
+
require 'awscli/cli/ec2'
|
5
|
+
class ReservedInstances < Thor
|
6
|
+
|
7
|
+
desc "list", "List ReservedInstances"
|
8
|
+
#TODO add filters
|
9
|
+
method_option :filters, :aliases => "-f", :type => :hash, :desc => "List of filters to limit results with"
|
10
|
+
method_option :offerings, :aliases => "-o", :type => :boolean, :default => false, :desc => "Describe all or specified reserved instances offerings"
|
11
|
+
method_option :list_filters, :aliases => "-l", :type => :boolean, :default => false, :desc => "List availble filters that you can be used to limit results"
|
12
|
+
def list
|
13
|
+
create_ec2_object
|
14
|
+
if options[:offerings]
|
15
|
+
@ec2.list_offerings options[:filters]
|
16
|
+
elsif options[:list_filters]
|
17
|
+
@ec2.list_filters
|
18
|
+
else
|
19
|
+
@ec2.list options[:filters]
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
desc "purchase", "Purchases a Reserved Instance for use with your account"
|
24
|
+
method_option :reserved_instances_offering_id, :aliases => "-i", :type => :string, :desc => "ID of the Reserved Instance offering you want to purchase"
|
25
|
+
method_option :instance_count, :aliases => "-c", :type => :numeric, :default => 1, :desc => "The number of Reserved Instances to purchase"
|
26
|
+
def purchase
|
27
|
+
create_ec2_object
|
28
|
+
@ec2.purchase options
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def create_ec2_object
|
34
|
+
puts "ec2 Establishing Connetion..."
|
35
|
+
$ec2_conn = Awscli::Connection.new.request_ec2
|
36
|
+
puts "ec2 Establishing Connetion... OK"
|
37
|
+
@ec2 = Awscli::EC2::ReservedInstances.new($ec2_conn)
|
38
|
+
end
|
39
|
+
|
40
|
+
AwsCli::CLI::Ec2.register AwsCli::CLI::EC2::ReservedInstances, :resv, 'resv [COMMAND]', 'EC2 ReservedInstances Management'
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
module AwsCli
|
2
|
+
module CLI
|
3
|
+
module EC2
|
4
|
+
require 'awscli/cli/ec2'
|
5
|
+
class SecGroups < Thor
|
6
|
+
|
7
|
+
desc "list", "List Security Groups"
|
8
|
+
method_option :show_ip_permissions, :aliases => "-p", :type => :boolean, :default => false, :desc => "Enabling this flag will show ip permissions as well"
|
9
|
+
def list
|
10
|
+
create_ec2_object
|
11
|
+
@ec2.list_secgroups options
|
12
|
+
end
|
13
|
+
|
14
|
+
desc "create", "Create New Security Group"
|
15
|
+
method_option :name, :aliases => "-n", :required => true, :banner => "NAME", :type => :string, :desc => "Name of the security group to create"
|
16
|
+
method_option :description, :aliases => "-d", :banner => "DESC", :type => :string, :desc => "Description of the group"
|
17
|
+
method_option :vpc_id, :aliases => "-v", :banner => "VPCID", :type => :string, :desc => "VPC ID to attach the security group to"
|
18
|
+
def create
|
19
|
+
create_ec2_object
|
20
|
+
@ec2.create_securitygroup options
|
21
|
+
end
|
22
|
+
|
23
|
+
desc "authorize", "Add a rule to existing Security Group"
|
24
|
+
method_option :group_id, :aliases => "-g", :required => true, :banner => "SGID", :type => :string, :desc => "ID of the security group to add a rule to"
|
25
|
+
method_option :protocol_type, :aliases => "-t", :required => true, :required => true, :banner => "TCP|UDP|ICMP", :type => :string, :desc => "Protocol Type to use for the rule"
|
26
|
+
method_option :start_port, :aliases => "-s", :required => true, :banner => "NUM", :type => :numeric, :desc => "Start of port range (or -1 for ICMP wildcard)"
|
27
|
+
method_option :end_port, :aliases => "-e", :required => true, :banner => "NUM", :type => :numeric, :desc => "End of port range (or -1 for ICMP wildcard)"
|
28
|
+
method_option :cidr, :aliases => "-c", :type => :string, :default => "0.0.0.0/0", :desc => "CIDR range"
|
29
|
+
def authorize
|
30
|
+
create_ec2_object
|
31
|
+
@ec2.authorize_securitygroup options
|
32
|
+
end
|
33
|
+
|
34
|
+
desc "revoke", "Remove a rule from security group"
|
35
|
+
method_option :group_id, :aliases => "-g", :required => true, :banner => "SGID", :type => :string, :desc => "ID of the security group to add a rule to"
|
36
|
+
method_option :protocol_type, :aliases => "-t", :required => true, :required => true, :banner => "TCP|UDP|ICMP", :type => :string, :desc => "Protocol Type to use for the rule"
|
37
|
+
method_option :start_port, :aliases => "-s", :required => true, :banner => "NUM", :type => :numeric, :desc => "Start of port range (or -1 for ICMP wildcard)"
|
38
|
+
method_option :end_port, :aliases => "-e", :required => true, :banner => "NUM", :type => :numeric, :desc => "End of port range (or -1 for ICMP wildcard)"
|
39
|
+
method_option :cidr, :aliases => "-c", :type => :string, :default => "0.0.0.0/0", :desc => "CIDR range"
|
40
|
+
def revoke
|
41
|
+
create_ec2_object
|
42
|
+
@ec2.revoke_securitygroup options
|
43
|
+
end
|
44
|
+
|
45
|
+
desc "delete", "Delete existing security group"
|
46
|
+
method_option :group_id, :aliases => "-g", :required => true, :banner => "SGID", :type => :string, :desc => "ID of the security group to add a rule to"
|
47
|
+
def delete
|
48
|
+
create_ec2_object
|
49
|
+
@ec2.delete_securitygroup options
|
50
|
+
end
|
51
|
+
|
52
|
+
private
|
53
|
+
|
54
|
+
def create_ec2_object
|
55
|
+
puts "ec2 Establishing Connetion..."
|
56
|
+
$ec2_conn = Awscli::Connection.new.request_ec2
|
57
|
+
puts "ec2 Establishing Connetion... OK"
|
58
|
+
@ec2 = Awscli::EC2::SecGroups.new($ec2_conn)
|
59
|
+
end
|
60
|
+
|
61
|
+
AwsCli::CLI::Ec2.register AwsCli::CLI::EC2::SecGroups, :sg, 'sg [COMMAND]', 'EC2 Security Groups Management'
|
62
|
+
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
module AwsCli
|
2
|
+
module CLI
|
3
|
+
module EC2
|
4
|
+
require 'awscli/cli/ec2'
|
5
|
+
class SpotInstancesManagement < Thor
|
6
|
+
|
7
|
+
desc "list", "List spot requests or spot data feed subscription"
|
8
|
+
method_option :describe_spot_datafeed_subscription, :aliases => "-s", :type => :boolean, :default => false, :desc => "Describe spot data feed subscription"
|
9
|
+
method_option :price_history, :aliases => "-p", :type => :boolean, :default => false, :desc => "Describe spot price history"
|
10
|
+
method_option :filters, :aliases => "-f", :type => :hash, :desc => "List of filters to limit results with"
|
11
|
+
method_option :list_filters, :aliases => "-l", :type => :boolean, :default => false, :desc => "List the available filters"
|
12
|
+
def list
|
13
|
+
create_ec2_object
|
14
|
+
if options[:describe_spot_datafeed_subscription]
|
15
|
+
@ec2.describe_spot_datafeed_subscription
|
16
|
+
elsif options[:price_history]
|
17
|
+
@ec2.describe_spot_price_history options[:filters]
|
18
|
+
elsif options[:list_filters]
|
19
|
+
@ec2.list_filters
|
20
|
+
else
|
21
|
+
@ec2.describe_spot_requests
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
desc "create_spot_datafeed", "Create a spot datafeed subscription"
|
26
|
+
method_option :bucket, :aliases => "-b", :type => :string, :required => true, :desc => "bucket name to store datafeed in"
|
27
|
+
method_option :prefix, :aliases => "-p", :type => :string, :required => true, :desc => "prefix to store data with"
|
28
|
+
def create_spot_datafeed
|
29
|
+
create_ec2_object
|
30
|
+
@ec2.create_spot_datafeed_subsription options[:bucket], options[:prefix]
|
31
|
+
end
|
32
|
+
|
33
|
+
desc "delete_spot_datafeed", "Delete a spot datafeed subscription"
|
34
|
+
def delete_spot_datafeed
|
35
|
+
create_ec2_object
|
36
|
+
@ec2.delete_spot_datafeed_subsription
|
37
|
+
end
|
38
|
+
|
39
|
+
desc "create", "Request spot instances"
|
40
|
+
method_option :price, :aliases => "-p", :type => :string, :required => true, :desc => "The maximum hourly price for any Spot Instance launched to fulfill the request"
|
41
|
+
method_option :image_id, :aliases => "-a", :type => :string, :required => true, :desc => "ami id to use"
|
42
|
+
method_option :flavor_id, :aliases => "-t", :type => :string, :required => true, :desc => "type of the instance to use"
|
43
|
+
method_option :key_name, :aliases => "-k", :type => :string, :required => true, :desc => "The name of the key pair"
|
44
|
+
method_option :instance_count, :aliases => "-c", :type => :numeric, :default => 1, :desc => "The maximum number of Spot Instances to launch"
|
45
|
+
method_option :request_type, :type => :string, :desc => "The Spot Instance request type, Valid Values:one-time | persistent"
|
46
|
+
method_option :valid_from, :type => :string, :banner => "DATETIME", :desc => "Start date of the request" #If this is a one-time request, the request becomes active at this date and time and remains active until all instances launch, the request expires, or the request is canceled If the request is persistent, the request becomes active at this date and time and remains active until it expires or is canceled.
|
47
|
+
method_option :valid_until, :type => :string, :banner => "DATETIME", :desc => "End date of the request" #If this is a one-time request, the request remains active until all instances launch, the request is canceled, or this date is reached. If the request is persistent, it remains active until it is canceled or this date and time is reached
|
48
|
+
method_option :launch_group, :type => :string, :default => "awscli_spot_group_#{Time.now.to_i}",:desc => "The instance launch group. Launch groups are Spot Instances that launch together and terminate together"
|
49
|
+
method_option :availability_zone_group, :type => :string, :desc => "The Availability Zone group. If you specify the same Availability Zone group for all Spot Instance requests, all Spot Instances are launched in the same Availability Zone"
|
50
|
+
method_option :groups, :type => :array, :default => ["default"], :desc => "Name of the security group"
|
51
|
+
method_option :user_data, :type => :string, :desc => "MIME, Base64-encoded user data to make available to the instances"
|
52
|
+
method_option :availability_zone, :type => :string, :desc => "The placement constraints (Availability Zone) for launching the instances"
|
53
|
+
method_option :block_device_mapping, :type => :string, :desc => "ebs mappings"
|
54
|
+
method_option :subnet_id, :type => :string, :desc => "subnet id use if vpc"
|
55
|
+
method_option :ebs_optimized, :type => :boolean, :desc => "whether to enable ebs optimization"
|
56
|
+
method_option :monitoring, :type => :boolean, :deafult => false, :desc => "Enables monitoring for the instance"
|
57
|
+
method_option :tags, :type => :string, :desc => "tags for the instances"
|
58
|
+
def create
|
59
|
+
create_ec2_object
|
60
|
+
@ec2.request_spot_instances options
|
61
|
+
end
|
62
|
+
|
63
|
+
desc "cancel", "Cancel spot instance requests"
|
64
|
+
def cancel
|
65
|
+
end
|
66
|
+
|
67
|
+
private
|
68
|
+
|
69
|
+
def create_ec2_object
|
70
|
+
puts "ec2 Establishing Connetion..."
|
71
|
+
$ec2_conn = Awscli::Connection.new.request_ec2
|
72
|
+
puts "ec2 Establishing Connetion... OK"
|
73
|
+
@ec2 = Awscli::EC2::Spot.new($ec2_conn)
|
74
|
+
end
|
75
|
+
|
76
|
+
AwsCli::CLI::Ec2.register AwsCli::CLI::EC2::SpotInstancesManagement, :spot, 'spot [COMMAND]', 'EC2 Spot Instances Management'
|
77
|
+
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module AwsCli
|
2
|
+
module CLI
|
3
|
+
module EC2
|
4
|
+
require 'awscli/cli/ec2'
|
5
|
+
class Subnet < Thor
|
6
|
+
|
7
|
+
desc "list", "List VPCs"
|
8
|
+
def list
|
9
|
+
create_ec2_object
|
10
|
+
@ec2.list
|
11
|
+
end
|
12
|
+
|
13
|
+
desc "create", "Create a subnet in an existing VPC, You can create up to 20 subnets in a VPC."
|
14
|
+
method_option :vpc_id, :aliases => "-v", :type => :string, :required => true, :desc => "The ID of the VPC where you want to create the subnet"
|
15
|
+
method_option :cidr_block, :aliases => "-c", :type => :string, :required => true, :desc => "The CIDR block you want the subnet to cover (e.g., 10.0.0.0/24)"
|
16
|
+
method_option :availability_zone, :aliases => "-z", :type => :string, :desc => "The Availability Zone you want the subnet in. Default: AWS selects a zone for you (recommended)"
|
17
|
+
def create
|
18
|
+
create_ec2_object
|
19
|
+
@ec2.create options
|
20
|
+
end
|
21
|
+
|
22
|
+
desc "delete", "Delete a subnet"
|
23
|
+
method_option :subnet_id, :aliases => "-s", :type => :string, :required => true, :desc => "The ID of the subnet you want to delete"
|
24
|
+
def delete
|
25
|
+
create_ec2_object
|
26
|
+
@ec2.delete options[:subnet_id]
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def create_ec2_object
|
32
|
+
puts "ec2 Establishing Connetion..."
|
33
|
+
$ec2_conn = Awscli::Connection.new.request_ec2
|
34
|
+
puts "ec2 Establishing Connetion... OK"
|
35
|
+
@ec2 = Awscli::EC2::Subnet.new($ec2_conn)
|
36
|
+
end
|
37
|
+
|
38
|
+
AwsCli::CLI::Ec2.register AwsCli::CLI::EC2::Subnet, :subnet, 'subnet [COMMAND]', 'EC2 Subnet Management'
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module AwsCli
|
2
|
+
module CLI
|
3
|
+
module EC2
|
4
|
+
require 'awscli/cli/ec2'
|
5
|
+
class Tags < Thor
|
6
|
+
|
7
|
+
desc "list", "List tags"
|
8
|
+
def list
|
9
|
+
create_ec2_object
|
10
|
+
@ec2.list
|
11
|
+
end
|
12
|
+
|
13
|
+
desc "create", "Create tag"
|
14
|
+
method_option :key, :aliases => "-k", :required => true, :type => :string, :desc => "key for the tag"
|
15
|
+
method_option :resource_id, :aliases => "-r", :required => true, :banner => "RID", :type => :string, :desc => "ID of a resource to tag. For example, ami-1a2b3c4d"
|
16
|
+
method_option :value, :aliases => "-v", :required => true, :type => :string, :desc => "Value for a tag. If you don't want the tag to have a value, specify the parameter with no value"
|
17
|
+
def create
|
18
|
+
create_ec2_object
|
19
|
+
@ec2.create options
|
20
|
+
end
|
21
|
+
|
22
|
+
desc "delete", "Deletes a specific set of tags from a specific set of resources"
|
23
|
+
method_option :key, :aliases => "-k", :required => true, :type => :string, :desc => "key for the tag"
|
24
|
+
method_option :resource_id, :aliases => "-r", :required => true, :banner => "RID", :type => :string, :desc => "ID of a resource to tag. For example, ami-1a2b3c4d"
|
25
|
+
method_option :value, :aliases => "-v", :required => true, :type => :string, :desc => "Value for a tag. If you don't want the tag to have a value, specify the parameter with no value"
|
26
|
+
def delete
|
27
|
+
create_ec2_object
|
28
|
+
@ec2.delete options
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def create_ec2_object
|
34
|
+
puts "ec2 Establishing Connetion..."
|
35
|
+
$ec2_conn = Awscli::Connection.new.request_ec2
|
36
|
+
puts "ec2 Establishing Connetion... OK"
|
37
|
+
@ec2 = Awscli::EC2::Tags.new($ec2_conn)
|
38
|
+
end
|
39
|
+
|
40
|
+
AwsCli::CLI::Ec2.register AwsCli::CLI::EC2::Tags, :tags, 'tags [COMMAND]', 'EC2 Tags Management'
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module AwsCli
|
2
|
+
module CLI
|
3
|
+
module EC2
|
4
|
+
require 'awscli/cli/ec2'
|
5
|
+
class VmManagement < Thor
|
6
|
+
|
7
|
+
desc "list", "List Images"
|
8
|
+
def list
|
9
|
+
puts "Listing Images"
|
10
|
+
end
|
11
|
+
|
12
|
+
AwsCli::CLI::Ec2.register AwsCli::CLI::EC2::VmManagement, :vm, 'vm [COMMAND]', 'EC2 VM Management'
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|