Created
September 2, 2015 23:15
-
-
Save anonymous/16f49735fd31e5e44f4e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(venv)[chef=dev] ip-192-168-224-36:slice-testbook doug$ cat -n test2.rb | |
1 #!/opt/chefdk/embedded/bin/ruby | |
2 | |
3 require 'aws-sdk' | |
4 | |
5 group_name = 'zookeeper-dev-1-ServerGroup-6NHGJDYWRANU' | |
6 stack_name = 'zookeeper-as-dev-2' | |
7 | |
8 ec2 = Aws::EC2::Resource.new(region: 'us-east-1', access_key_id: 'xxx', secret_access_key: 'yyy') | |
9 | |
10 client = Aws::AutoScaling::Client.new( | |
11 region: 'us-east-1', | |
12 access_key_id: 'xxx', | |
13 secret_access_key: 'yyy' | |
14 ) | |
15 | |
16 instances = client.describe_auto_scaling_groups({ auto_scaling_group_names: [group_name] }).data.auto_scaling_groups[0].instances | |
17 | |
18 foo = ec2.instances(filters: [{ instance_id: 'i-da717b08'}] ) | |
19 foo.each { |x| puts x } | |
20 | |
21 #foo.reservationSet.item.each do |r| | |
22 #r.instancesSet.item.each do |i| | |
23 #puts i | |
24 #end | |
25 #end | |
26 | |
27 #instances.each { |x| puts x.instance_id } | |
28 | |
29 #instanceis.sort_by {|_key, value| value} | |
(venv)[chef=dev] ip-192-168-224-36:slice-testbook doug$ | |
(venv)[chef=dev] ip-192-168-224-36:slice-testbook doug$ | |
(venv)[chef=dev] ip-192-168-224-36:slice-testbook doug$ | |
(venv)[chef=dev] ip-192-168-224-36:slice-testbook doug$ ./test2.rb | |
/Users/doug/.chefdk/gem/ruby/2.1.0/gems/aws-sdk-core-2.1.14/lib/seahorse/client/plugins/raise_response_errors.rb:15:in `call': The security token included in the request is invalid. (Aws::AutoScaling::Errors::InvalidClientTokenId) | |
from /Users/doug/.chefdk/gem/ruby/2.1.0/gems/aws-sdk-core-2.1.14/lib/aws-sdk-core/plugins/param_converter.rb:21:in `call' | |
from /Users/doug/.chefdk/gem/ruby/2.1.0/gems/aws-sdk-core-2.1.14/lib/aws-sdk-core/plugins/response_paging.rb:26:in `call' | |
from /Users/doug/.chefdk/gem/ruby/2.1.0/gems/aws-sdk-core-2.1.14/lib/seahorse/client/plugins/response_target.rb:21:in `call' | |
from /Users/doug/.chefdk/gem/ruby/2.1.0/gems/aws-sdk-core-2.1.14/lib/seahorse/client/request.rb:70:in `send_request' | |
from /Users/doug/.chefdk/gem/ruby/2.1.0/gems/aws-sdk-core-2.1.14/lib/seahorse/client/base.rb:207:in `block (2 levels) in define_operation_methods' | |
from ./test2.rb:16:in `<main>' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
for self reference