You are viewing documentation for version 2 of the AWS SDK for Ruby. Version 3 documentation can be found here.

Class: Aws::AutoScaling::Instance

Inherits:
Resources::Resource show all
Defined in:
(unknown)

Instance Attribute Summary collapse

Attributes inherited from Resources::Resource

#client, #identifiers

Instance Method Summary collapse

Methods inherited from Resources::Resource

add_data_attribute, add_identifier, #data, data_attributes, #data_loaded?, identifiers, #load, #wait_until

Methods included from Resources::OperationMethods

#add_batch_operation, #add_operation, #batch_operation, #batch_operation_names, #batch_operations, #operation, #operation_names, #operations

Constructor Details

#initialize(group_name, id, options = {}) ⇒ Object #initialize(options = {}) ⇒ Object

Overloads:

  • #initialize(group_name, id, options = {}) ⇒ Object

    Parameters:

    • group_name (String)
    • id (String)

    Options Hash (options):

    • :client (Client)

      When `:client is not given, the options hash is used to construct a new Client object.

  • #initialize(options = {}) ⇒ Object

    Options Hash (options):

    • :group_name (required, String)
    • :id (required, String)
    • :client (Client)

      When `:client is not given, the options hash is used to construct a new Client object.

Instance Attribute Details

#auto_scaling_group_nameString (readonly)

The name of the Auto Scaling group for the instance.

Returns:

  • (String)

    The name of the Auto Scaling group for the instance.

#availability_zoneString (readonly)

The Availability Zone for the instance.

Returns:

  • (String)

    The Availability Zone for the instance.

#group_nameString (readonly)

Returns:

  • (String)

#health_statusString (readonly)

The last reported health status of this instance. \"Healthy\" means that the instance is healthy and should remain in service. \"Unhealthy\" means that the instance is unhealthy and Amazon EC2 Auto Scaling should terminate and replace it.

Returns:

  • (String)

    The last reported health status of this instance.

#idString (readonly)

Returns:

  • (String)

#instance_idString (readonly)

The ID of the instance.

Returns:

  • (String)

    The ID of the instance.

#instance_typeString (readonly)

The instance type of the EC2 instance.

Returns:

  • (String)

    The instance type of the EC2 instance.

#launch_configuration_nameString (readonly)

The launch configuration used to launch the instance. This value is not available if you attached the instance to the Auto Scaling group.

Returns:

  • (String)

    The launch configuration used to launch the instance.

#launch_templateTypes::LaunchTemplateSpecification (readonly)

The launch template for the instance.

Returns:

#lifecycle_stateString (readonly)

The lifecycle state for the instance.

Returns:

  • (String)

    The lifecycle state for the instance.

#protected_from_scale_inBoolean (readonly)

Indicates whether the instance is protected from termination by Amazon EC2 Auto Scaling when scaling in.

Returns:

  • (Boolean)

    Indicates whether the instance is protected from termination by Amazon EC2 Auto Scaling when scaling in.

#weighted_capacityString (readonly)

The number of capacity units contributed by the instance based on its instance type.

Valid Range: Minimum value of 1. Maximum value of 999.

Returns:

  • (String)

    The number of capacity units contributed by the instance based on its instance type.

Instance Method Details

#attachStruct

Attaches one or more EC2 instances to the specified Auto Scaling group.

When you attach instances, Amazon EC2 Auto Scaling increases the desired capacity of the group by the number of instances being attached. If the number of instances being attached plus the desired capacity of the group exceeds the maximum size of the group, the operation fails.

If there is a Classic Load Balancer attached to your Auto Scaling group, the instances are also registered with the load balancer. If there are target groups attached to your Auto Scaling group, the instances are also registered with the target groups.

For more information, see Attach EC2 instances to your Auto Scaling group in the Amazon EC2 Auto Scaling User Guide.

Examples:

Request syntax example with placeholder values


instance.attach()

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#detach(options = {}) ⇒ Array<Activity>

Examples:

Request syntax example with placeholder values


instance.detach({
  should_decrement_desired_capacity: false, # required
})

Basic usage

activitys = instance.detach(options)
activitys.map(&:id)
#=> ["activity-id", ...]

Options Hash (options):

  • :should_decrement_desired_capacity (required, Boolean)

    Indicates whether the Auto Scaling group decrements the desired capacity value by the number of instances detached.

Returns:

See Also:

#enter_standby(options = {}) ⇒ Array<Activity>

Examples:

Request syntax example with placeholder values


instance.enter_standby({
  should_decrement_desired_capacity: false, # required
})

Basic usage

activitys = instance.enter_standby(options)
activitys.map(&:id)
#=> ["activity-id", ...]

Options Hash (options):

  • :should_decrement_desired_capacity (required, Boolean)

    Indicates whether to decrement the desired capacity of the Auto Scaling group by the number of instances moved to Standby mode.

Returns:

See Also:

#exit_standbyArray<Activity>

Examples:

Request syntax example with placeholder values


instance.exit_standby()

Basic usage

activitys = instance.exit_standby(options)
activitys.map(&:id)
#=> ["activity-id", ...]

Returns:

See Also:

#groupAutoScalingGroup

Returns:

#launch_configurationLaunchConfiguration?

Returns:

#set_health(options = {}) ⇒ Struct

Sets the health status of the specified instance.

For more information, see Health checks for Auto Scaling instances in the Amazon EC2 Auto Scaling User Guide.

Examples:

Request syntax example with placeholder values


instance.set_health({
  health_status: "XmlStringMaxLen32", # required
  should_respect_grace_period: false,
})

Options Hash (options):

  • :health_status (required, String)

    The health status of the instance. Set to Healthy to have the instance remain in service. Set to Unhealthy to have the instance be out of service. Amazon EC2 Auto Scaling terminates and replaces the unhealthy instance.

  • :should_respect_grace_period (Boolean)

    If the Auto Scaling group of the specified instance has a HealthCheckGracePeriod specified for the group, by default, this call respects the grace period. Set this to False, to have the call not respect the grace period associated with the group.

    For more information about the health check grace period, see CreateAutoScalingGroup in the Amazon EC2 Auto Scaling API Reference.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#terminate(options = {}) ⇒ Activity

Examples:

Request syntax example with placeholder values


instance.terminate({
  should_decrement_desired_capacity: false, # required
})

Basic usage

activity = instance.terminate(options)
activity.id
#=> "activity-id"

Options Hash (options):

  • :should_decrement_desired_capacity (required, Boolean)

    Indicates whether terminating the instance also decrements the size of the Auto Scaling group.

Returns:

See Also: