Class: Aws::AutoScaling::Instance
- Inherits:
-
Object
- Object
- Aws::AutoScaling::Instance
- Extended by:
- Deprecations
- Defined in:
- sig/instance.rbs,
lib/aws-sdk-autoscaling/instance.rb
Overview
Defined Under Namespace
Classes: Collection
Read-Only Attributes collapse
-
#availability_zone ⇒ String
The Availability Zone for the instance.
-
#availability_zone_id ⇒ String
The Availability Zone ID where the instance is located.
- #group_name ⇒ String (also: #auto_scaling_group_name)
-
#health_status ⇒ String
The last reported health status of this instance.
- #id ⇒ String (also: #instance_id)
-
#image_id ⇒ String
The ID of the Amazon Machine Image (AMI) associated with the instance.
-
#instance_type ⇒ String
The instance type of the EC2 instance.
-
#launch_configuration_name ⇒ String
The launch configuration used to launch the instance.
-
#launch_template ⇒ Types::LaunchTemplateSpecification
The launch template for the instance.
-
#lifecycle_state ⇒ String
The lifecycle state for the instance.
-
#protected_from_scale_in ⇒ Boolean
Indicates whether the instance is protected from termination by Amazon EC2 Auto Scaling when scaling in.
-
#weighted_capacity ⇒ String
The number of capacity units contributed by the instance based on its instance type.
Actions collapse
- #attach(options = {}) ⇒ EmptyStructure
- #detach(options = {}) ⇒ Activity::Collection
- #enter_standby(options = {}) ⇒ Activity::Collection
- #exit_standby(options = {}) ⇒ Activity::Collection
- #set_health(options = {}) ⇒ EmptyStructure
- #terminate(options = {}) ⇒ Activity
Associations collapse
- #group ⇒ AutoScalingGroup
- #identifiers ⇒ Object deprecated private Deprecated.
- #launch_configuration ⇒ LaunchConfiguration?
Instance Method Summary collapse
- #client ⇒ Client
-
#data ⇒ Types::AutoScalingInstanceDetails
Returns the data for this Instance.
-
#data_loaded? ⇒ Boolean
Returns
trueif this resource is loaded. -
#initialize(*args) ⇒ Instance
constructor
A new instance of Instance.
- #load ⇒ self (also: #reload)
-
#wait_until(options = {}) {|resource| ... } ⇒ Resource
deprecated
Deprecated.
Use [Aws::AutoScaling::Client] #wait_until instead
Constructor Details
#initialize(group_name, id, options = {}) ⇒ Instance #initialize(options = {}) ⇒ Instance
Returns a new instance of Instance.
13 14 15 |
# File 'sig/instance.rbs', line 13
def initialize: (String group_name, String id, Hash[Symbol, untyped] options) -> void
| (group_name: String, id: String, ?client: Client) -> void
| (Hash[Symbol, untyped] args) -> void
|
Instance Method Details
#attach(options = {}) ⇒ EmptyStructure
69 |
# File 'sig/instance.rbs', line 69
def attach: (
|
#availability_zone ⇒ String
The Availability Zone for the instance.
29 |
# File 'sig/instance.rbs', line 29
def availability_zone: () -> ::String
|
#availability_zone_id ⇒ String
The Availability Zone ID where the instance is located.
32 |
# File 'sig/instance.rbs', line 32
def availability_zone_id: () -> ::String
|
#client ⇒ Client
152 |
# File 'lib/aws-sdk-autoscaling/instance.rb', line 152
def client: () -> Client
|
#data ⇒ Types::AutoScalingInstanceDetails
Returns the data for this Aws::AutoScaling::Instance. Calls
Client#describe_auto_scaling_instances if #data_loaded? is false.
62 |
# File 'sig/instance.rbs', line 62
def data: () -> Types::AutoScalingInstanceDetails
|
#data_loaded? ⇒ Boolean
65 |
# File 'sig/instance.rbs', line 65
def data_loaded?: () -> bool
|
#enter_standby(options = {}) ⇒ Activity::Collection
80 |
# File 'sig/instance.rbs', line 80
def enter_standby: (
|
#exit_standby(options = {}) ⇒ Activity::Collection
86 |
# File 'sig/instance.rbs', line 86
def exit_standby: (
|
#group_name ⇒ String Also known as: auto_scaling_group_name
18 |
# File 'sig/instance.rbs', line 18
def group_name: () -> String
|
#health_status ⇒ String
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.
38 |
# File 'sig/instance.rbs', line 38
def health_status: () -> ::String
|
#id ⇒ String Also known as: instance_id
22 |
# File 'sig/instance.rbs', line 22
def id: () -> String
|
#identifiers ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
465 466 467 468 469 470 |
# File 'lib/aws-sdk-autoscaling/instance.rb', line 465 def identifiers { group_name: @group_name, id: @id } end |
#image_id ⇒ String
The ID of the Amazon Machine Image (AMI) associated with the instance. This field shows the current AMI ID of the instance's root volume. It may differ from the original AMI used when the instance was first launched.
This field appears for:
-
Instances with root volume replacements through Instance Refresh
-
Instances launched with AMI overrides
This field won't appear for:
-
Existing instances launched from Launch Templates without overrides
-
Existing instances that didn’t have their root volume replaced through Instance Refresh
47 |
# File 'sig/instance.rbs', line 47
def image_id: () -> ::String
|
#instance_type ⇒ String
The instance type of the EC2 instance.
26 |
# File 'sig/instance.rbs', line 26
def instance_type: () -> ::String
|
#launch_configuration ⇒ LaunchConfiguration?
107 |
# File 'sig/instance.rbs', line 107
def launch_configuration: () -> LaunchConfiguration?
|
#launch_configuration_name ⇒ String
The launch configuration used to launch the instance. This value is not available if you attached the instance to the Auto Scaling group.
41 |
# File 'sig/instance.rbs', line 41
def launch_configuration_name: () -> ::String
|
#launch_template ⇒ Types::LaunchTemplateSpecification
The launch template for the instance.
44 |
# File 'sig/instance.rbs', line 44
def launch_template: () -> Types::LaunchTemplateSpecification
|
#lifecycle_state ⇒ String
The lifecycle state for the instance. The Quarantined state is not
used. For more information, see Amazon EC2 Auto Scaling instance
lifecycle in the Amazon EC2 Auto Scaling User Guide.
Valid values: Pending | Pending:Wait | Pending:Proceed |
Quarantined | InService | Terminating | Terminating:Wait |
Terminating:Proceed | Terminating:Retained | Terminated |
Detaching | Detached | EnteringStandby | Standby |
ReplacingRootVolume | ReplacingRootVolume:Wait |
ReplacingRootVolume:Proceed | RootVolumeReplaced |
Warmed:Pending | Warmed:Pending:Wait | Warmed:Pending:Proceed
| Warmed:Pending:Retained | Warmed:Terminating |
Warmed:Terminating:Wait | Warmed:Terminating:Proceed |
Warmed:Terminating:Retained | Warmed:Terminated |
Warmed:Stopped | Warmed:Running | Warmed:Hibernated
35 |
# File 'sig/instance.rbs', line 35
def lifecycle_state: () -> ::String
|
#load ⇒ self Also known as: reload
Loads, or reloads #data for the current Aws::AutoScaling::Instance.
Returns self making it possible to chain methods.
instance.reload.data
58 |
# File 'sig/instance.rbs', line 58
def load: () -> self
|
#protected_from_scale_in ⇒ Boolean
Indicates whether the instance is protected from termination by Amazon EC2 Auto Scaling when scaling in.
50 |
# File 'sig/instance.rbs', line 50
def protected_from_scale_in: () -> bool
|
#set_health(options = {}) ⇒ EmptyStructure
91 |
# File 'sig/instance.rbs', line 91
def set_health: (
|
#wait_until(options = {}) {|resource| ... } ⇒ Resource
Use [Aws::AutoScaling::Client] #wait_until instead
The waiting operation is performed on a copy. The original resource remains unchanged.
Waiter polls an API operation until a resource enters a desired state.
Basic Usage
Waiter will polls until it is successful, it fails by entering a terminal state, or until a maximum number of attempts are made.
# polls in a loop until condition is true
resource.wait_until() {|resource| condition}
Example
instance.wait_until(max_attempts:10, delay:5) do |instance|
instance.state.name == 'running'
end
Configuration
You can configure the maximum number of polling attempts, and the delay (in seconds) between each polling attempt. The waiting condition is set by passing a block to #wait_until:
# poll for ~25 seconds
resource.wait_until(max_attempts:5,delay:5) {|resource|...}
Callbacks
You can be notified before each polling attempt and before each
delay. If you throw :success or :failure from these callbacks,
it will terminate the waiter.
started_at = Time.now
# poll for 1 hour, instead of a number of attempts
proc = Proc.new do |attempts, response|
throw :failure if Time.now - started_at > 3600
end
# disable max attempts
instance.wait_until(before_wait:proc, max_attempts:nil) {...}
Handling Errors
When a waiter is successful, it returns the Resource. When a waiter fails, it raises an error.
begin
resource.wait_until(...)
rescue Aws::Waiters::Errors::WaiterFailed
# resource did not enter the desired state in time
end
attempts attempt in seconds invoked before each attempt invoked before each wait
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 |
# File 'lib/aws-sdk-autoscaling/instance.rb', line 266 def wait_until( = {}, &block) self_copy = self.dup attempts = 0 [:max_attempts] = 10 unless .key?(:max_attempts) [:delay] ||= 10 [:poller] = Proc.new do attempts += 1 if block.call(self_copy) [:success, self_copy] else self_copy.reload unless attempts == [:max_attempts] :retry end end Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do Aws::Waiters::Waiter.new().wait({}) end end |
#weighted_capacity ⇒ String
The number of capacity units contributed by the instance based on its instance type.
Valid Range: Minimum value of 1. Maximum value of 999.
53 |
# File 'sig/instance.rbs', line 53
def weighted_capacity: () -> ::String
|