Class: AWS::EC2::Instance
- Inherits:
-
Resource
- Object
- Core::Resource
- Resource
- AWS::EC2::Instance
- Includes:
- TaggedItem
- Defined in:
- lib/aws/ec2/instance.rb
Overview
Represents an EC2 instance.
Instance Attribute Summary collapse
-
#ami_launch_index ⇒ Integer
readonly
The AMI launch index, which can be used to find this instance within the launch group.
-
#api_termination_disabled ⇒ Boolean
True if the instance cannot be terminated using the #terminate method.
-
#architecture ⇒ Symbol
readonly
The architecture of the image.
-
#client_token ⇒ String
readonly
Idempotency token you provided when you launched the instance.
-
#dns_name ⇒ String
(also: #public_dns_name)
readonly
The DNS name of the instance on the internet.
-
#ebs_optimized ⇒ Boolean
The instance must be in a stopped state to change the ebs_optimized state.
-
#hypervisor ⇒ Symbol
readonly
The instance’s hypervisor type.
-
#iam_instance_profile_arn ⇒ String?
readonly
The current value of iam_instance_profile_arn.
-
#iam_instance_profile_id ⇒ String?
readonly
The current value of iam_instance_profile_id.
-
#id ⇒ String
(also: #instance_id)
readonly
Returns the instance id.
-
#image_id ⇒ String
readonly
Image ID of the AMI used to launch the instance.
-
#instance_initiated_shutdown_behavior ⇒ String
Valid values are:.
-
#instance_type ⇒ String
The instance type, e.g.
-
#ip_address ⇒ String
(also: #public_ip_address)
readonly
The IP address of the instance.
-
#kernel_id ⇒ String
The ID of the kernel that the image currently uses.
-
#key_name ⇒ String
readonly
The name of the key pair with which this instance was associated at launch.
-
#launch_time ⇒ Time
readonly
The time at which the instance was launched.
-
#monitoring ⇒ Symbol
readonly
The status of CloudWatch monitoring for the instance.
-
#owner_id ⇒ String
readonly
ID of the AWS account that owns the reservation in which the instance was launched.
-
#platform ⇒ String
readonly
A string describing the platform of the image (e.g. “windows”).
-
#private_dns_name ⇒ String
readonly
The DNS name of the instance within the EC2 network.
-
#private_ip_address ⇒ String
readonly
The private IP address assigned to the instance.
-
#ramdisk_id ⇒ String
The ID of the RAM disk that the image currently uses.
-
#requester_id ⇒ String
readonly
ID of the requester that launched the instance on your behalf (e.g., AWS Management Console, Auto Scaling).
-
#reservation_id ⇒ String
readonly
The ID of the reservation in which this instance was launched.
-
#root_device_name ⇒ String
readonly
The name of the root device.
-
#root_device_type ⇒ Symbol
readonly
The root device type used by the AMI.
-
#state_transition_reason ⇒ String
readonly
A string describing the reason for the last state transition.
-
#status ⇒ Symbol
readonly
The instance status.
-
#status_code ⇒ Integer
readonly
The numeric instance status code.
-
#subnet_id ⇒ String?
readonly
Instances launched in a VPC have a subnet_id.
-
#user_data ⇒ String
Arbitrary metadata that is available to the instance while it is running.
-
#virtualization_type ⇒ Symbol
readonly
The instance’s virtualization type.
-
#vpc_id ⇒ String?
readonly
Instances launched in a VPC have a vpc_id.
Instance Method Summary collapse
-
#associate_elastic_ip(elastic_ip) ⇒ nil
(also: #ip_address=)
Associates the elastic IP address with this instance.
-
#attach_network_interface(network_interface, options = {}) ⇒ nil
Attaches a network interface to this instance (VPC only).
-
#attachments ⇒ Hash<String,Attachment>
(also: #block_device_mappings)
Returns a hash of attachments.
-
#availability_zone ⇒ String
The availability zone where the instance is running.
-
#block_devices ⇒ Array<Hash>
Returns a list of block device mappings.
-
#console_output ⇒ String
Retrieves the console output for the instance.
-
#create_image(name, options = {}) ⇒ Image
Creates an AMI from this instance.
-
#dedicated_tenancy? ⇒ Boolean
Returns true if the instance has dedicated tenancy.
-
#disable_monitoring ⇒ nil
Disables monitoring for this instance.
-
#disassociate_elastic_ip ⇒ Object
Disassociates an attached elastic IP address from this instance.
-
#elastic_ip ⇒ ElasticIp?
Returns an elastic IP address if one is associated with this instance, nil otherwise.
-
#enable_monitoring ⇒ nil
Enables monitoring for this instance.
-
#exists? ⇒ Boolean
Returns true if the instance exists according to EC2.
-
#export_to_s3(bucket, options = {}) ⇒ ExportTask
This produces an image of an EC2 instance for use in another virtualization environment and then writes the image to a S3 bucket.
-
#has_elastic_ip? ⇒ Boolean
Returns true if an elastic IP address is associated with this instance, false otherwise.
-
#image ⇒ Image
The AMI used to launch the instance.
-
#initialize(instance_id, opts = {}) ⇒ Instance
constructor
Creates an object that represents the instance with the given ID.
-
#key_pair ⇒ KeyPair
The key pair with which this instance was associated at launch.
-
#monitoring_enabled=(state) ⇒ Object
Enables or disables monitoring for this instance.
-
#monitoring_enabled? ⇒ Booelan
Returns
true
if CloudWatch monitoring is enabled for this instance. -
#network_interfaces ⇒ Array<NetworkInterface>
Returns a list of elastic network interfaces attached to this instance (VPC only).
-
#reboot ⇒ nil
Reboots the instance.
-
#reset_kernel_id ⇒ Object
Resets the kernel to its default value.
-
#reset_ramdisk_id ⇒ Object
Resets the RAM disk to its default value.
-
#security_groups ⇒ Array<SecurityGroup>
(also: #groups)
Returns a list of security groups the instance belongs to.
-
#spot_instance? ⇒ Boolean
True if the instance is a Spot instance.
-
#start ⇒ nil
Starts the instance, assuming it is in a stopped state.
-
#stop ⇒ nil
Stops the instance, eventually putting it into a stopped state.
-
#subnet ⇒ Subnet?
Returns the VPC subnet this instance was launched in.
-
#terminate ⇒ nil
(also: #delete)
Terminates the instance.
-
#vpc ⇒ VPC?
Returns the VPC this instance was launched in.
-
#vpc? ⇒ Boolean
Returns true if this is an EC2 VPC instance.
Methods included from TaggedItem
Constructor Details
#initialize(instance_id, opts = {}) ⇒ Instance
Creates an object that represents the instance with the given ID. It’s usually easier to get an instance of this class by calling AWS::EC2::InstanceCollection#[] or AWS::EC2::InstanceCollection#each.
162 163 164 165 |
# File 'lib/aws/ec2/instance.rb', line 162 def initialize(instance_id, opts = {}) super @id = instance_id end |
Instance Attribute Details
#ami_launch_index ⇒ Integer (readonly)
The AMI launch index, which can be used to find this instance within the launch group.
154 155 156 |
# File 'lib/aws/ec2/instance.rb', line 154 def ami_launch_index @ami_launch_index end |
#api_termination_disabled ⇒ Boolean
True if the instance cannot be terminated using the #terminate method. This attribute can be changed at any time.
154 155 156 |
# File 'lib/aws/ec2/instance.rb', line 154 def api_termination_disabled @api_termination_disabled end |
#architecture ⇒ Symbol (readonly)
The architecture of the image.
154 155 156 |
# File 'lib/aws/ec2/instance.rb', line 154 def architecture @architecture end |
#client_token ⇒ String (readonly)
Idempotency token you provided when you launched the instance.
154 155 156 |
# File 'lib/aws/ec2/instance.rb', line 154 def client_token @client_token end |
#dns_name ⇒ String (readonly) Also known as: public_dns_name
The DNS name of the instance on the internet.
154 155 156 |
# File 'lib/aws/ec2/instance.rb', line 154 def dns_name @dns_name end |
#ebs_optimized ⇒ Boolean
The instance must be in a stopped state to change the ebs_optimized state.
154 155 156 |
# File 'lib/aws/ec2/instance.rb', line 154 def ebs_optimized @ebs_optimized end |
#hypervisor ⇒ Symbol (readonly)
The instance’s hypervisor type. Valid values:
-
:ovm
-
:xen
154 155 156 |
# File 'lib/aws/ec2/instance.rb', line 154 def hypervisor @hypervisor end |
#iam_instance_profile_arn ⇒ String? (readonly)
Returns the current value of iam_instance_profile_arn.
154 155 156 |
# File 'lib/aws/ec2/instance.rb', line 154 def iam_instance_profile_arn @iam_instance_profile_arn end |
#iam_instance_profile_id ⇒ String? (readonly)
Returns the current value of iam_instance_profile_id.
154 155 156 |
# File 'lib/aws/ec2/instance.rb', line 154 def iam_instance_profile_id @iam_instance_profile_id end |
#id ⇒ String (readonly) Also known as: instance_id
Returns the instance id.
168 169 170 |
# File 'lib/aws/ec2/instance.rb', line 168 def id @id end |
#image_id ⇒ String (readonly)
Image ID of the AMI used to launch the instance.
154 155 156 |
# File 'lib/aws/ec2/instance.rb', line 154 def image_id @image_id end |
#instance_initiated_shutdown_behavior ⇒ String
Valid values are:
- “stop”
-
When the instance shuts down, it will go into a “stopped” state.
- “terminate”
-
When the instance shuts down, it will be terminated.
154 155 156 |
# File 'lib/aws/ec2/instance.rb', line 154 def instance_initiated_shutdown_behavior @instance_initiated_shutdown_behavior end |
#instance_type ⇒ String
The instance type, e.g. “m1.small”. The instance must be in a stopped state to change the instance type.
154 155 156 |
# File 'lib/aws/ec2/instance.rb', line 154 def instance_type @instance_type end |
#ip_address ⇒ String (readonly) Also known as: public_ip_address
The IP address of the instance.
154 155 156 |
# File 'lib/aws/ec2/instance.rb', line 154 def ip_address @ip_address end |
#kernel_id ⇒ String
The ID of the kernel that the image currently uses. The instance must be in a stopped state to change this attribute.
154 155 156 |
# File 'lib/aws/ec2/instance.rb', line 154 def kernel_id @kernel_id end |
#key_name ⇒ String (readonly)
The name of the key pair with which this instance was associated at launch.
154 155 156 |
# File 'lib/aws/ec2/instance.rb', line 154 def key_name @key_name end |
#launch_time ⇒ Time (readonly)
The time at which the instance was launched.
154 155 156 |
# File 'lib/aws/ec2/instance.rb', line 154 def launch_time @launch_time end |
#monitoring ⇒ Symbol (readonly)
The status of CloudWatch monitoring for the instance. Valid values:
-
:enabled
-
:disabled
-
:pending
154 155 156 |
# File 'lib/aws/ec2/instance.rb', line 154 def monitoring @monitoring end |
#owner_id ⇒ String (readonly)
ID of the AWS account that owns the reservation in which the instance was launched.
154 155 156 |
# File 'lib/aws/ec2/instance.rb', line 154 def owner_id @owner_id end |
#platform ⇒ String (readonly)
A string describing the platform of the image (e.g. “windows”).
154 155 156 |
# File 'lib/aws/ec2/instance.rb', line 154 def platform @platform end |
#private_dns_name ⇒ String (readonly)
The DNS name of the instance within the EC2 network.
154 155 156 |
# File 'lib/aws/ec2/instance.rb', line 154 def private_dns_name @private_dns_name end |
#private_ip_address ⇒ String (readonly)
The private IP address assigned to the instance.
154 155 156 |
# File 'lib/aws/ec2/instance.rb', line 154 def private_ip_address @private_ip_address end |
#ramdisk_id ⇒ String
The ID of the RAM disk that the image currently uses. The instance must be in a stopped state to change this attribute.
154 155 156 |
# File 'lib/aws/ec2/instance.rb', line 154 def ramdisk_id @ramdisk_id end |
#requester_id ⇒ String (readonly)
ID of the requester that launched the instance on your behalf (e.g., AWS Management Console, Auto Scaling).
154 155 156 |
# File 'lib/aws/ec2/instance.rb', line 154 def requester_id @requester_id end |
#reservation_id ⇒ String (readonly)
The ID of the reservation in which this instance was launched.
154 155 156 |
# File 'lib/aws/ec2/instance.rb', line 154 def reservation_id @reservation_id end |
#root_device_name ⇒ String (readonly)
The name of the root device.
154 155 156 |
# File 'lib/aws/ec2/instance.rb', line 154 def root_device_name @root_device_name end |
#root_device_type ⇒ Symbol (readonly)
The root device type used by the AMI. The AMI can use an Amazon EBS or instance store root device. Valid values:
-
:ebs
-
:instance_store
154 155 156 |
# File 'lib/aws/ec2/instance.rb', line 154 def root_device_type @root_device_type end |
#state_transition_reason ⇒ String (readonly)
A string describing the reason for the last state transition.
154 155 156 |
# File 'lib/aws/ec2/instance.rb', line 154 def state_transition_reason @state_transition_reason end |
#status ⇒ Symbol (readonly)
The instance status. Valid values are:
-
:pending
-
:running
-
:shutting_down
-
:terminated
-
:stopping
-
:stopped
154 155 156 |
# File 'lib/aws/ec2/instance.rb', line 154 def status @status end |
#status_code ⇒ Integer (readonly)
The numeric instance status code.
154 155 156 |
# File 'lib/aws/ec2/instance.rb', line 154 def status_code @status_code end |
#subnet_id ⇒ String? (readonly)
Instances launched in a VPC have a subnet_id. Normal EC2 instances return nil.
154 155 156 |
# File 'lib/aws/ec2/instance.rb', line 154 def subnet_id @subnet_id end |
#user_data ⇒ String
Arbitrary metadata that is available to the instance while it is running. This interface handles the details of encoding the user data for transmission; you should set the user data exactly as you want it to be made available to the instance.
The instance must be in a stopped state to change user data; for example:
i.user_data # => "HELLO"
i.status # => :running
i.user_data = "GOODBYE" # raises an exception
i.stop; sleep 1 until i.status == :stopped
i.user_data = "GOODBYE" # => "GOODBYE"
154 155 156 |
# File 'lib/aws/ec2/instance.rb', line 154 def user_data @user_data end |
#virtualization_type ⇒ Symbol (readonly)
The instance’s virtualization type. Valid values:
-
:paravirtual
-
:hvm
154 155 156 |
# File 'lib/aws/ec2/instance.rb', line 154 def virtualization_type @virtualization_type end |
#vpc_id ⇒ String? (readonly)
Instances launched in a VPC have a vpc_id. Normal EC2 instances return nil.
154 155 156 |
# File 'lib/aws/ec2/instance.rb', line 154 def vpc_id @vpc_id end |
Instance Method Details
#associate_elastic_ip(elastic_ip) ⇒ nil #associate_elastic_ip(allocation_id) ⇒ nil Also known as: ip_address=
Associates the elastic IP address with this instance.
594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 |
# File 'lib/aws/ec2/instance.rb', line 594 def associate_elastic_ip elastic_ip client_opts = {} client_opts[:instance_id] = self.id if vpc? client_opts[:allocation_id] = elastic_ip.is_a?(ElasticIp) ? elastic_ip.allocation_id : elastic_ip.to_s else client_opts[:public_ip] = elastic_ip.to_s end client.associate_address(client_opts) nil end |
#attach_network_interface(network_interface, options = {}) ⇒ nil
Attaches a network interface to this instance (VPC only).
422 423 424 425 426 427 428 429 430 |
# File 'lib/aws/ec2/instance.rb', line 422 def attach_network_interface network_interface, = {} if network_interface.is_a?(NetworkInterface) network_interface.attach(self, ) else i = NetworkInterface.new(network_interface, :config => config) i.attach(self, ) end nil end |
#attachments ⇒ Hash<String,Attachment> Also known as: block_device_mappings
This method will not return data for ephemeral volumes.
Returns a hash of attachments. The keys are device name strings (e.g. ‘/dev/sda’) and the values are Attachment objects.
446 447 448 449 450 451 452 453 454 455 456 |
# File 'lib/aws/ec2/instance.rb', line 446 def (block_device_mapping || []).inject({}) do |m, mapping| if mapping[:ebs] device = mapping[:device_name] volume = Volume.new(mapping[:ebs][:volume_id], :config => config) = Attachment.new(volume, self, device, :config => config) m[device] = end m end end |
#availability_zone ⇒ String
Returns The availability zone where the instance is running.
518 519 520 521 522 |
# File 'lib/aws/ec2/instance.rb', line 518 def availability_zone if p = placement p.availability_zone end end |
#block_devices ⇒ Array<Hash>
Returns a list of block device mappings.
instance.block_devices
#=>
[
{
:device_name => "/dev/sda2",
:ebs => {
:volume_id => "vol-123",
:status => "attaching",
:attach_time => time,
:delete_on_termination => true
}
}, {
:device_name => "/dev/sdb",
:virtual_name => "ephemeral0",
}
]
480 481 482 |
# File 'lib/aws/ec2/instance.rb', line 480 def block_devices block_device_mapping.to_a end |
#console_output ⇒ String
Retrieves the console output for the instance.
577 578 579 580 |
# File 'lib/aws/ec2/instance.rb', line 577 def console_output output = client.get_console_output(:instance_id => self.id).output Base64.decode64(output) if output end |
#create_image(name, options = {}) ⇒ Image
Creates an AMI from this instance.
569 570 571 572 |
# File 'lib/aws/ec2/instance.rb', line 569 def create_image name, = {} images = ImageCollection.new(:config => config) images.create(.merge(:instance_id => id, :name => name)) end |
#dedicated_tenancy? ⇒ Boolean
Returns true if the instance has dedicated tenancy. This will be false for all non-VPC instances. Dedicated Tenancy comes at extra cost.
527 528 529 530 531 532 533 |
# File 'lib/aws/ec2/instance.rb', line 527 def dedicated_tenancy? if p = placement p.tenancy == 'dedicated' else false end end |
#disable_monitoring ⇒ nil
Disables monitoring for this instance.
493 494 495 496 |
# File 'lib/aws/ec2/instance.rb', line 493 def disable_monitoring client.unmonitor_instances(:instance_ids => [id]) nil end |
#disassociate_elastic_ip ⇒ Object
Disassociates an attached elastic IP address from this instance. Raises an exception if there is no elastic IP address associated with this instance.
617 618 619 620 621 622 623 |
# File 'lib/aws/ec2/instance.rb', line 617 def disassociate_elastic_ip if ip = self.elastic_ip ip.disassociate else raise "instance #{id} does not have an associated elastic ip" end end |
#elastic_ip ⇒ ElasticIp?
Returns an elastic IP address if one is associated with this instance, nil otherwise.
627 628 629 630 |
# File 'lib/aws/ec2/instance.rb', line 627 def elastic_ip ips = ElasticIpCollection.new(:config => config) ips.filter('instance-id', id).first end |
#enable_monitoring ⇒ nil
Enables monitoring for this instance.
486 487 488 489 |
# File 'lib/aws/ec2/instance.rb', line 486 def enable_monitoring client.monitor_instances(:instance_ids => [id]) nil end |
#exists? ⇒ Boolean
Returns true if the instance exists according to EC2.
640 641 642 643 644 |
# File 'lib/aws/ec2/instance.rb', line 640 def exists? client.describe_instances(:filters => [ { :name => "instance-id", :values => [id] } ]).instance_index.key?(id) end |
#export_to_s3(bucket, options = {}) ⇒ ExportTask
This produces an image of an EC2 instance for use in another virtualization environment and then writes the image to a S3 bucket.
Granting EC2 write access to your bucket
Before you can export an image to an S3 bucket, you must modify the bucket ACL. You only need to do this once per bucket.
s3.buckets['bucket-name'].acl.change do |acl|
acl.grant(:read_acp).to(:amazon_customer_email => '[email protected]')
acl.grant(:write).to(:amazon_customer_email => '[email protected]')
end
Performing the export
Simply call #export_to_s3 on your instance. Only instances derived from your own ImportInstance tasks may be exported.
task = ec2.instances['i-12345678'].export_to_s3('bucket-name')
Downloading the results
Given a completed export task you can download the final image:
File.open('image.ova', 'w') {|f| f.write(task.s3_object.read) }
741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 |
# File 'lib/aws/ec2/instance.rb', line 741 def export_to_s3 bucket, = {} bucket_name = bucket.is_a?(S3::Bucket) ? bucket.name : bucket.to_s opts = {} opts[:instance_id] = instance_id opts[:description] = [:description] if [:description] opts[:target_environment] = [:target_environment] || 'vmware' opts[:export_to_s3] = {} opts[:export_to_s3][:s3_bucket] = bucket_name [:disk_image_format, :container_format, :s3_prefix].each do |opt| opts[:export_to_s3][opt] = [opt] if .key?(opt) end resp = client.create_instance_export_task(opts) ExportTask.new_from( :create_instance_export_task, resp[:export_task], resp[:export_task][:export_task_id], :config => config) end |
#has_elastic_ip? ⇒ Boolean
Returns true if an elastic IP address is associated with this instance, false otherwise.
634 635 636 |
# File 'lib/aws/ec2/instance.rb', line 634 def has_elastic_ip? !elastic_ip.nil? end |
#image ⇒ Image
Returns The AMI used to launch the instance.
536 537 538 |
# File 'lib/aws/ec2/instance.rb', line 536 def image Image.new(image_id, :config => config) end |
#key_pair ⇒ KeyPair
Returns The key pair with which this instance was associated at launch.
542 543 544 |
# File 'lib/aws/ec2/instance.rb', line 542 def key_pair KeyPair.new(key_name, :config => config) if key_name end |
#monitoring_enabled=(state) ⇒ Object
Enables or disables monitoring for this instance.
501 502 503 |
# File 'lib/aws/ec2/instance.rb', line 501 def monitoring_enabled= state state ? enable_monitoring : disable_monitoring end |
#monitoring_enabled? ⇒ Booelan
Returns true
if CloudWatch monitoring is enabled for this instance.
507 508 509 |
# File 'lib/aws/ec2/instance.rb', line 507 def monitoring_enabled? monitoring == :enabled end |
#network_interfaces ⇒ Array<NetworkInterface>
Returns a list of elastic network interfaces attached to this instance (VPC only). Non-vpc instance may not have attached network interfaces.
404 405 406 407 408 409 |
# File 'lib/aws/ec2/instance.rb', line 404 def network_interfaces network_interface_set.collect do |ni| NetworkInterface.new_from(:describe_network_interfaces, ni, ni.network_interface_id, :config => config) end end |
#reboot ⇒ nil
Reboots the instance.
667 668 669 |
# File 'lib/aws/ec2/instance.rb', line 667 def reboot instance_action :reboot end |
#reset_kernel_id ⇒ Object
Resets the kernel to its default value.
647 648 649 650 |
# File 'lib/aws/ec2/instance.rb', line 647 def reset_kernel_id client.reset_instance_attribute( :instance_id => id, :attribute => "kernel").return end |
#reset_ramdisk_id ⇒ Object
Resets the RAM disk to its default value.
653 654 655 656 |
# File 'lib/aws/ec2/instance.rb', line 653 def reset_ramdisk_id client.reset_instance_attribute( :instance_id => id, :attribute => "ramdisk").return end |
#security_groups ⇒ Array<SecurityGroup> Also known as: groups
Returns a list of security groups the instance belongs to.
434 435 436 437 438 |
# File 'lib/aws/ec2/instance.rb', line 434 def security_groups (group_set || []).collect do |g| SecurityGroup.new(g.group_id, :name => g.group_name, :config => config) end end |
#spot_instance? ⇒ Boolean
Returns true if the instance is a Spot instance.
512 513 514 |
# File 'lib/aws/ec2/instance.rb', line 512 def spot_instance? instance_lifecycle == :spot end |
#start ⇒ nil
Starts the instance, assuming it is in a stopped state.
674 675 676 |
# File 'lib/aws/ec2/instance.rb', line 674 def start instance_action :start end |
#stop ⇒ nil
Stops the instance, eventually putting it into a stopped state.
680 681 682 |
# File 'lib/aws/ec2/instance.rb', line 680 def stop instance_action :stop end |
#subnet ⇒ Subnet?
Returns the VPC subnet this instance was launched in. Returns nil if this was not launched in a VPC.
395 396 397 398 399 |
# File 'lib/aws/ec2/instance.rb', line 395 def subnet if subnet_id Subnet.new(subnet_id, :vpc_id => vpc_id, :config => config) end end |
#terminate ⇒ nil Also known as: delete
Terminates the instance.
660 661 662 |
# File 'lib/aws/ec2/instance.rb', line 660 def terminate instance_action :terminate end |
#vpc ⇒ VPC?
Returns the VPC this instance was launched in. If this instance was not launched inside a VPC, nil is returned.
387 388 389 390 391 |
# File 'lib/aws/ec2/instance.rb', line 387 def vpc if vpc_id VPC.new(vpc_id, :config => config) end end |
#vpc? ⇒ Boolean
Returns true if this is an EC2 VPC instance.
381 382 383 |
# File 'lib/aws/ec2/instance.rb', line 381 def vpc? !!vpc_id end |