Class: Aws::EC2::Subnet
- Inherits:
-
Object
- Object
- Aws::EC2::Subnet
- Extended by:
- Deprecations
- Defined in:
- sig/subnet.rbs,
lib/aws-sdk-ec2/subnet.rb
Overview
Defined Under Namespace
Classes: Collection
Read-Only Attributes collapse
-
#assign_ipv_6_address_on_creation ⇒ Boolean
Indicates whether a network interface created in this subnet (including a network interface created by RunInstances) receives an IPv6 address.
-
#availability_zone ⇒ String
The Availability Zone of the subnet.
-
#availability_zone_id ⇒ String
The AZ ID of the subnet.
-
#available_ip_address_count ⇒ Integer
The number of unused private IPv4 addresses in the subnet.
-
#block_public_access_states ⇒ Types::BlockPublicAccessStates
The state of VPC Block Public Access (BPA).
-
#cidr_block ⇒ String
The IPv4 CIDR block assigned to the subnet.
-
#customer_owned_ipv_4_pool ⇒ String
The customer-owned IPv4 address pool associated with the subnet.
-
#default_for_az ⇒ Boolean
Indicates whether this is the default subnet for the Availability Zone.
-
#enable_dns_64 ⇒ Boolean
Indicates whether DNS queries made to the Amazon-provided DNS Resolver in this subnet should return synthetic IPv6 addresses for IPv4-only destinations.
-
#enable_lni_at_device_index ⇒ Integer
Indicates the device position for local network interfaces in this subnet.
- #id ⇒ String (also: #subnet_id)
-
#ipv_6_cidr_block_association_set ⇒ Array<Types::SubnetIpv6CidrBlockAssociation>
Information about the IPv6 CIDR blocks associated with the subnet.
-
#ipv_6_native ⇒ Boolean
Indicates whether this is an IPv6 only subnet.
-
#map_customer_owned_ip_on_launch ⇒ Boolean
Indicates whether a network interface created in this subnet (including a network interface created by RunInstances) receives a customer-owned IPv4 address.
-
#map_public_ip_on_launch ⇒ Boolean
Indicates whether instances launched in this subnet receive a public IPv4 address.
-
#outpost_arn ⇒ String
The Amazon Resource Name (ARN) of the Outpost.
-
#owner_id ⇒ String
The ID of the Amazon Web Services account that owns the subnet.
-
#private_dns_name_options_on_launch ⇒ Types::PrivateDnsNameOptionsOnLaunch
The type of hostnames to assign to instances in the subnet at launch.
-
#state ⇒ String
The current state of the subnet.
-
#subnet_arn ⇒ String
The Amazon Resource Name (ARN) of the subnet.
-
#tags ⇒ Array<Types::Tag>
Any tags assigned to the subnet.
-
#type ⇒ String
Indicates if this is a subnet used with Amazon Elastic VMware Service (EVS).
-
#vpc_id ⇒ String
The ID of the VPC the subnet is in.
Actions collapse
- #create_instances(options = {}) ⇒ Instance::Collection
- #create_network_interface(options = {}) ⇒ NetworkInterface
- #create_tags(options = {}) ⇒ Tag::Collection
- #delete(options = {}) ⇒ EmptyStructure
- #delete_tags(options = {}) ⇒ Tag::Collection
Associations collapse
- #identifiers ⇒ Object deprecated private Deprecated.
- #instances(options = {}) ⇒ Instance::Collection
- #nat_gateways(options = {}) ⇒ NatGateway::Collection
- #network_interfaces(options = {}) ⇒ NetworkInterface::Collection
- #vpc ⇒ Vpc?
Instance Method Summary collapse
- #client ⇒ Client
-
#data ⇒ Types::Subnet
Returns the data for this Subnet.
-
#data_loaded? ⇒ Boolean
Returns
trueif this resource is loaded. -
#initialize(*args) ⇒ Subnet
constructor
A new instance of Subnet.
- #load ⇒ self (also: #reload)
-
#wait_until(options = {}) {|resource| ... } ⇒ Resource
deprecated
Deprecated.
Use [Aws::EC2::Client] #wait_until instead
Constructor Details
Instance Method Details
#assign_ipv_6_address_on_creation ⇒ Boolean
Indicates whether a network interface created in this subnet (including a network interface created by RunInstances) receives an IPv6 address.
37 |
# File 'sig/subnet.rbs', line 37
def assign_ipv_6_address_on_creation: () -> bool
|
#availability_zone ⇒ String
The Availability Zone of the subnet.
79 |
# File 'sig/subnet.rbs', line 79
def availability_zone: () -> ::String
|
#availability_zone_id ⇒ String
The AZ ID of the subnet.
22 |
# File 'sig/subnet.rbs', line 22
def availability_zone_id: () -> ::String
|
#available_ip_address_count ⇒ Integer
The number of unused private IPv4 addresses in the subnet. The IPv4 addresses for any stopped instances are considered unavailable.
76 |
# File 'sig/subnet.rbs', line 76
def available_ip_address_count: () -> ::Integer
|
#block_public_access_states ⇒ Types::BlockPublicAccessStates
The state of VPC Block Public Access (BPA).
61 |
# File 'sig/subnet.rbs', line 61
def block_public_access_states: () -> Types::BlockPublicAccessStates
|
#cidr_block ⇒ String
The IPv4 CIDR block assigned to the subnet.
73 |
# File 'sig/subnet.rbs', line 73
def cidr_block: () -> ::String
|
#create_instances(options = {}) ⇒ Instance::Collection
101 |
# File 'sig/subnet.rbs', line 101
def create_instances: (
|
#create_network_interface(options = {}) ⇒ NetworkInterface
327 |
# File 'sig/subnet.rbs', line 327
def create_network_interface: (
|
#create_tags(options = {}) ⇒ Tag::Collection
384 |
# File 'sig/subnet.rbs', line 384
def create_tags: (
|
#customer_owned_ipv_4_pool ⇒ String
The customer-owned IPv4 address pool associated with the subnet.
31 |
# File 'sig/subnet.rbs', line 31
def customer_owned_ipv_4_pool: () -> ::String
|
#data ⇒ Types::Subnet
Returns the data for this Aws::EC2::Subnet. Calls
Client#describe_subnets if #data_loaded? is false.
94 |
# File 'sig/subnet.rbs', line 94
def data: () -> Types::Subnet
|
#data_loaded? ⇒ Boolean
97 |
# File 'sig/subnet.rbs', line 97
def data_loaded?: () -> bool
|
#default_for_az ⇒ Boolean
Indicates whether this is the default subnet for the Availability Zone.
82 |
# File 'sig/subnet.rbs', line 82
def default_for_az: () -> bool
|
#delete(options = {}) ⇒ EmptyStructure
408 |
# File 'sig/subnet.rbs', line 408
def delete: (
|
#delete_tags(options = {}) ⇒ Tag::Collection
396 |
# File 'sig/subnet.rbs', line 396
def delete_tags: (
|
#enable_dns_64 ⇒ Boolean
Indicates whether DNS queries made to the Amazon-provided DNS Resolver in this subnet should return synthetic IPv6 addresses for IPv4-only destinations.
52 |
# File 'sig/subnet.rbs', line 52
def enable_dns_64: () -> bool
|
#enable_lni_at_device_index ⇒ Integer
Indicates the device position for local network interfaces in this
subnet. For example, 1 indicates local network interfaces in this
subnet are the secondary network interface (eth1).
25 |
# File 'sig/subnet.rbs', line 25
def enable_lni_at_device_index: () -> ::Integer
|
#id ⇒ String Also known as: subnet_id
18 |
# File 'sig/subnet.rbs', line 18
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.
1957 1958 1959 |
# File 'lib/aws-sdk-ec2/subnet.rb', line 1957 def identifiers { id: @id } end |
#instances(options = {}) ⇒ Instance::Collection
414 |
# File 'sig/subnet.rbs', line 414
def instances: (
|
#ipv_6_cidr_block_association_set ⇒ Array<Types::SubnetIpv6CidrBlockAssociation>
Information about the IPv6 CIDR blocks associated with the subnet.
40 |
# File 'sig/subnet.rbs', line 40
def ipv_6_cidr_block_association_set: () -> ::Array[Types::SubnetIpv6CidrBlockAssociation]
|
#ipv_6_native ⇒ Boolean
Indicates whether this is an IPv6 only subnet.
55 |
# File 'sig/subnet.rbs', line 55
def ipv_6_native: () -> bool
|
#load ⇒ self Also known as: reload
Loads, or reloads #data for the current Aws::EC2::Subnet.
Returns self making it possible to chain methods.
subnet.reload.data
90 |
# File 'sig/subnet.rbs', line 90
def load: () -> self
|
#map_customer_owned_ip_on_launch ⇒ Boolean
Indicates whether a network interface created in this subnet (including a network interface created by RunInstances) receives a customer-owned IPv4 address.
28 |
# File 'sig/subnet.rbs', line 28
def map_customer_owned_ip_on_launch: () -> bool
|
#map_public_ip_on_launch ⇒ Boolean
Indicates whether instances launched in this subnet receive a public IPv4 address.
Amazon Web Services charges for all public IPv4 addresses, including public IPv4 addresses associated with running instances and Elastic IP addresses. For more information, see the Public IPv4 Address tab on the Amazon VPC pricing page.
85 |
# File 'sig/subnet.rbs', line 85
def map_public_ip_on_launch: () -> bool
|
#nat_gateways(options = {}) ⇒ NatGateway::Collection
428 |
# File 'sig/subnet.rbs', line 428
def nat_gateways: (
|
#network_interfaces(options = {}) ⇒ NetworkInterface::Collection
441 |
# File 'sig/subnet.rbs', line 441
def network_interfaces: (
|
#outpost_arn ⇒ String
The Amazon Resource Name (ARN) of the Outpost.
49 |
# File 'sig/subnet.rbs', line 49
def outpost_arn: () -> ::String
|
#owner_id ⇒ String
The ID of the Amazon Web Services account that owns the subnet.
34 |
# File 'sig/subnet.rbs', line 34
def owner_id: () -> ::String
|
#private_dns_name_options_on_launch ⇒ Types::PrivateDnsNameOptionsOnLaunch
The type of hostnames to assign to instances in the subnet at launch. An instance hostname is based on the IPv4 address or ID of the instance.
58 |
# File 'sig/subnet.rbs', line 58
def private_dns_name_options_on_launch: () -> Types::PrivateDnsNameOptionsOnLaunch
|
#state ⇒ String
The current state of the subnet.
-
failed: The underlying infrastructure to support the subnet failed to provision as expected. -
failed-insufficient-capacity: The underlying infrastructure to support the subnet failed to provision due to a shortage of EC2 instance capacity.
67 |
# File 'sig/subnet.rbs', line 67
def state: () -> ("pending" | "available" | "unavailable" | "failed" | "failed-insufficient-capacity")
|
#subnet_arn ⇒ String
The Amazon Resource Name (ARN) of the subnet.
46 |
# File 'sig/subnet.rbs', line 46
def subnet_arn: () -> ::String
|
#tags ⇒ Array<Types::Tag>
Any tags assigned to the subnet.
43 |
# File 'sig/subnet.rbs', line 43
def tags: () -> ::Array[Types::Tag]
|
#type ⇒ String
Indicates if this is a subnet used with Amazon Elastic VMware Service
(EVS). Possible values are Elastic VMware Service or no value. For
more information about Amazon EVS, see Amazon Elastic VMware
Service API Reference .
64 |
# File 'sig/subnet.rbs', line 64
def type: () -> ::String
|
#vpc_id ⇒ String
The ID of the VPC the subnet is in.
70 |
# File 'sig/subnet.rbs', line 70
def vpc_id: () -> ::String
|
#wait_until(options = {}) {|resource| ... } ⇒ Resource
Use [Aws::EC2::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
323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 |
# File 'lib/aws-sdk-ec2/subnet.rb', line 323 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 |