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 associated with the instance.

Returns:

  • (String)

    The name of the Auto Scaling group associated with 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 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.

#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.

#lifecycle_stateString (readonly)

The lifecycle state for the instance. For more information, see Auto Scaling Lifecycle in the Auto Scaling User Guide.

Returns:

  • (String)

    The lifecycle state for the instance.

#protected_from_scale_inBoolean (readonly)

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

Returns:

  • (Boolean)

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

Instance Method Details

#attachStruct

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

When you attach instances, 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 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)

    If True, 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)

    Specifies whether the instances moved to Standby mode count as part of the Auto Scaling group\'s desired capacity. If set, the desired capacity for the Auto Scaling group decrements 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 in the 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 if you want the instance to remain in service. Set to Unhealthy if you want the instance to be out of service. Auto Scaling will terminate and replace 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 will respect the grace period. Set this to False, if you do not want the call to respect the grace period associated with the group.

    For more information, see the description of the health check grace period for CreateAutoScalingGroup.

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)

    If true, terminating the instance also decrements the size of the Auto Scaling group.

Returns:

See Also: