Class: Stax::Aws::Ec2
Constant Summary
Constants inherited from Sdk
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
9 10 11 |
# File 'lib/stax/aws/ec2.rb', line 9 def client @_client ||= ::Aws::EC2::Client.new end |
.create_tags(opt) ⇒ Object
tag AMIs
27 28 29 |
# File 'lib/stax/aws/ec2.rb', line 27 def (opt) client.(opt) end |
.images(opt = {}) ⇒ Object
list AMIs
22 23 24 |
# File 'lib/stax/aws/ec2.rb', line 22 def images(opt = {}) client.describe_images(opt).images.sort_by(&:creation_date) end |
.instances(name) ⇒ Object
return instances tagged by stack with name
14 15 16 17 18 19 |
# File 'lib/stax/aws/ec2.rb', line 14 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 |