Class: Stax::Aws::Ec2
Class Method Summary collapse
- .client ⇒ Object
-
.create_tags(opt) ⇒ Object
tag AMIs.
-
.images(opt = {}) ⇒ Object
list AMIs.
-
.instances(name) ⇒ Object
return instances tagged by stack with name.
Methods inherited from Sdk
Class Method Details
.client ⇒ Object
7 8 9 |
# File 'lib/stax/aws/ec2.rb', line 7 def client @_client ||= ::Aws::EC2::Client.new end |
.create_tags(opt) ⇒ Object
tag AMIs
25 26 27 |
# File 'lib/stax/aws/ec2.rb', line 25 def (opt) client.(opt) end |
.images(opt = {}) ⇒ Object
list AMIs
20 21 22 |
# File 'lib/stax/aws/ec2.rb', line 20 def images(opt = {}) client.describe_images(opt).images.sort_by(&:creation_date) end |
.instances(name) ⇒ Object
return instances tagged by stack with name
12 13 14 15 16 17 |
# File 'lib/stax/aws/ec2.rb', line 12 def instances(name) filter = {name: 'tag:aws:cloudformation:stack-name', values: [name]} paginate(:reservations) do |token| client.describe_instances(filters: [filter], next_token: token) end.map(&:instances).flatten end |