Class | AWS::EC2::Instance |
In: |
lib/aws/ec2/instance.rb
|
Parent: | Resource |
Represents an EC2 instance.
@attr [String] user_data 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"
@attr [String] instance_type The instance type,
e.g. "m1.small". The instance must be in a stopped state to change the instance type.
@attr [Boolean] api_termination_disabled True if the instance
cannot be terminated using the {#terminate} method. This attribute can be changed at any time.
@attr [String] instance_initiated_shutdown_behavior 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.
@attr_reader [String] image_id Image ID of the AMI used to
launch the instance.
@attr_reader [String] key_name The name of the key pair with
which this instance was associated at launch.
@attr [String] kernel_id The ID of the kernel that the image
currently uses. The instance must be in a stopped state to change this attribute.
@attr [String] ramdisk_id The ID of the RAM disk that the
image currently uses. The instance must be in a stopped state to change this attribute.
@attr_reader [Symbol] root_device_type 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+
@attr_reader [String] root_device_name The name of the root
device.
@attr_reader [String] private_dns_name The DNS name of the
instance within the EC2 network.
@attr_reader [String] dns_name The DNS name of the instance on
the internet.
@attr_reader [Integer] ami_launch_index The AMI launch index,
which can be used to find this instance within the launch group.
@attr_reader [String] private_ip_address The private IP
address assigned to the instance.
@attr_reader [String] ip_address The IP address of the
instance.
@attr_reader [Symbol] status The instance status. Valid values are:
* +:pending+ * +:running+ * +:shutting_down+ * +:terminated+ * +:stopping+ * +:stopped+
@attr_reader [Integer] status_code The numeric instance status code.
@attr_reader [Symbol] architecture The architecture of the
image.
@attr_reader [Symbol] virtualization_type The instance‘s
virtualization type. Valid values: * +:paravirtual+ * +:hvm+
@attr_reader [String] reservation_id The ID of the reservation
in which this instance was launched.
@attr_reader [String] requester_id ID of the requester that
launched the instance on your behalf (e.g., AWS Management Console, Auto Scaling).
@attr_reader [String] owner_id ID of the AWS account that owns
the reservation in which the instance was launched.
@attr_reader [Symbol] monitoring The status of CloudWatch
monitoring for the instance. Valid values: * +:enabled+ * +:disabled+ * +:pending+
@attr_reader [String] state_transition_reason A string
describing the reason for the last state transition.
@attr_reader [Time] launch_time The time at which the instance
was launched.
@attr_reader [String] platform A string describing the
platform of the image (e.g. "windows").
@attr_reader [Symbol] hypervisor The instance‘s hypervisor
type. Valid values: * +:ovm+ * +:xen+
@attr_reader [String] client_token Idempotency token you
provided when you launched the instance.
@attr_reader [String,nil] vpc_id Instances launched in a VPC have
a vpc_id. Normal EC2 instances return nil.
@attr_reader [String,nil] subnet_id Instances launched in a VPC have
a subnet_id. Normal EC2 instances return nil.
id | -> | instance_id |
dns_name | -> | public_dns_name |
ip_address | -> | public_ip_address |
source_dest_check | -> | source_dest_check? |
id | [R] | @return [String] Returns the instance id. |
Creates an object that represents the instance with the given ID. It‘s usually easier to get an instance of this class by calling {InstanceCollection#[]} or {InstanceCollection#each}.
Associates the elastic IP address with this instance.
@overload associate_elastic_ip(elastic_ip)
@param [ElasticIp,String] elastic_ip An Elastic ip address (VPC or non-VPC) or a public ip address string (non-VPC only).
@overload associate_elastic_ip(allocation_id)
@param [String] allocation_id The allocation id of a VPC elastic ip address.
@return [nil]
Attaches a network interface to this instance (VPC only).
@param [NetworkInterface,String] network_interface A network interface
(or network interface id string) to attach to this vpc instance.
@param [Hash] options
@option (see NetworkInterface#attach)
@return [nil]
@return [Hash<String,Attachment>] Returns a hash of device mappings.
The keys are device name strings (e.g. '/dev/sda') and the values are {Attachment} objects.
Creates an AMI from this instance.
@param [String] name A name for the new image you‘re
creating. Constraints: 3-128 alphanumeric characters, parenthesis (()), commas (,), slashes (/), dashes (-), or underscores(_)
@param [Hash] options Additional options for creating the
image.
@option options [String] :description A description of the
new image.
@option options [Boolean] :no_reboot By default this
option is set to +false+, which means Amazon EC2 attempts to cleanly shut down the instance before image creation and reboots the instance afterwards. When the option is set to +true+, Amazon EC2 does not shut down the instance before creating the image. When this option is used, file system integrity on the created image cannot be guaranteed.
@return [Boolean] Returns true if the instance has dedicated tenancy.
This will be false for all non-VPC instances. Dedicated Tenancy comes at extra cost.
Disassociates an attached elastic IP address from this instance. Raises an exception if there is no elastic IP address associated with this instance.
@return [ElasticIp,nil] Returns an elastic IP address if one
is associated with this instance, nil otherwise.
@return [Boolean] Returns true if an elastic IP address is
associated with this instance, false otherwise.
Enables or disables monitoring for this instance. @param [Boolean] state A true or false value. Enables monintoring
for a true value, disables it for a false value.
@return [Array<NetworkInterface>] Returns a list of elastic network
interfaces attached to this instance (VPC only). Non-vpc instance may not have attached network interfaces.
@return [Array<SecurityGroup>] Returns a list of security
groups the instance belongs to.