Class: Akashi::Vpc::ElasticIp
- Defined in:
- lib/akashi/vpc/elastic_ip.rb
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Ec2::Base
Methods inherited from Base
all, base_class, collection, find, find_by, #initialize, object_class, where
Constructor Details
This class inherits a constructor from Akashi::Base
Class Method Details
.create ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/akashi/vpc/elastic_ip.rb', line 12 def create response = Akashi::Aws.ec2.client.allocate_address(domain: "vpc") new(response[:public_ip]).tap do |instance| puts "Created an Elastic IP (#{instance.public_ip})." end end |
Instance Method Details
#associate(instance:) ⇒ Object
6 7 8 9 |
# File 'lib/akashi/vpc/elastic_ip.rb', line 6 def associate(instance:) @object.associate(instance: instance.id) puts "An Elastic IP (#{public_ip}) associated with an EC2 Instance (#{instance.id})." end |