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

Class: Aws::EC2::Vpc

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(id, options = {}) ⇒ Object #initialize(options = {}) ⇒ Object

Overloads:

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

    Parameters:

    • 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):

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

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

Instance Attribute Details

#cidr_blockString (readonly)

The primary IPv4 CIDR block for the VPC.

Returns:

  • (String)

    The primary IPv4 CIDR block for the VPC.

#cidr_block_association_setArray<Types::VpcCidrBlockAssociation> (readonly)

Information about the IPv4 CIDR blocks associated with the VPC.

Returns:

#dhcp_options_idString (readonly)

The ID of the set of DHCP options you\'ve associated with the VPC (or default if the default options are associated with the VPC).

Returns:

  • (String)

    The ID of the set of DHCP options you\'ve associated with the VPC (or default if the default options are associated with the VPC).

#idString (readonly)

Returns:

  • (String)

#instance_tenancyString (readonly)

The allowed tenancy of instances launched into the VPC.

Possible values:

  • default
  • dedicated
  • host

Returns:

  • (String)

    The allowed tenancy of instances launched into the VPC.

#ipv_6_cidr_block_association_setArray<Types::VpcIpv6CidrBlockAssociation> (readonly)

Information about the IPv6 CIDR blocks associated with the VPC.

Returns:

#is_defaultBoolean (readonly)

Indicates whether the VPC is the default VPC.

Returns:

  • (Boolean)

    Indicates whether the VPC is the default VPC.

#stateString (readonly)

The current state of the VPC.

Possible values:

  • pending
  • available

Returns:

  • (String)

    The current state of the VPC.

#tagsArray<Types::Tag> (readonly)

Any tags assigned to the VPC.

Returns:

  • (Array<Types::Tag>)

    Any tags assigned to the VPC.

#vpc_idString (readonly)

The ID of the VPC.

Returns:

  • (String)

    The ID of the VPC.

Instance Method Details

#accepted_vpc_peering_connections(options = {}) ⇒ Collection<VpcPeeringConnection>

Returns a Collection of Aws::EC2::VpcPeeringConnection resources. No API requests are made until you call an enumerable method on the collection. Client#describe_vpc_peering_connections will be called multiple times until every Aws::EC2::VpcPeeringConnection has been yielded.

Examples:

Request syntax example with placeholder values


vpc.accepted_vpc_peering_connections({
  dry_run: false,
  vpc_peering_connection_ids: ["String"],
})

Enumerating Aws::EC2::VpcPeeringConnection resources.

vpc.accepted_vpc_peering_connections.each do |vpcpeeringconnection|
  # yields each vpcpeeringconnection
end

Enumerating Aws::EC2::VpcPeeringConnection resources with a limit.

vpc.accepted_vpc_peering_connections.limit(10).each do |vpcpeeringconnection|
  # yields at most 10 accepted_vpc_peering_connections
end

Options Hash (options):

  • :dry_run (Boolean)

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

  • :vpc_peering_connection_ids (Array<String>)

    One or more VPC peering connection IDs.

    Default: Describes all your VPC peering connections.

Returns:

See Also:

#associate_dhcp_options(options = {}) ⇒ Struct

Associates a set of DHCP options (that you've previously created) with the specified VPC, or associates no DHCP options with the VPC.

After you associate the options with the VPC, any existing instances and all new instances that you launch in that VPC use the options. You don't need to restart or relaunch the instances. They automatically pick up the changes within a few hours, depending on how frequently the instance renews its DHCP lease. You can explicitly renew the lease using the operating system on the instance.

For more information, see DHCP Options Sets in the Amazon Virtual Private Cloud User Guide.

Examples:

Request syntax example with placeholder values


vpc.associate_dhcp_options({
  dhcp_options_id: "String", # required
  dry_run: false,
})

Options Hash (options):

  • :dhcp_options_id (required, String)

    The ID of the DHCP options set, or default to associate no DHCP options with the VPC.

  • :dry_run (Boolean)

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

Links an EC2-Classic instance to a ClassicLink-enabled VPC through one or more of the VPC's security groups. You cannot link an EC2-Classic instance to more than one VPC at a time. You can only link an instance that's in the running state. An instance is automatically unlinked from a VPC when it's stopped - you can link it to the VPC again when you restart it.

After you've linked an instance, you cannot change the VPC security groups that are associated with it. To change the security groups, you must first unlink the instance, and then link it again.

Linking your instance to a VPC is sometimes referred to as attaching your instance.

Examples:

Request syntax example with placeholder values


vpc.attach_classic_link_instance({
  dry_run: false,
  groups: ["String"], # required
  instance_id: "String", # required
})

Options Hash (options):

  • :dry_run (Boolean)

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

  • :groups (required, Array<String>)

    The ID of one or more of the VPC\'s security groups. You cannot specify security groups from a different VPC.

  • :instance_id (required, String)

    The ID of an EC2-Classic instance to link to the ClassicLink-enabled VPC.

Returns:

See Also:

#attach_internet_gateway(options = {}) ⇒ Struct

Attaches an Internet gateway to a VPC, enabling connectivity between the Internet and the VPC. For more information about your VPC and Internet gateway, see the Amazon Virtual Private Cloud User Guide.

Examples:

Request syntax example with placeholder values


vpc.attach_internet_gateway({
  dry_run: false,
  internet_gateway_id: "String", # required
})

Options Hash (options):

  • :dry_run (Boolean)

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

  • :internet_gateway_id (required, String)

    The ID of the Internet gateway.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#create_network_acl(options = {}) ⇒ NetworkAcl

Examples:

Request syntax example with placeholder values


vpc.create_network_acl({
  dry_run: false,
})

Basic usage

networkacl = vpc.create_network_acl(options)
networkacl.id
#=> "networkacl-id"

Options Hash (options):

  • :dry_run (Boolean)

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

Returns:

See Also:

#create_route_table(options = {}) ⇒ RouteTable

Examples:

Request syntax example with placeholder values


vpc.create_route_table({
  dry_run: false,
})

Basic usage

routetable = vpc.create_route_table(options)
routetable.id
#=> "routetable-id"

Options Hash (options):

  • :dry_run (Boolean)

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

Returns:

See Also:

#create_security_group(options = {}) ⇒ SecurityGroup

Examples:

Request syntax example with placeholder values


vpc.create_security_group({
  description: "String", # required
  group_name: "String", # required
  dry_run: false,
})

Basic usage

securitygroup = vpc.create_security_group(options)
securitygroup.id
#=> "securitygroup-id"

Options Hash (options):

  • :description (required, String)

    A description for the security group. This is informational only.

    Constraints: Up to 255 characters in length

    Constraints for EC2-Classic: ASCII characters

    Constraints for EC2-VPC: a-z, A-Z, 0-9, spaces, and ._-:/()#,@[]+=&;{}!$*

  • :group_name (required, String)

    The name of the security group.

    Constraints: Up to 255 characters in length

    Constraints for EC2-Classic: ASCII characters

    Constraints for EC2-VPC: a-z, A-Z, 0-9, spaces, and ._-:/()#,@[]+=&;{}!$*

  • :dry_run (Boolean)

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

Returns:

See Also:

#create_subnet(options = {}) ⇒ Subnet

Examples:

Request syntax example with placeholder values


vpc.create_subnet({
  availability_zone: "String",
  cidr_block: "String", # required
  ipv_6_cidr_block: "String",
  dry_run: false,
})

Basic usage

subnet = vpc.create_subnet(options)
subnet.id
#=> "subnet-id"

Options Hash (options):

  • :availability_zone (String)

    The Availability Zone for the subnet.

    Default: AWS selects one for you. If you create more than one subnet in your VPC, we may not necessarily select a different zone for each subnet.

  • :cidr_block (required, String)

    The IPv4 network range for the subnet, in CIDR notation. For example, 10.0.0.0/24.

  • :ipv_6_cidr_block (String)

    The IPv6 network range for the subnet, in CIDR notation. The subnet size must use a /64 prefix length.

  • :dry_run (Boolean)

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

Returns:

See Also:

#create_tags(options = {}) ⇒ Array<Tag>

Examples:

Request syntax example with placeholder values


vpc.create_tags({
  dry_run: false,
  tags: [ # required
    {
      key: "String",
      value: "String",
    },
  ],
})

Basic usage

tags = vpc.create_tags(options)
tags.map(&:value)
#=> ["tag-value", ...]

Options Hash (options):

  • :dry_run (Boolean)

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

  • :tags (required, Array<Types::Tag>)

    One or more tags. The value parameter is required, but if you don\'t want the tag to have a value, specify the parameter with no value, and we set the value to an empty string.

Returns:

See Also:

#delete(options = {}) ⇒ Struct

Deletes the specified VPC. You must detach or delete all gateways and resources that are associated with the VPC before you can delete it. For example, you must terminate all instances running in the VPC, delete all security groups associated with the VPC (except the default one), delete all route tables associated with the VPC (except the default one), and so on.

Examples:

Request syntax example with placeholder values


vpc.delete({
  dry_run: false,
})

Options Hash (options):

  • :dry_run (Boolean)

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#describe_attribute(options = {}) ⇒ Types::DescribeVpcAttributeResult

Describes the specified attribute of the specified VPC. You can specify only one attribute at a time.

Examples:

Request syntax example with placeholder values


vpc.describe_attribute({
  attribute: "enableDnsSupport", # required, accepts enableDnsSupport, enableDnsHostnames
  dry_run: false,
})

Options Hash (options):

  • :attribute (required, String)

    The VPC attribute.

  • :dry_run (Boolean)

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

Returns:

See Also:

Unlinks (detaches) a linked EC2-Classic instance from a VPC. After the instance has been unlinked, the VPC security groups are no longer associated with it. An instance is automatically unlinked from a VPC when it's stopped.

Examples:

Request syntax example with placeholder values


vpc.detach_classic_link_instance({
  dry_run: false,
  instance_id: "String", # required
})

Options Hash (options):

  • :dry_run (Boolean)

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

  • :instance_id (required, String)

    The ID of the instance to unlink from the VPC.

Returns:

See Also:

#detach_internet_gateway(options = {}) ⇒ Struct

Detaches an Internet gateway from a VPC, disabling connectivity between the Internet and the VPC. The VPC must not contain any running instances with Elastic IP addresses or public IPv4 addresses.

Examples:

Request syntax example with placeholder values


vpc.detach_internet_gateway({
  dry_run: false,
  internet_gateway_id: "String", # required
})

Options Hash (options):

  • :dry_run (Boolean)

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

  • :internet_gateway_id (required, String)

    The ID of the Internet gateway.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#dhcp_optionsDhcpOptions?

Returns:

Disables ClassicLink for a VPC. You cannot disable ClassicLink for a VPC that has EC2-Classic instances linked to it.

Examples:

Request syntax example with placeholder values


vpc.disable_classic_link({
  dry_run: false,
})

Options Hash (options):

  • :dry_run (Boolean)

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

Returns:

See Also:

Enables a VPC for ClassicLink. You can then link EC2-Classic instances to your ClassicLink-enabled VPC to allow communication over private IP addresses. You cannot enable your VPC for ClassicLink if any of your VPC's route tables have existing routes for address ranges within the 10.0.0.0/8 IP address range, excluding local routes for VPCs in the 10.0.0.0/16 and 10.1.0.0/16 IP address ranges. For more information, see ClassicLink in the Amazon Elastic Compute Cloud User Guide.

Examples:

Request syntax example with placeholder values


vpc.enable_classic_link({
  dry_run: false,
})

Options Hash (options):

  • :dry_run (Boolean)

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

Returns:

See Also:

#exists?Boolean

Returns true if this Vpc exists. Returns false otherwise.

Returns:

  • (Boolean)

    Returns true if this Vpc exists. Returns false otherwise.

#instances(options = {}) ⇒ Collection<Instance>

Returns a Collection of Instance resources. No API requests are made until you call an enumerable method on the collection. Client#describe_instances will be called multiple times until every Instance has been yielded.

Examples:

Request syntax example with placeholder values


vpc.instances({
  instance_ids: ["String"],
  dry_run: false,
  max_results: 1,
  next_token: "String",
})

Enumerating Instance resources.

vpc.instances.each do |instance|
  # yields each instance
end

Enumerating Instance resources with a limit.

vpc.instances.limit(10).each do |instance|
  # yields at most 10 instances
end

Batch operations callable on the returned collection


# calls Client#create_tags on each batch
vpc.instances.batch_create_tags

# calls Client#monitor_instances on each batch
vpc.instances.batch_monitor

# calls Client#reboot_instances on each batch
vpc.instances.batch_reboot

# calls Client#start_instances on each batch
vpc.instances.batch_start

# calls Client#stop_instances on each batch
vpc.instances.batch_stop

# calls Client#terminate_instances on each batch
vpc.instances.batch_terminate!

# calls Client#unmonitor_instances on each batch
vpc.instances.batch_unmonitor

Options Hash (options):

  • :instance_ids (Array<String>)

    One or more instance IDs.

    Default: Describes all your instances.

  • :dry_run (Boolean)

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

  • :max_results (Integer)

    The maximum number of results to return in a single call. To retrieve the remaining results, make another call with the returned NextToken value. This value can be between 5 and 1000. You cannot specify this parameter and the instance IDs parameter or tag filters in the same call.

  • :next_token (String)

    The token to request the next page of results.

Returns:

See Also:

#internet_gateways(options = {}) ⇒ Collection<InternetGateway>

Returns a Collection of InternetGateway resources. No API requests are made until you call an enumerable method on the collection. Client#describe_internet_gateways will be called multiple times until every InternetGateway has been yielded.

Examples:

Request syntax example with placeholder values


vpc.internet_gateways({
  dry_run: false,
  internet_gateway_ids: ["String"],
})

Enumerating InternetGateway resources.

vpc.internet_gateways.each do |internetgateway|
  # yields each internetgateway
end

Enumerating InternetGateway resources with a limit.

vpc.internet_gateways.limit(10).each do |internetgateway|
  # yields at most 10 internet_gateways
end

Options Hash (options):

  • :dry_run (Boolean)

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

  • :internet_gateway_ids (Array<String>)

    One or more Internet gateway IDs.

    Default: Describes all your Internet gateways.

Returns:

See Also:

#modify_attribute(options = {}) ⇒ Struct

Modifies the specified attribute of the specified VPC.

Examples:

Request syntax example with placeholder values


vpc.modify_attribute({
  enable_dns_hostnames: {
    value: false,
  },
  enable_dns_support: {
    value: false,
  },
})

Options Hash (options):

  • :enable_dns_hostnames (Types::AttributeBooleanValue)

    Indicates whether the instances launched in the VPC get DNS hostnames. If enabled, instances in the VPC get DNS hostnames; otherwise, they do not.

    You cannot modify the DNS resolution and DNS hostnames attributes in the same request. Use separate requests for each attribute. You can only enable DNS hostnames if you\'ve enabled DNS support.

  • :enable_dns_support (Types::AttributeBooleanValue)

    Indicates whether the DNS resolution is supported for the VPC. If enabled, queries to the Amazon provided DNS server at the 169.254.169.253 IP address, or the reserved IP address at the base of the VPC network range \"plus two\" will succeed. If disabled, the Amazon provided DNS service in the VPC that resolves public DNS hostnames to IP addresses is not enabled.

    You cannot modify the DNS resolution and DNS hostnames attributes in the same request. Use separate requests for each attribute.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#network_acls(options = {}) ⇒ Collection<NetworkAcl>

Returns a Collection of NetworkAcl resources. No API requests are made until you call an enumerable method on the collection. Client#describe_network_acls will be called multiple times until every NetworkAcl has been yielded.

Examples:

Request syntax example with placeholder values


vpc.network_acls({
  dry_run: false,
  network_acl_ids: ["String"],
})

Enumerating NetworkAcl resources.

vpc.network_acls.each do |networkacl|
  # yields each networkacl
end

Enumerating NetworkAcl resources with a limit.

vpc.network_acls.limit(10).each do |networkacl|
  # yields at most 10 network_acls
end

Options Hash (options):

  • :dry_run (Boolean)

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

  • :network_acl_ids (Array<String>)

    One or more network ACL IDs.

    Default: Describes all your network ACLs.

Returns:

See Also:

#network_interfaces(options = {}) ⇒ Collection<NetworkInterface>

Returns a Collection of NetworkInterface resources. No API requests are made until you call an enumerable method on the collection. Client#describe_network_interfaces will be called multiple times until every NetworkInterface has been yielded.

Examples:

Request syntax example with placeholder values


vpc.network_interfaces({
  dry_run: false,
  network_interface_ids: ["String"],
})

Enumerating NetworkInterface resources.

vpc.network_interfaces.each do |networkinterface|
  # yields each networkinterface
end

Enumerating NetworkInterface resources with a limit.

vpc.network_interfaces.limit(10).each do |networkinterface|
  # yields at most 10 network_interfaces
end

Options Hash (options):

  • :dry_run (Boolean)

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

  • :network_interface_ids (Array<String>)

    One or more network interface IDs.

    Default: Describes all your network interfaces.

Returns:

See Also:

#request_vpc_peering_connection(options = {}) ⇒ VpcPeeringConnection

Examples:

Request syntax example with placeholder values


vpc.request_vpc_peering_connection({
  dry_run: false,
  peer_owner_id: "String",
  peer_vpc_id: "String",
  peer_region: "String",
})

Basic usage

vpcpeeringconnection = vpc.request_vpc_peering_connection(options)
vpcpeeringconnection.id
#=> "vpcpeeringconnection-id"

Options Hash (options):

  • :dry_run (Boolean)

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

  • :peer_owner_id (String)

    The AWS account ID of the owner of the accepter VPC.

    Default: Your AWS account ID

  • :peer_vpc_id (String)

    The ID of the VPC with which you are creating the VPC peering connection. You must specify this parameter in the request.

  • :peer_region (String)

    The region code for the accepter VPC, if the accepter VPC is located in a region other than the region in which you make the request.

    Default: The region in which you make the request.

Returns:

See Also:

#requested_vpc_peering_connections(options = {}) ⇒ Collection<VpcPeeringConnection>

Returns a Collection of Aws::EC2::VpcPeeringConnection resources. No API requests are made until you call an enumerable method on the collection. Client#describe_vpc_peering_connections will be called multiple times until every Aws::EC2::VpcPeeringConnection has been yielded.

Examples:

Request syntax example with placeholder values


vpc.requested_vpc_peering_connections({
  dry_run: false,
  vpc_peering_connection_ids: ["String"],
})

Enumerating Aws::EC2::VpcPeeringConnection resources.

vpc.requested_vpc_peering_connections.each do |vpcpeeringconnection|
  # yields each vpcpeeringconnection
end

Enumerating Aws::EC2::VpcPeeringConnection resources with a limit.

vpc.requested_vpc_peering_connections.limit(10).each do |vpcpeeringconnection|
  # yields at most 10 requested_vpc_peering_connections
end

Options Hash (options):

  • :dry_run (Boolean)

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

  • :vpc_peering_connection_ids (Array<String>)

    One or more VPC peering connection IDs.

    Default: Describes all your VPC peering connections.

Returns:

See Also:

#route_tables(options = {}) ⇒ Collection<RouteTable>

Returns a Collection of RouteTable resources. No API requests are made until you call an enumerable method on the collection. Client#describe_route_tables will be called multiple times until every RouteTable has been yielded.

Examples:

Request syntax example with placeholder values


vpc.route_tables({
  dry_run: false,
  route_table_ids: ["String"],
})

Enumerating RouteTable resources.

vpc.route_tables.each do |routetable|
  # yields each routetable
end

Enumerating RouteTable resources with a limit.

vpc.route_tables.limit(10).each do |routetable|
  # yields at most 10 route_tables
end

Options Hash (options):

  • :dry_run (Boolean)

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

  • :route_table_ids (Array<String>)

    One or more route table IDs.

    Default: Describes all your route tables.

Returns:

See Also:

#security_groups(options = {}) ⇒ Collection<SecurityGroup>

Returns a Collection of SecurityGroup resources. No API requests are made until you call an enumerable method on the collection. Client#describe_security_groups will be called multiple times until every SecurityGroup has been yielded.

Examples:

Request syntax example with placeholder values


vpc.security_groups({
  group_ids: ["String"],
  group_names: ["String"],
  dry_run: false,
  next_token: "String",
  max_results: 1,
})

Enumerating SecurityGroup resources.

vpc.security_groups.each do |securitygroup|
  # yields each securitygroup
end

Enumerating SecurityGroup resources with a limit.

vpc.security_groups.limit(10).each do |securitygroup|
  # yields at most 10 security_groups
end

Options Hash (options):

  • :group_ids (Array<String>)

    One or more security group IDs. Required for security groups in a nondefault VPC.

    Default: Describes all your security groups.

  • :group_names (Array<String>)

    [EC2-Classic and default VPC only] One or more security group names. You can specify either the security group name or the security group ID. For security groups in a nondefault VPC, use the group-name filter to describe security groups by name.

    Default: Describes all your security groups.

  • :dry_run (Boolean)

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

  • :next_token (String)

    The token to request the next page of results.

  • :max_results (Integer)

    The maximum number of results to return in a single call. To retrieve the remaining results, make another request with the returned NextToken value. This value can be between 5 and 1000.

Returns:

See Also:

#subnets(options = {}) ⇒ Collection<Subnet>

Returns a Collection of Subnet resources. No API requests are made until you call an enumerable method on the collection. Client#describe_subnets will be called multiple times until every Subnet has been yielded.

Examples:

Request syntax example with placeholder values


vpc.subnets({
  subnet_ids: ["String"],
  dry_run: false,
})

Enumerating Subnet resources.

vpc.subnets.each do |subnet|
  # yields each subnet
end

Enumerating Subnet resources with a limit.

vpc.subnets.limit(10).each do |subnet|
  # yields at most 10 subnets
end

Options Hash (options):

  • :subnet_ids (Array<String>)

    One or more subnet IDs.

    Default: Describes all your subnets.

  • :dry_run (Boolean)

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

Returns:

See Also:

#wait_until_available {|waiter| ... } ⇒ Vpc

Waits until this Vpc is available. This method waits by polling Client#describe_vpcs until successful. An error is raised after a configurable number of failed checks.

This waiter uses the following defaults:

Configuration Default
#delay 15
#max_attempts 40

You can modify defaults and register callbacks by passing a block argument.

Examples:

Basic usage

vpc.wait_until_available

Yield Parameters:

Returns:

  • (Vpc)

    Returns a copy of this Vpc that is not loaded.

Raises:

See Also:

#wait_until_exists {|waiter| ... } ⇒ Vpc

Waits until this Vpc is exists. This method waits by polling Client#describe_vpcs until successful. An error is raised after a configurable number of failed checks.

This waiter uses the following defaults:

Configuration Default
#delay 1
#max_attempts 5

You can modify defaults and register callbacks by passing a block argument.

Examples:

Basic usage

vpc.wait_until_exists

Yield Parameters:

Returns:

  • (Vpc)

    Returns a copy of this Vpc that is not loaded.

Raises:

See Also: