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

Class: Aws::EC2::Client

Inherits:
Seahorse::Client::Base show all
Includes:
ClientStubs
Defined in:
gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb

Instance Attribute Summary

Attributes inherited from Seahorse::Client::Base

#config, #handlers

API Operations collapse

Instance Method Summary collapse

Methods included from ClientStubs

#stub_data, #stub_responses

Methods inherited from Seahorse::Client::Base

add_plugin, api, clear_plugins, define, new, #operation_names, plugins, remove_plugin, set_api, set_plugins

Methods included from Seahorse::Client::HandlerBuilder

#handle, #handle_request, #handle_response

Constructor Details

#initialize(*args) ⇒ Client

Returns a new instance of Client

Parameters:

  • options (Hash)

    a customizable set of options



146
147
148
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 146

def initialize(*args)
  super
end

Instance Method Details

#accept_reserved_instances_exchange_quote(params = {}) ⇒ Types::AcceptReservedInstancesExchangeQuoteResult

Accepts the Convertible Reserved Instance exchange quote described in the GetReservedInstancesExchangeQuote call.

Examples:

Request syntax with placeholder values


resp = client.accept_reserved_instances_exchange_quote({
  dry_run: false,
  reserved_instance_ids: ["String"], # required
  target_configurations: [
    {
      instance_count: 1,
      offering_id: "String", # required
    },
  ],
})

Response structure


resp.exchange_id #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

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

  • :reserved_instance_ids (required, Array<String>)

    The IDs of the Convertible Reserved Instances to exchange for another Convertible Reserved Instance of the same or higher value.

  • :target_configurations (Array<Types::TargetConfigurationRequest>)

    The configuration of the target Convertible Reserved Instance to exchange for your current Convertible Reserved Instances.

Returns:

See Also:



194
195
196
197
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 194

def accept_reserved_instances_exchange_quote(params = {}, options = {})
  req = build_request(:accept_reserved_instances_exchange_quote, params)
  req.send_request(options)
end

#accept_vpc_endpoint_connections(params = {}) ⇒ Types::AcceptVpcEndpointConnectionsResult

Accepts one or more interface VPC endpoint connection requests to your VPC endpoint service.

Examples:

Request syntax with placeholder values


resp = client.accept_vpc_endpoint_connections({
  dry_run: false,
  service_id: "String", # required
  vpc_endpoint_ids: ["String"], # required
})

Response structure


resp.unsuccessful #=> Array
resp.unsuccessful[0].error.code #=> String
resp.unsuccessful[0].error.message #=> String
resp.unsuccessful[0].resource_id #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

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

  • :service_id (required, String)

    The ID of the endpoint service.

  • :vpc_endpoint_ids (required, Array<String>)

    The IDs of one or more interface VPC endpoints.

Returns:

See Also:



237
238
239
240
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 237

def accept_vpc_endpoint_connections(params = {}, options = {})
  req = build_request(:accept_vpc_endpoint_connections, params)
  req.send_request(options)
end

#accept_vpc_peering_connection(params = {}) ⇒ Types::AcceptVpcPeeringConnectionResult

Accept a VPC peering connection request. To accept a request, the VPC peering connection must be in the pending-acceptance state, and you must be the owner of the peer VPC. Use DescribeVpcPeeringConnections to view your outstanding VPC peering connection requests.

For an inter-region VPC peering connection request, you must accept the VPC peering connection in the region of the accepter VPC.

Examples:

Request syntax with placeholder values


resp = client.accept_vpc_peering_connection({
  dry_run: false,
  vpc_peering_connection_id: "String",
})

Response structure


resp.vpc_peering_connection.accepter_vpc_info.cidr_block #=> String
resp.vpc_peering_connection.accepter_vpc_info.ipv_6_cidr_block_set #=> Array
resp.vpc_peering_connection.accepter_vpc_info.ipv_6_cidr_block_set[0].ipv_6_cidr_block #=> String
resp.vpc_peering_connection.accepter_vpc_info.cidr_block_set #=> Array
resp.vpc_peering_connection.accepter_vpc_info.cidr_block_set[0].cidr_block #=> String
resp.vpc_peering_connection.accepter_vpc_info.owner_id #=> String
resp.vpc_peering_connection.accepter_vpc_info.peering_options.allow_dns_resolution_from_remote_vpc #=> Boolean
resp.vpc_peering_connection.accepter_vpc_info.peering_options.allow_egress_from_local_classic_link_to_remote_vpc #=> Boolean
resp.vpc_peering_connection.accepter_vpc_info.peering_options.allow_egress_from_local_vpc_to_remote_classic_link #=> Boolean
resp.vpc_peering_connection.accepter_vpc_info.vpc_id #=> String
resp.vpc_peering_connection.accepter_vpc_info.region #=> String
resp.vpc_peering_connection.expiration_time #=> Time
resp.vpc_peering_connection.requester_vpc_info.cidr_block #=> String
resp.vpc_peering_connection.requester_vpc_info.ipv_6_cidr_block_set #=> Array
resp.vpc_peering_connection.requester_vpc_info.ipv_6_cidr_block_set[0].ipv_6_cidr_block #=> String
resp.vpc_peering_connection.requester_vpc_info.cidr_block_set #=> Array
resp.vpc_peering_connection.requester_vpc_info.cidr_block_set[0].cidr_block #=> String
resp.vpc_peering_connection.requester_vpc_info.owner_id #=> String
resp.vpc_peering_connection.requester_vpc_info.peering_options.allow_dns_resolution_from_remote_vpc #=> Boolean
resp.vpc_peering_connection.requester_vpc_info.peering_options.allow_egress_from_local_classic_link_to_remote_vpc #=> Boolean
resp.vpc_peering_connection.requester_vpc_info.peering_options.allow_egress_from_local_vpc_to_remote_classic_link #=> Boolean
resp.vpc_peering_connection.requester_vpc_info.vpc_id #=> String
resp.vpc_peering_connection.requester_vpc_info.region #=> String
resp.vpc_peering_connection.status.code #=> String, one of "initiating-request", "pending-acceptance", "active", "deleted", "rejected", "failed", "expired", "provisioning", "deleting"
resp.vpc_peering_connection.status.message #=> String
resp.vpc_peering_connection.tags #=> Array
resp.vpc_peering_connection.tags[0].key #=> String
resp.vpc_peering_connection.tags[0].value #=> String
resp.vpc_peering_connection.vpc_peering_connection_id #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :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_id (String)

    The ID of the VPC peering connection. You must specify this parameter in the request.

Returns:

See Also:



307
308
309
310
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 307

def accept_vpc_peering_connection(params = {}, options = {})
  req = build_request(:accept_vpc_peering_connection, params)
  req.send_request(options)
end

#allocate_address(params = {}) ⇒ Types::AllocateAddressResult

Allocates an Elastic IP address.

An Elastic IP address is for use either in the EC2-Classic platform or in a VPC. By default, you can allocate 5 Elastic IP addresses for EC2-Classic per region and 5 Elastic IP addresses for EC2-VPC per region.

If you release an Elastic IP address for use in a VPC, you might be able to recover it. To recover an Elastic IP address that you released, specify it in the Address parameter. Note that you cannot recover an Elastic IP address that you released after it is allocated to another AWS account.

For more information, see Elastic IP Addresses in the Amazon Elastic Compute Cloud User Guide.

Examples:

Example: To allocate an Elastic IP address for EC2-VPC


# This example allocates an Elastic IP address to use with an instance in a VPC.

resp = client.allocate_address({
  domain: "vpc", 
})

resp.to_h outputs the following:
{
  allocation_id: "eipalloc-64d5890a", 
  domain: "vpc", 
  public_ip: "203.0.113.0", 
}

Example: To allocate an Elastic IP address for EC2-Classic


# This example allocates an Elastic IP address to use with an instance in EC2-Classic.

resp = client.allocate_address({
})

resp.to_h outputs the following:
{
  domain: "standard", 
  public_ip: "198.51.100.0", 
}

Request syntax with placeholder values


resp = client.allocate_address({
  domain: "vpc", # accepts vpc, standard
  address: "String",
  dry_run: false,
})

Response structure


resp.public_ip #=> String
resp.allocation_id #=> String
resp.domain #=> String, one of "vpc", "standard"

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :domain (String)

    Set to vpc to allocate the address for use with instances in a VPC.

    Default: The address is for use with instances in EC2-Classic.

  • :address (String)

    [EC2-VPC] The Elastic IP address to recover.

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



399
400
401
402
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 399

def allocate_address(params = {}, options = {})
  req = build_request(:allocate_address, params)
  req.send_request(options)
end

#allocate_hosts(params = {}) ⇒ Types::AllocateHostsResult

Allocates a Dedicated Host to your account. At minimum you need to specify the instance size type, Availability Zone, and quantity of hosts you want to allocate.

Examples:

Request syntax with placeholder values


resp = client.allocate_hosts({
  auto_placement: "on", # accepts on, off
  availability_zone: "String", # required
  client_token: "String",
  instance_type: "String", # required
  quantity: 1, # required
})

Response structure


resp.host_ids #=> Array
resp.host_ids[0] #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :auto_placement (String)

    This is enabled by default. This property allows instances to be automatically placed onto available Dedicated Hosts, when you are launching instances without specifying a host ID.

    Default: Enabled

  • :availability_zone (required, String)

    The Availability Zone for the Dedicated Hosts.

  • :client_token (String)

    Unique, case-sensitive identifier you provide to ensure idempotency of the request. For more information, see How to Ensure Idempotency in the Amazon Elastic Compute Cloud User Guide.

  • :instance_type (required, String)

    Specify the instance type that you want your Dedicated Hosts to be configured for. When you specify the instance type, that is the only instance type that you can launch onto that host.

  • :quantity (required, Integer)

    The number of Dedicated Hosts you want to allocate to your account with these parameters.

Returns:

See Also:



459
460
461
462
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 459

def allocate_hosts(params = {}, options = {})
  req = build_request(:allocate_hosts, params)
  req.send_request(options)
end

#assign_ipv_6_addresses(params = {}) ⇒ Types::AssignIpv6AddressesResult

Assigns one or more IPv6 addresses to the specified network interface. You can specify one or more specific IPv6 addresses, or you can specify the number of IPv6 addresses to be automatically assigned from within the subnet's IPv6 CIDR block range. You can assign as many IPv6 addresses to a network interface as you can assign private IPv4 addresses, and the limit varies per instance type. For information, see IP Addresses Per Network Interface Per Instance Type in the Amazon Elastic Compute Cloud User Guide.

Examples:

Request syntax with placeholder values


resp = client.assign_ipv_6_addresses({
  ipv_6_address_count: 1,
  ipv_6_addresses: ["String"],
  network_interface_id: "String", # required
})

Response structure


resp.assigned_ipv_6_addresses #=> Array
resp.assigned_ipv_6_addresses[0] #=> String
resp.network_interface_id #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :ipv_6_address_count (Integer)

    The number of IPv6 addresses to assign to the network interface. Amazon EC2 automatically selects the IPv6 addresses from the subnet range. You can't use this option if specifying specific IPv6 addresses.

  • :ipv_6_addresses (Array<String>)

    One or more specific IPv6 addresses to be assigned to the network interface. You can't use this option if you're specifying a number of IPv6 addresses.

  • :network_interface_id (required, String)

    The ID of the network interface.

Returns:

See Also:



514
515
516
517
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 514

def assign_ipv_6_addresses(params = {}, options = {})
  req = build_request(:assign_ipv_6_addresses, params)
  req.send_request(options)
end

#assign_private_ip_addresses(params = {}) ⇒ Struct

Assigns one or more secondary private IP addresses to the specified network interface. You can specify one or more specific secondary IP addresses, or you can specify the number of secondary IP addresses to be automatically assigned within the subnet's CIDR block range. The number of secondary IP addresses that you can assign to an instance varies by instance type. For information about instance types, see Instance Types in the Amazon Elastic Compute Cloud User Guide. For more information about Elastic IP addresses, see Elastic IP Addresses in the Amazon Elastic Compute Cloud User Guide.

AssignPrivateIpAddresses is available only in EC2-VPC.

Examples:

Example: To assign a specific secondary private IP address to an interface


# This example assigns the specified secondary private IP address to the specified network interface.

resp = client.assign_private_ip_addresses({
  network_interface_id: "eni-e5aa89a3", 
  private_ip_addresses: [
    "10.0.0.82", 
  ], 
})

Example: To assign secondary private IP addresses that Amazon EC2 selects to an interface


# This example assigns two secondary private IP addresses to the specified network interface. Amazon EC2 automatically
# assigns these IP addresses from the available IP addresses in the CIDR block range of the subnet the network interface
# is associated with.

resp = client.assign_private_ip_addresses({
  network_interface_id: "eni-e5aa89a3", 
  secondary_private_ip_address_count: 2, 
})

Request syntax with placeholder values


resp = client.assign_private_ip_addresses({
  allow_reassignment: false,
  network_interface_id: "String", # required
  private_ip_addresses: ["String"],
  secondary_private_ip_address_count: 1,
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :allow_reassignment (Boolean)

    Indicates whether to allow an IP address that is already assigned to another network interface or instance to be reassigned to the specified network interface.

  • :network_interface_id (required, String)

    The ID of the network interface.

  • :private_ip_addresses (Array<String>)

    One or more IP addresses to be assigned as a secondary private IP address to the network interface. You can't specify this parameter when also specifying a number of secondary IP addresses.

    If you don't specify an IP address, Amazon EC2 automatically selects an IP address within the subnet range.

  • :secondary_private_ip_address_count (Integer)

    The number of secondary IP addresses to assign to the network interface. You can't specify this parameter when also specifying private IP addresses.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



595
596
597
598
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 595

def assign_private_ip_addresses(params = {}, options = {})
  req = build_request(:assign_private_ip_addresses, params)
  req.send_request(options)
end

#associate_address(params = {}) ⇒ Types::AssociateAddressResult

Associates an Elastic IP address with an instance or a network interface.

An Elastic IP address is for use in either the EC2-Classic platform or in a VPC. For more information, see Elastic IP Addresses in the Amazon Elastic Compute Cloud User Guide.

[EC2-Classic, VPC in an EC2-VPC-only account] If the Elastic IP address is already associated with a different instance, it is disassociated from that instance and associated with the specified instance. If you associate an Elastic IP address with an instance that has an existing Elastic IP address, the existing address is disassociated from the instance, but remains allocated to your account.

[VPC in an EC2-Classic account] If you don't specify a private IP address, the Elastic IP address is associated with the primary IP address. If the Elastic IP address is already associated with a different instance or a network interface, you get an error unless you allow reassociation. You cannot associate an Elastic IP address with an instance or network interface that has an existing Elastic IP address.

This is an idempotent operation. If you perform the operation more than once, Amazon EC2 doesn't return an error, and you may be charged for each time the Elastic IP address is remapped to the same instance. For more information, see the Elastic IP Addresses section of Amazon EC2 Pricing.

Examples:

Example: To associate an Elastic IP address in EC2-VPC


# This example associates the specified Elastic IP address with the specified instance in a VPC.

resp = client.associate_address({
  allocation_id: "eipalloc-64d5890a", 
  instance_id: "i-0b263919b6498b123", 
})

resp.to_h outputs the following:
{
  association_id: "eipassoc-2bebb745", 
}

Example: To associate an Elastic IP address with a network interface


# This example associates the specified Elastic IP address with the specified network interface.

resp = client.associate_address({
  allocation_id: "eipalloc-64d5890a", 
  network_interface_id: "eni-1a2b3c4d", 
})

resp.to_h outputs the following:
{
  association_id: "eipassoc-2bebb745", 
}

Example: To associate an Elastic IP address in EC2-Classic


# This example associates an Elastic IP address with an instance in EC2-Classic.

resp = client.associate_address({
  instance_id: "i-07ffe74c7330ebf53", 
  public_ip: "198.51.100.0", 
})

Request syntax with placeholder values


resp = client.associate_address({
  allocation_id: "String",
  instance_id: "String",
  public_ip: "String",
  allow_reassociation: false,
  dry_run: false,
  network_interface_id: "String",
  private_ip_address: "String",
})

Response structure


resp.association_id #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :allocation_id (String)

    [EC2-VPC] The allocation ID. This is required for EC2-VPC.

  • :instance_id (String)

    The ID of the instance. This is required for EC2-Classic. For EC2-VPC, you can specify either the instance ID or the network interface ID, but not both. The operation fails if you specify an instance ID unless exactly one network interface is attached.

  • :public_ip (String)

    The Elastic IP address. This is required for EC2-Classic.

  • :allow_reassociation (Boolean)

    [EC2-VPC] For a VPC in an EC2-Classic account, specify true to allow an Elastic IP address that is already associated with an instance or network interface to be reassociated with the specified instance or network interface. Otherwise, the operation fails. In a VPC in an EC2-VPC-only account, reassociation is automatic, therefore you can specify false to ensure the operation fails if the Elastic IP address is already associated with another resource.

  • :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_id (String)

    [EC2-VPC] The ID of the network interface. If the instance has more than one network interface, you must specify a network interface ID.

  • :private_ip_address (String)

    [EC2-VPC] The primary or secondary private IP address to associate with the Elastic IP address. If no private IP address is specified, the Elastic IP address is associated with the primary private IP address.

Returns:

See Also:



733
734
735
736
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 733

def associate_address(params = {}, options = {})
  req = build_request(:associate_address, params)
  req.send_request(options)
end

#associate_dhcp_options(params = {}) ⇒ 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:

Example: To associate a DHCP options set with a VPC


# This example associates the specified DHCP options set with the specified VPC.

resp = client.associate_dhcp_options({
  dhcp_options_id: "dopt-d9070ebb", 
  vpc_id: "vpc-a01106c2", 
})

Example: To associate the default DHCP options set with a VPC


# This example associates the default DHCP options set with the specified VPC.

resp = client.associate_dhcp_options({
  dhcp_options_id: "default", 
  vpc_id: "vpc-a01106c2", 
})

Request syntax with placeholder values


resp = client.associate_dhcp_options({
  dhcp_options_id: "String", # required
  vpc_id: "String", # required
  dry_run: false,
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :dhcp_options_id (required, String)

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

  • :vpc_id (required, String)

    The ID of 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:



801
802
803
804
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 801

def associate_dhcp_options(params = {}, options = {})
  req = build_request(:associate_dhcp_options, params)
  req.send_request(options)
end

#associate_iam_instance_profile(params = {}) ⇒ Types::AssociateIamInstanceProfileResult

Associates an IAM instance profile with a running or stopped instance. You cannot associate more than one IAM instance profile with an instance.

Examples:

Request syntax with placeholder values


resp = client.associate_iam_instance_profile({
  iam_instance_profile: { # required
    arn: "String",
    name: "String",
  },
  instance_id: "String", # required
})

Response structure


resp.iam_instance_profile_association.association_id #=> String
resp.iam_instance_profile_association.instance_id #=> String
resp.iam_instance_profile_association.iam_instance_profile.arn #=> String
resp.iam_instance_profile_association.iam_instance_profile.id #=> String
resp.iam_instance_profile_association.state #=> String, one of "associating", "associated", "disassociating", "disassociated"
resp.iam_instance_profile_association.timestamp #=> Time

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

Returns:

See Also:



843
844
845
846
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 843

def associate_iam_instance_profile(params = {}, options = {})
  req = build_request(:associate_iam_instance_profile, params)
  req.send_request(options)
end

#associate_route_table(params = {}) ⇒ Types::AssociateRouteTableResult

Associates a subnet with a route table. The subnet and route table must be in the same VPC. This association causes traffic originating from the subnet to be routed according to the routes in the route table. The action returns an association ID, which you need in order to disassociate the route table from the subnet later. A route table can be associated with multiple subnets.

For more information about route tables, see Route Tables in the Amazon Virtual Private Cloud User Guide.

Examples:

Example: To associate a route table with a subnet


# This example associates the specified route table with the specified subnet.

resp = client.associate_route_table({
  route_table_id: "rtb-22574640", 
  subnet_id: "subnet-9d4a7b6", 
})

resp.to_h outputs the following:
{
  association_id: "rtbassoc-781d0d1a", 
}

Request syntax with placeholder values


resp = client.associate_route_table({
  dry_run: false,
  route_table_id: "String", # required
  subnet_id: "String", # required
})

Response structure


resp.association_id #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :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_id (required, String)

    The ID of the route table.

  • :subnet_id (required, String)

    The ID of the subnet.

Returns:

See Also:



909
910
911
912
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 909

def associate_route_table(params = {}, options = {})
  req = build_request(:associate_route_table, params)
  req.send_request(options)
end

#associate_subnet_cidr_block(params = {}) ⇒ Types::AssociateSubnetCidrBlockResult

Associates a CIDR block with your subnet. You can only associate a single IPv6 CIDR block with your subnet. An IPv6 CIDR block must have a prefix length of /64.

Examples:

Request syntax with placeholder values


resp = client.associate_subnet_cidr_block({
  ipv_6_cidr_block: "String", # required
  subnet_id: "String", # required
})

Response structure


resp.ipv_6_cidr_block_association.association_id #=> String
resp.ipv_6_cidr_block_association.ipv_6_cidr_block #=> String
resp.ipv_6_cidr_block_association.ipv_6_cidr_block_state.state #=> String, one of "associating", "associated", "disassociating", "disassociated", "failing", "failed"
resp.ipv_6_cidr_block_association.ipv_6_cidr_block_state.status_message #=> String
resp.subnet_id #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :ipv_6_cidr_block (required, String)

    The IPv6 CIDR block for your subnet. The subnet must have a /64 prefix length.

  • :subnet_id (required, String)

    The ID of your subnet.

Returns:

See Also:



949
950
951
952
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 949

def associate_subnet_cidr_block(params = {}, options = {})
  req = build_request(:associate_subnet_cidr_block, params)
  req.send_request(options)
end

#associate_vpc_cidr_block(params = {}) ⇒ Types::AssociateVpcCidrBlockResult

Associates a CIDR block with your VPC. You can associate a secondary IPv4 CIDR block, or you can associate an Amazon-provided IPv6 CIDR block. The IPv6 CIDR block size is fixed at /56.

For more information about associating CIDR blocks with your VPC and applicable restrictions, see VPC and Subnet Sizing in the Amazon Virtual Private Cloud User Guide.

Examples:

Request syntax with placeholder values


resp = client.associate_vpc_cidr_block({
  amazon_provided_ipv_6_cidr_block: false,
  cidr_block: "String",
  vpc_id: "String", # required
})

Response structure


resp.ipv_6_cidr_block_association.association_id #=> String
resp.ipv_6_cidr_block_association.ipv_6_cidr_block #=> String
resp.ipv_6_cidr_block_association.ipv_6_cidr_block_state.state #=> String, one of "associating", "associated", "disassociating", "disassociated", "failing", "failed"
resp.ipv_6_cidr_block_association.ipv_6_cidr_block_state.status_message #=> String
resp.cidr_block_association.association_id #=> String
resp.cidr_block_association.cidr_block #=> String
resp.cidr_block_association.cidr_block_state.state #=> String, one of "associating", "associated", "disassociating", "disassociated", "failing", "failed"
resp.cidr_block_association.cidr_block_state.status_message #=> String
resp.vpc_id #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :amazon_provided_ipv_6_cidr_block (Boolean)

    Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC. You cannot specify the range of IPv6 addresses, or the size of the CIDR block.

  • :cidr_block (String)

    An IPv4 CIDR block to associate with the VPC.

  • :vpc_id (required, String)

    The ID of the VPC.

Returns:

See Also:



1007
1008
1009
1010
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 1007

def associate_vpc_cidr_block(params = {}, options = {})
  req = build_request(:associate_vpc_cidr_block, params)
  req.send_request(options)
end

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 with placeholder values


resp = client.attach_classic_link_vpc({
  dry_run: false,
  groups: ["String"], # required
  instance_id: "String", # required
  vpc_id: "String", # required
})

Response structure


resp.return #=> Boolean

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

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

  • :vpc_id (required, String)

    The ID of a ClassicLink-enabled VPC.

Returns:

See Also:



1064
1065
1066
1067
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 1064

def attach_classic_link_vpc(params = {}, options = {})
  req = build_request(:attach_classic_link_vpc, params)
  req.send_request(options)
end

#attach_internet_gateway(params = {}) ⇒ 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:

Example: To attach an Internet gateway to a VPC


# This example attaches the specified Internet gateway to the specified VPC.

resp = client.attach_internet_gateway({
  internet_gateway_id: "igw-c0a643a9", 
  vpc_id: "vpc-a01106c2", 
})

Request syntax with placeholder values


resp = client.attach_internet_gateway({
  dry_run: false,
  internet_gateway_id: "String", # required
  vpc_id: "String", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

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

  • :vpc_id (required, String)

    The ID of the VPC.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



1114
1115
1116
1117
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 1114

def attach_internet_gateway(params = {}, options = {})
  req = build_request(:attach_internet_gateway, params)
  req.send_request(options)
end

#attach_network_interface(params = {}) ⇒ Types::AttachNetworkInterfaceResult

Attaches a network interface to an instance.

Examples:

Example: To attach a network interface to an instance


# This example attaches the specified network interface to the specified instance.

resp = client.attach_network_interface({
  device_index: 1, 
  instance_id: "i-1234567890abcdef0", 
  network_interface_id: "eni-e5aa89a3", 
})

resp.to_h outputs the following:
{
  attachment_id: "eni-attach-66c4350a", 
}

Request syntax with placeholder values


resp = client.attach_network_interface({
  device_index: 1, # required
  dry_run: false,
  instance_id: "String", # required
  network_interface_id: "String", # required
})

Response structure


resp.attachment_id #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :device_index (required, Integer)

    The index of the device for the network interface attachment.

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

  • :network_interface_id (required, String)

    The ID of the network interface.

Returns:

See Also:



1173
1174
1175
1176
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 1173

def attach_network_interface(params = {}, options = {})
  req = build_request(:attach_network_interface, params)
  req.send_request(options)
end

#attach_volume(params = {}) ⇒ Types::VolumeAttachment

Attaches an EBS volume to a running or stopped instance and exposes it to the instance with the specified device name.

Encrypted EBS volumes may only be attached to instances that support Amazon EBS encryption. For more information, see Amazon EBS Encryption in the Amazon Elastic Compute Cloud User Guide.

For a list of supported device names, see Attaching an EBS Volume to an Instance. Any device names that aren't reserved for instance store volumes can be used for EBS volumes. For more information, see Amazon EC2 Instance Store in the Amazon Elastic Compute Cloud User Guide.

If a volume has an AWS Marketplace product code:

  • The volume can be attached only to a stopped instance.

  • AWS Marketplace product codes are copied from the volume to the instance.

  • You must be subscribed to the product.

  • The instance type and operating system of the instance must support the product. For example, you can't detach a volume from a Windows instance and attach it to a Linux instance.

For an overview of the AWS Marketplace, see Introducing AWS Marketplace.

For more information about EBS volumes, see Attaching Amazon EBS Volumes in the Amazon Elastic Compute Cloud User Guide.

Examples:

Example: To attach a volume to an instance


# This example attaches a volume (``vol-1234567890abcdef0``) to an instance (``i-01474ef662b89480``) as ``/dev/sdf``.

resp = client.attach_volume({
  device: "/dev/sdf", 
  instance_id: "i-01474ef662b89480", 
  volume_id: "vol-1234567890abcdef0", 
})

resp.to_h outputs the following:
{
  attach_time: Time.parse("2016-08-29T18:52:32.724Z"), 
  device: "/dev/sdf", 
  instance_id: "i-01474ef662b89480", 
  state: "attaching", 
  volume_id: "vol-1234567890abcdef0", 
}

Request syntax with placeholder values


resp = client.attach_volume({
  device: "String", # required
  instance_id: "String", # required
  volume_id: "String", # required
  dry_run: false,
})

Response structure


resp.attach_time #=> Time
resp.device #=> String
resp.instance_id #=> String
resp.state #=> String, one of "attaching", "attached", "detaching", "detached", "busy"
resp.volume_id #=> String
resp.delete_on_termination #=> Boolean

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :device (required, String)

    The device name (for example, /dev/sdh or xvdh).

  • :instance_id (required, String)

    The ID of the instance.

  • :volume_id (required, String)

    The ID of the EBS volume. The volume and instance must be within the same Availability Zone.

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



1284
1285
1286
1287
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 1284

def attach_volume(params = {}, options = {})
  req = build_request(:attach_volume, params)
  req.send_request(options)
end

#attach_vpn_gateway(params = {}) ⇒ Types::AttachVpnGatewayResult

Attaches a virtual private gateway to a VPC. You can attach one virtual private gateway to one VPC at a time.

For more information, see AWS Managed VPN Connections in the Amazon Virtual Private Cloud User Guide.

Examples:

Request syntax with placeholder values


resp = client.attach_vpn_gateway({
  vpc_id: "String", # required
  vpn_gateway_id: "String", # required
  dry_run: false,
})

Response structure


resp.vpc_attachment.state #=> String, one of "attaching", "attached", "detaching", "detached"
resp.vpc_attachment.vpc_id #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :vpc_id (required, String)

    The ID of the VPC.

  • :vpn_gateway_id (required, String)

    The ID of the virtual private gateway.

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



1332
1333
1334
1335
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 1332

def attach_vpn_gateway(params = {}, options = {})
  req = build_request(:attach_vpn_gateway, params)
  req.send_request(options)
end

#authorize_security_group_egress(params = {}) ⇒ Struct

[EC2-VPC only] Adds one or more egress rules to a security group for use with a VPC. Specifically, this action permits instances to send traffic to one or more destination IPv4 or IPv6 CIDR address ranges, or to one or more destination security groups for the same VPC. This action doesn't apply to security groups for use in EC2-Classic. For more information, see Security Groups for Your VPC in the Amazon Virtual Private Cloud User Guide. For more information about security group limits, see Amazon VPC Limits.

Each rule consists of the protocol (for example, TCP), plus either a CIDR range or a source group. For the TCP and UDP protocols, you must also specify the destination port or port range. For the ICMP protocol, you must also specify the ICMP type and code. You can use -1 for the type or code to mean all types or all codes. You can optionally specify a description for the rule.

Rule changes are propagated to affected instances as quickly as possible. However, a small delay might occur.

Examples:

Request syntax with placeholder values


resp = client.authorize_security_group_egress({
  dry_run: false,
  group_id: "String", # required
  ip_permissions: [
    {
      from_port: 1,
      ip_protocol: "String",
      ip_ranges: [
        {
          cidr_ip: "String",
          description: "String",
        },
      ],
      ipv_6_ranges: [
        {
          cidr_ipv_6: "String",
          description: "String",
        },
      ],
      prefix_list_ids: [
        {
          description: "String",
          prefix_list_id: "String",
        },
      ],
      to_port: 1,
      user_id_group_pairs: [
        {
          description: "String",
          group_id: "String",
          group_name: "String",
          peering_status: "String",
          user_id: "String",
          vpc_id: "String",
          vpc_peering_connection_id: "String",
        },
      ],
    },
  ],
  cidr_ip: "String",
  from_port: 1,
  ip_protocol: "String",
  to_port: 1,
  source_security_group_name: "String",
  source_security_group_owner_id: "String",
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

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

  • :group_id (required, String)

    The ID of the security group.

  • :ip_permissions (Array<Types::IpPermission>)

    One or more sets of IP permissions. You can't specify a destination security group and a CIDR IP address range in the same set of permissions.

  • :cidr_ip (String)

    Not supported. Use a set of IP permissions to specify the CIDR.

  • :from_port (Integer)

    Not supported. Use a set of IP permissions to specify the port.

  • :ip_protocol (String)

    Not supported. Use a set of IP permissions to specify the protocol name or number.

  • :to_port (Integer)

    Not supported. Use a set of IP permissions to specify the port.

  • :source_security_group_name (String)

    Not supported. Use a set of IP permissions to specify a destination security group.

  • :source_security_group_owner_id (String)

    Not supported. Use a set of IP permissions to specify a destination security group.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



1451
1452
1453
1454
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 1451

def authorize_security_group_egress(params = {}, options = {})
  req = build_request(:authorize_security_group_egress, params)
  req.send_request(options)
end

#authorize_security_group_ingress(params = {}) ⇒ Struct

Adds one or more ingress rules to a security group.

Rule changes are propagated to instances within the security group as quickly as possible. However, a small delay might occur.

[EC2-Classic] This action gives one or more IPv4 CIDR address ranges permission to access a security group in your account, or gives one or more security groups (called the source groups) permission to access a security group for your account. A source group can be for your own AWS account, or another. You can have up to 100 rules per group.

[EC2-VPC] This action gives one or more IPv4 or IPv6 CIDR address ranges permission to access a security group in your VPC, or gives one or more other security groups (called the source groups) permission to access a security group for your VPC. The security groups must all be for the same VPC or a peer VPC in a VPC peering connection. For more information about VPC security group limits, see Amazon VPC Limits.

You can optionally specify a description for the security group rule.

Examples:

Request syntax with placeholder values


resp = client.authorize_security_group_ingress({
  cidr_ip: "String",
  from_port: 1,
  group_id: "String",
  group_name: "String",
  ip_permissions: [
    {
      from_port: 1,
      ip_protocol: "String",
      ip_ranges: [
        {
          cidr_ip: "String",
          description: "String",
        },
      ],
      ipv_6_ranges: [
        {
          cidr_ipv_6: "String",
          description: "String",
        },
      ],
      prefix_list_ids: [
        {
          description: "String",
          prefix_list_id: "String",
        },
      ],
      to_port: 1,
      user_id_group_pairs: [
        {
          description: "String",
          group_id: "String",
          group_name: "String",
          peering_status: "String",
          user_id: "String",
          vpc_id: "String",
          vpc_peering_connection_id: "String",
        },
      ],
    },
  ],
  ip_protocol: "String",
  source_security_group_name: "String",
  source_security_group_owner_id: "String",
  to_port: 1,
  dry_run: false,
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :cidr_ip (String)

    The CIDR IPv4 address range. You can't specify this parameter when specifying a source security group.

  • :from_port (Integer)

    The start of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 type number. For the ICMP/ICMPv6 type number, use -1 to specify all types. If you specify all ICMP/ICMPv6 types, you must specify all codes.

  • :group_id (String)

    The ID of the security group. You must specify either the security group ID or the security group name in the request. For security groups in a nondefault VPC, you must specify the security group ID.

  • :group_name (String)

    [EC2-Classic, default VPC] The name of the security group. You must specify either the security group ID or the security group name in the request.

  • :ip_permissions (Array<Types::IpPermission>)

    One or more sets of IP permissions. Can be used to specify multiple rules in a single command.

  • :ip_protocol (String)

    The IP protocol name (tcp, udp, icmp) or number (see Protocol Numbers). (VPC only) Use -1 to specify all protocols. If you specify -1, or a protocol number other than tcp, udp, icmp, or 58 (ICMPv6), traffic on all ports is allowed, regardless of any ports you specify. For tcp, udp, and icmp, you must specify a port range. For protocol 58 (ICMPv6), you can optionally specify a port range; if you don't, traffic for all types and codes is allowed.

  • :source_security_group_name (String)

    [EC2-Classic, default VPC] The name of the source security group. You can't specify this parameter in combination with the following parameters: the CIDR IP address range, the start of the port range, the IP protocol, and the end of the port range. Creates rules that grant full ICMP, UDP, and TCP access. To create a rule with a specific IP protocol and port range, use a set of IP permissions instead. For EC2-VPC, the source security group must be in the same VPC.

  • :source_security_group_owner_id (String)

    [EC2-Classic] The AWS account ID for the source security group, if the source security group is in a different account. You can't specify this parameter in combination with the following parameters: the CIDR IP address range, the IP protocol, the start of the port range, and the end of the port range. Creates rules that grant full ICMP, UDP, and TCP access. To create a rule with a specific IP protocol and port range, use a set of IP permissions instead.

  • :to_port (Integer)

    The end of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 code number. For the ICMP/ICMPv6 code number, use -1 to specify all codes. If you specify all ICMP/ICMPv6 types, you must specify all codes.

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



1604
1605
1606
1607
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 1604

def authorize_security_group_ingress(params = {}, options = {})
  req = build_request(:authorize_security_group_ingress, params)
  req.send_request(options)
end

#bundle_instance(params = {}) ⇒ Types::BundleInstanceResult

Bundles an Amazon instance store-backed Windows instance.

During bundling, only the root device volume (C:\) is bundled. Data on other instance store volumes is not preserved.

This action is not applicable for Linux/Unix instances or Windows instances that are backed by Amazon EBS.

For more information, see Creating an Instance Store-Backed Windows AMI.

Examples:

Request syntax with placeholder values


resp = client.bundle_instance({
  instance_id: "String", # required
  storage: { # required
    s3: {
      aws_access_key_id: "String",
      bucket: "String",
      prefix: "String",
      upload_policy: "data",
      upload_policy_signature: "String",
    },
  },
  dry_run: false,
})

Response structure


resp.bundle_task.bundle_id #=> String
resp.bundle_task.bundle_task_error.code #=> String
resp.bundle_task.bundle_task_error.message #=> String
resp.bundle_task.instance_id #=> String
resp.bundle_task.progress #=> String
resp.bundle_task.start_time #=> Time
resp.bundle_task.state #=> String, one of "pending", "waiting-for-shutdown", "bundling", "storing", "cancelling", "complete", "failed"
resp.bundle_task.storage.s3.aws_access_key_id #=> String
resp.bundle_task.storage.s3.bucket #=> String
resp.bundle_task.storage.s3.prefix #=> String
resp.bundle_task.storage.s3.upload_policy #=> String
resp.bundle_task.storage.s3.upload_policy_signature #=> String
resp.bundle_task.update_time #=> Time

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :instance_id (required, String)

    The ID of the instance to bundle.

    Type: String

    Default: None

    Required: Yes

  • :storage (required, Types::Storage)

    The bucket in which to store the AMI. You can specify a bucket that you already own or a new bucket that Amazon EC2 creates on your behalf. If you specify a bucket that belongs to someone else, Amazon EC2 returns an error.

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



1687
1688
1689
1690
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 1687

def bundle_instance(params = {}, options = {})
  req = build_request(:bundle_instance, params)
  req.send_request(options)
end

#cancel_bundle_task(params = {}) ⇒ Types::CancelBundleTaskResult

Cancels a bundling operation for an instance store-backed Windows instance.

Examples:

Request syntax with placeholder values


resp = client.cancel_bundle_task({
  bundle_id: "String", # required
  dry_run: false,
})

Response structure


resp.bundle_task.bundle_id #=> String
resp.bundle_task.bundle_task_error.code #=> String
resp.bundle_task.bundle_task_error.message #=> String
resp.bundle_task.instance_id #=> String
resp.bundle_task.progress #=> String
resp.bundle_task.start_time #=> Time
resp.bundle_task.state #=> String, one of "pending", "waiting-for-shutdown", "bundling", "storing", "cancelling", "complete", "failed"
resp.bundle_task.storage.s3.aws_access_key_id #=> String
resp.bundle_task.storage.s3.bucket #=> String
resp.bundle_task.storage.s3.prefix #=> String
resp.bundle_task.storage.s3.upload_policy #=> String
resp.bundle_task.storage.s3.upload_policy_signature #=> String
resp.bundle_task.update_time #=> Time

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :bundle_id (required, String)

    The ID of the bundle task.

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



1735
1736
1737
1738
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 1735

def cancel_bundle_task(params = {}, options = {})
  req = build_request(:cancel_bundle_task, params)
  req.send_request(options)
end

#cancel_conversion_task(params = {}) ⇒ Struct

Cancels an active conversion task. The task can be the import of an instance or volume. The action removes all artifacts of the conversion, including a partially uploaded volume or instance. If the conversion is complete or is in the process of transferring the final disk image, the command fails and returns an exception.

For more information, see Importing a Virtual Machine Using the Amazon EC2 CLI.

Examples:

Request syntax with placeholder values


resp = client.cancel_conversion_task({
  conversion_task_id: "String", # required
  dry_run: false,
  reason_message: "String",
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :conversion_task_id (required, String)

    The ID of the conversion task.

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

  • :reason_message (String)

    The reason for canceling the conversion task.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



1779
1780
1781
1782
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 1779

def cancel_conversion_task(params = {}, options = {})
  req = build_request(:cancel_conversion_task, params)
  req.send_request(options)
end

#cancel_export_task(params = {}) ⇒ Struct

Cancels an active export task. The request removes all artifacts of the export, including any partially-created Amazon S3 objects. If the export task is complete or is in the process of transferring the final disk image, the command fails and returns an error.

Examples:

Request syntax with placeholder values


resp = client.cancel_export_task({
  export_task_id: "String", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :export_task_id (required, String)

    The ID of the export task. This is the ID returned by CreateInstanceExportTask.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



1805
1806
1807
1808
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 1805

def cancel_export_task(params = {}, options = {})
  req = build_request(:cancel_export_task, params)
  req.send_request(options)
end

#cancel_import_task(params = {}) ⇒ Types::CancelImportTaskResult

Cancels an in-process import virtual machine or import snapshot task.

Examples:

Request syntax with placeholder values


resp = client.cancel_import_task({
  cancel_reason: "String",
  dry_run: false,
  import_task_id: "String",
})

Response structure


resp.import_task_id #=> String
resp.previous_state #=> String
resp.state #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :cancel_reason (String)

    The reason for canceling the task.

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

  • :import_task_id (String)

    The ID of the import image or import snapshot task to be canceled.

Returns:

See Also:



1848
1849
1850
1851
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 1848

def cancel_import_task(params = {}, options = {})
  req = build_request(:cancel_import_task, params)
  req.send_request(options)
end

#cancel_reserved_instances_listing(params = {}) ⇒ Types::CancelReservedInstancesListingResult

Cancels the specified Reserved Instance listing in the Reserved Instance Marketplace.

For more information, see Reserved Instance Marketplace in the Amazon Elastic Compute Cloud User Guide.

Examples:

Request syntax with placeholder values


resp = client.cancel_reserved_instances_listing({
  reserved_instances_listing_id: "String", # required
})

Response structure


resp.reserved_instances_listings #=> Array
resp.reserved_instances_listings[0].client_token #=> String
resp.reserved_instances_listings[0].create_date #=> Time
resp.reserved_instances_listings[0].instance_counts #=> Array
resp.reserved_instances_listings[0].instance_counts[0].instance_count #=> Integer
resp.reserved_instances_listings[0].instance_counts[0].state #=> String, one of "available", "sold", "cancelled", "pending"
resp.reserved_instances_listings[0].price_schedules #=> Array
resp.reserved_instances_listings[0].price_schedules[0].active #=> Boolean
resp.reserved_instances_listings[0].price_schedules[0].currency_code #=> String, one of "USD"
resp.reserved_instances_listings[0].price_schedules[0].price #=> Float
resp.reserved_instances_listings[0].price_schedules[0].term #=> Integer
resp.reserved_instances_listings[0].reserved_instances_id #=> String
resp.reserved_instances_listings[0].reserved_instances_listing_id #=> String
resp.reserved_instances_listings[0].status #=> String, one of "active", "pending", "cancelled", "closed"
resp.reserved_instances_listings[0].status_message #=> String
resp.reserved_instances_listings[0].tags #=> Array
resp.reserved_instances_listings[0].tags[0].key #=> String
resp.reserved_instances_listings[0].tags[0].value #=> String
resp.reserved_instances_listings[0].update_date #=> Time

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :reserved_instances_listing_id (required, String)

    The ID of the Reserved Instance listing.

Returns:

See Also:



1902
1903
1904
1905
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 1902

def cancel_reserved_instances_listing(params = {}, options = {})
  req = build_request(:cancel_reserved_instances_listing, params)
  req.send_request(options)
end

#cancel_spot_fleet_requests(params = {}) ⇒ Types::CancelSpotFleetRequestsResponse

Cancels the specified Spot Fleet requests.

After you cancel a Spot Fleet request, the Spot Fleet launches no new Spot Instances. You must specify whether the Spot Fleet should also terminate its Spot Instances. If you terminate the instances, the Spot Fleet request enters the cancelled_terminating state. Otherwise, the Spot Fleet request enters the cancelled_running state and the instances continue to run until they are interrupted or you terminate them manually.

Examples:

Example: To cancel a Spot fleet request


# This example cancels the specified Spot fleet request and terminates its associated Spot Instances.

resp = client.cancel_spot_fleet_requests({
  spot_fleet_request_ids: [
    "sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE", 
  ], 
  terminate_instances: true, 
})

resp.to_h outputs the following:
{
  successful_fleet_requests: [
    {
      current_spot_fleet_request_state: "cancelled_running", 
      previous_spot_fleet_request_state: "active", 
      spot_fleet_request_id: "sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE", 
    }, 
  ], 
}

Example: To cancel a Spot fleet request without terminating its Spot Instances


# This example cancels the specified Spot fleet request without terminating its associated Spot Instances.

resp = client.cancel_spot_fleet_requests({
  spot_fleet_request_ids: [
    "sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE", 
  ], 
  terminate_instances: false, 
})

resp.to_h outputs the following:
{
  successful_fleet_requests: [
    {
      current_spot_fleet_request_state: "cancelled_terminating", 
      previous_spot_fleet_request_state: "active", 
      spot_fleet_request_id: "sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.cancel_spot_fleet_requests({
  dry_run: false,
  spot_fleet_request_ids: ["String"], # required
  terminate_instances: false, # required
})

Response structure


resp.successful_fleet_requests #=> Array
resp.successful_fleet_requests[0].current_spot_fleet_request_state #=> String, one of "submitted", "active", "cancelled", "failed", "cancelled_running", "cancelled_terminating", "modifying"
resp.successful_fleet_requests[0].previous_spot_fleet_request_state #=> String, one of "submitted", "active", "cancelled", "failed", "cancelled_running", "cancelled_terminating", "modifying"
resp.successful_fleet_requests[0].spot_fleet_request_id #=> String
resp.unsuccessful_fleet_requests #=> Array
resp.unsuccessful_fleet_requests[0].error.code #=> String, one of "fleetRequestIdDoesNotExist", "fleetRequestIdMalformed", "fleetRequestNotInCancellableState", "unexpectedError"
resp.unsuccessful_fleet_requests[0].error.message #=> String
resp.unsuccessful_fleet_requests[0].spot_fleet_request_id #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

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

  • :spot_fleet_request_ids (required, Array<String>)

    The IDs of the Spot Fleet requests.

  • :terminate_instances (required, Boolean)

    Indicates whether to terminate instances for a Spot Fleet request if it is canceled successfully.

Returns:

See Also:



2003
2004
2005
2006
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 2003

def cancel_spot_fleet_requests(params = {}, options = {})
  req = build_request(:cancel_spot_fleet_requests, params)
  req.send_request(options)
end

#cancel_spot_instance_requests(params = {}) ⇒ Types::CancelSpotInstanceRequestsResult

Cancels one or more Spot Instance requests. Spot Instances are instances that Amazon EC2 starts on your behalf when the maximum price that you specify exceeds the current Spot price. For more information, see Spot Instance Requests in the Amazon Elastic Compute Cloud User Guide.

Canceling a Spot Instance request does not terminate running Spot Instances associated with the request.

Examples:

Example: To cancel Spot Instance requests


# This example cancels a Spot Instance request.

resp = client.cancel_spot_instance_requests({
  spot_instance_request_ids: [
    "sir-08b93456", 
  ], 
})

resp.to_h outputs the following:
{
  cancelled_spot_instance_requests: [
    {
      spot_instance_request_id: "sir-08b93456", 
      state: "cancelled", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.cancel_spot_instance_requests({
  dry_run: false,
  spot_instance_request_ids: ["String"], # required
})

Response structure


resp.cancelled_spot_instance_requests #=> Array
resp.cancelled_spot_instance_requests[0].spot_instance_request_id #=> String
resp.cancelled_spot_instance_requests[0].state #=> String, one of "active", "open", "closed", "cancelled", "completed"

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

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

  • :spot_instance_request_ids (required, Array<String>)

    One or more Spot Instance request IDs.

Returns:

See Also:



2072
2073
2074
2075
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 2072

def cancel_spot_instance_requests(params = {}, options = {})
  req = build_request(:cancel_spot_instance_requests, params)
  req.send_request(options)
end

#confirm_product_instance(params = {}) ⇒ Types::ConfirmProductInstanceResult

Determines whether a product code is associated with an instance. This action can only be used by the owner of the product code. It is useful when a product code owner must verify whether another user's instance is eligible for support.

Examples:

Example: To confirm the product instance


# This example determines whether the specified product code is associated with the specified instance.

resp = client.confirm_product_instance({
  instance_id: "i-1234567890abcdef0", 
  product_code: "774F4FF8", 
})

resp.to_h outputs the following:
{
  owner_id: "123456789012", 
}

Request syntax with placeholder values


resp = client.confirm_product_instance({
  instance_id: "String", # required
  product_code: "String", # required
  dry_run: false,
})

Response structure


resp.owner_id #=> String
resp.return #=> Boolean

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :instance_id (required, String)

    The ID of the instance.

  • :product_code (required, String)

    The product code. This must be a product code that you own.

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



2131
2132
2133
2134
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 2131

def confirm_product_instance(params = {}, options = {})
  req = build_request(:confirm_product_instance, params)
  req.send_request(options)
end

#copy_fpga_image(params = {}) ⇒ Types::CopyFpgaImageResult

Copies the specified Amazon FPGA Image (AFI) to the current region.

Examples:

Request syntax with placeholder values


resp = client.copy_fpga_image({
  dry_run: false,
  source_fpga_image_id: "String", # required
  description: "String",
  name: "String",
  source_region: "String", # required
  client_token: "String",
})

Response structure


resp.fpga_image_id #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

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

  • :source_fpga_image_id (required, String)

    The ID of the source AFI.

  • :description (String)

    The description for the new AFI.

  • :name (String)

    The name for the new AFI. The default is the name of the source AFI.

  • :source_region (required, String)

    The region that contains the source AFI.

  • :client_token (String)

    Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see Ensuring Idempotency.

Returns:

See Also:



2188
2189
2190
2191
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 2188

def copy_fpga_image(params = {}, options = {})
  req = build_request(:copy_fpga_image, params)
  req.send_request(options)
end

#copy_image(params = {}) ⇒ Types::CopyImageResult

Initiates the copy of an AMI from the specified source region to the current region. You specify the destination region by using its endpoint when making the request.

For more information about the prerequisites and limits when copying an AMI, see Copying an AMI in the Amazon Elastic Compute Cloud User Guide.

Examples:

Request syntax with placeholder values


resp = client.copy_image({
  client_token: "String",
  description: "String",
  encrypted: false,
  kms_key_id: "String",
  name: "String", # required
  source_image_id: "String", # required
  source_region: "String", # required
  dry_run: false,
})

Response structure


resp.image_id #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :client_token (String)

    Unique, case-sensitive identifier you provide to ensure idempotency of the request. For more information, see How to Ensure Idempotency in the Amazon Elastic Compute Cloud User Guide.

  • :description (String)

    A description for the new AMI in the destination region.

  • :encrypted (Boolean)

    Specifies whether the destination snapshots of the copied image should be encrypted. The default CMK for EBS is used unless a non-default AWS Key Management Service (AWS KMS) CMK is specified with KmsKeyId. For more information, see Amazon EBS Encryption in the Amazon Elastic Compute Cloud User Guide.

  • :kms_key_id (String)

    The full ARN of the AWS Key Management Service (AWS KMS) CMK to use when encrypting the snapshots of an image during a copy operation. This parameter is only required if you want to use a non-default CMK; if this parameter is not specified, the default CMK for EBS is used. The ARN contains the arn:aws:kms namespace, followed by the region of the CMK, the AWS account ID of the CMK owner, the key namespace, and then the CMK ID. For example, arn:aws:kms:us-east-1:012345678910:key/abcd1234-a123-456a-a12b-a123b4cd56ef. The specified CMK must exist in the region that the snapshot is being copied to. If a KmsKeyId is specified, the Encrypted flag must also be set.

  • :name (required, String)

    The name of the new AMI in the destination region.

  • :source_image_id (required, String)

    The ID of the AMI to copy.

  • :source_region (required, String)

    The name of the region that contains the AMI to copy.

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



2281
2282
2283
2284
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 2281

def copy_image(params = {}, options = {})
  req = build_request(:copy_image, params)
  req.send_request(options)
end

#copy_snapshot(params = {}) ⇒ Types::CopySnapshotResult

Copies a point-in-time snapshot of an EBS volume and stores it in Amazon S3. You can copy the snapshot within the same region or from one region to another. You can use the snapshot to create EBS volumes or Amazon Machine Images (AMIs). The snapshot is copied to the regional endpoint that you send the HTTP request to.

Copies of encrypted EBS snapshots remain encrypted. Copies of unencrypted snapshots remain unencrypted, unless the Encrypted flag is specified during the snapshot copy operation. By default, encrypted snapshot copies use the default AWS Key Management Service (AWS KMS) customer master key (CMK); however, you can specify a non-default CMK with the KmsKeyId parameter.

To copy an encrypted snapshot that has been shared from another account, you must have permissions for the CMK used to encrypt the snapshot.

Snapshots created by the CopySnapshot action have an arbitrary volume ID that should not be used for any purpose.

For more information, see Copying an Amazon EBS Snapshot in the Amazon Elastic Compute Cloud User Guide.

Examples:

Example: To copy a snapshot


# This example copies a snapshot with the snapshot ID of ``snap-066877671789bd71b`` from the ``us-west-2`` region to the
# ``us-east-1`` region and adds a short description to identify the snapshot.

resp = client.copy_snapshot({
  description: "This is my copied snapshot.", 
  destination_region: "us-east-1", 
  source_region: "us-west-2", 
  source_snapshot_id: "snap-066877671789bd71b", 
})

resp.to_h outputs the following:
{
  snapshot_id: "snap-066877671789bd71b", 
}

Copy snapshot example

source_snapshot_id = 'snapshot-id'
source_region = 'us-east-1'
target_region = 'us-west-2'

# You must configure your EC2 client for the destination region to copy
ec2 = Aws::EC2::Client(region: target_region)

resp = ec2.copy_snapshot({
    source_region: source_region,
    source_snapshot_id: source_snapshot_id,
})

snapshot_id = resp.snapshot_id

ec2.wait_until(:snapshot_completed, snapshot_ids: [snapshot_id])

Copy an encrypted snapshot

# same as above, expect you must pass `encrypted: true`
resp = ec2.copy_snapshot({
    source_region: source_region,
    source_snapshot_id: source_snapshot_id,
    encrypted: true, # required for encrypted snapshots
})

Request syntax with placeholder values


resp = client.copy_snapshot({
  description: "String",
  destination_region: "String",
  encrypted: false,
  kms_key_id: "String",
  presigned_url: "String",
  source_region: "String", # required
  source_snapshot_id: "String", # required
  dry_run: false,
})

Response structure


resp.snapshot_id #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :description (String)

    A description for the EBS snapshot.

  • :destination_region (String)

    The destination region to use in the PresignedUrl parameter of a snapshot copy operation. This parameter is only valid for specifying the destination region in a PresignedUrl parameter, where it is required.

    CopySnapshot sends the snapshot copy to the regional endpoint that you send the HTTP request to, such as ec2.us-east-1.amazonaws.com (in the AWS CLI, this is specified with the --region parameter or the default region in your AWS configuration file).

  • :encrypted (Boolean)

    Specifies whether the destination snapshot should be encrypted. You can encrypt a copy of an unencrypted snapshot using this flag, but you cannot use it to create an unencrypted copy from an encrypted snapshot. Your default CMK for EBS is used unless a non-default AWS Key Management Service (AWS KMS) CMK is specified with KmsKeyId. For more information, see Amazon EBS Encryption in the Amazon Elastic Compute Cloud User Guide.

  • :kms_key_id (String)

    The full ARN of the AWS Key Management Service (AWS KMS) CMK to use when creating the snapshot copy. This parameter is only required if you want to use a non-default CMK; if this parameter is not specified, the default CMK for EBS is used. The ARN contains the arn:aws:kms namespace, followed by the region of the CMK, the AWS account ID of the CMK owner, the key namespace, and then the CMK ID. For example, arn:aws:kms:us-east-1:012345678910:key/abcd1234-a123-456a-a12b-a123b4cd56ef. The specified CMK must exist in the region that the snapshot is being copied to. If a KmsKeyId is specified, the Encrypted flag must also be set.

  • :presigned_url (String)

    The pre-signed URL that facilitates copying an encrypted snapshot. This parameter is only required when copying an encrypted snapshot with the Amazon EC2 Query API; it is available as an optional parameter in all other cases. The PresignedUrl should use the snapshot source endpoint, the CopySnapshot action, and include the SourceRegion, SourceSnapshotId, and DestinationRegion parameters. The PresignedUrl must be signed using AWS Signature Version 4. Because EBS snapshots are stored in Amazon S3, the signing algorithm for this parameter uses the same logic that is described in Authenticating Requests by Using Query Parameters (AWS Signature Version 4) in the Amazon Simple Storage Service API Reference. An invalid or improperly signed PresignedUrl will cause the copy operation to fail asynchronously, and the snapshot will move to an error state.

  • :source_region (required, String)

    The ID of the region that contains the snapshot to be copied.

  • :source_snapshot_id (required, String)

    The ID of the EBS snapshot to copy.

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



2458
2459
2460
2461
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 2458

def copy_snapshot(params = {}, options = {})
  req = build_request(:copy_snapshot, params)
  req.send_request(options)
end

#create_customer_gateway(params = {}) ⇒ Types::CreateCustomerGatewayResult

Provides information to AWS about your VPN customer gateway device. The customer gateway is the appliance at your end of the VPN connection. (The device on the AWS side of the VPN connection is the virtual private gateway.) You must provide the Internet-routable IP address of the customer gateway's external interface. The IP address must be static and may be behind a device performing network address translation (NAT).

For devices that use Border Gateway Protocol (BGP), you can also provide the device's BGP Autonomous System Number (ASN). You can use an existing ASN assigned to your network. If you don't have an ASN already, you can use a private ASN (in the 64512 - 65534 range).

Amazon EC2 supports all 2-byte ASN numbers in the range of 1 - 65534, with the exception of 7224, which is reserved in the us-east-1 region, and 9059, which is reserved in the eu-west-1 region.

For more information about VPN customer gateways, see AWS Managed VPN Connections in the Amazon Virtual Private Cloud User Guide.

You cannot create more than one customer gateway with the same VPN type, IP address, and BGP ASN parameter values. If you run an identical request more than one time, the first request creates the customer gateway, and subsequent requests return information about the existing customer gateway. The subsequent requests do not create new customer gateway resources.

Examples:

Example: To create a customer gateway


# This example creates a customer gateway with the specified IP address for its outside interface.

resp = client.create_customer_gateway({
  bgp_asn: 65534, 
  public_ip: "12.1.2.3", 
  type: "ipsec.1", 
})

resp.to_h outputs the following:
{
  customer_gateway: {
    bgp_asn: "65534", 
    customer_gateway_id: "cgw-0e11f167", 
    ip_address: "12.1.2.3", 
    state: "available", 
    type: "ipsec.1", 
  }, 
}

Request syntax with placeholder values


resp = client.create_customer_gateway({
  bgp_asn: 1, # required
  public_ip: "String", # required
  type: "ipsec.1", # required, accepts ipsec.1
  dry_run: false,
})

Response structure


resp.customer_gateway.bgp_asn #=> String
resp.customer_gateway.customer_gateway_id #=> String
resp.customer_gateway.ip_address #=> String
resp.customer_gateway.state #=> String
resp.customer_gateway.type #=> String
resp.customer_gateway.tags #=> Array
resp.customer_gateway.tags[0].key #=> String
resp.customer_gateway.tags[0].value #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :bgp_asn (required, Integer)

    For devices that support BGP, the customer gateway's BGP ASN.

    Default: 65000

  • :public_ip (required, String)

    The Internet-routable IP address for the customer gateway's outside interface. The address must be static.

  • :type (required, String)

    The type of VPN connection that this customer gateway supports (ipsec.1).

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



2565
2566
2567
2568
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 2565

def create_customer_gateway(params = {}, options = {})
  req = build_request(:create_customer_gateway, params)
  req.send_request(options)
end

#create_default_subnet(params = {}) ⇒ Types::CreateDefaultSubnetResult

Creates a default subnet with a size /20 IPv4 CIDR block in the specified Availability Zone in your default VPC. You can have only one default subnet per Availability Zone. For more information, see Creating a Default Subnet in the Amazon Virtual Private Cloud User Guide.

Examples:

Request syntax with placeholder values


resp = client.create_default_subnet({
  availability_zone: "String", # required
  dry_run: false,
})

Response structure


resp.subnet.availability_zone #=> String
resp.subnet.available_ip_address_count #=> Integer
resp.subnet.cidr_block #=> String
resp.subnet.default_for_az #=> Boolean
resp.subnet.map_public_ip_on_launch #=> Boolean
resp.subnet.state #=> String, one of "pending", "available"
resp.subnet.subnet_id #=> String
resp.subnet.vpc_id #=> String
resp.subnet.assign_ipv_6_address_on_creation #=> Boolean
resp.subnet.ipv_6_cidr_block_association_set #=> Array
resp.subnet.ipv_6_cidr_block_association_set[0].association_id #=> String
resp.subnet.ipv_6_cidr_block_association_set[0].ipv_6_cidr_block #=> String
resp.subnet.ipv_6_cidr_block_association_set[0].ipv_6_cidr_block_state.state #=> String, one of "associating", "associated", "disassociating", "disassociated", "failing", "failed"
resp.subnet.ipv_6_cidr_block_association_set[0].ipv_6_cidr_block_state.status_message #=> String
resp.subnet.tags #=> Array
resp.subnet.tags[0].key #=> String
resp.subnet.tags[0].value #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :availability_zone (required, String)

    The Availability Zone in which to create the default subnet.

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



2624
2625
2626
2627
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 2624

def create_default_subnet(params = {}, options = {})
  req = build_request(:create_default_subnet, params)
  req.send_request(options)
end

#create_default_vpc(params = {}) ⇒ Types::CreateDefaultVpcResult

Creates a default VPC with a size /16 IPv4 CIDR block and a default subnet in each Availability Zone. For more information about the components of a default VPC, see Default VPC and Default Subnets in the Amazon Virtual Private Cloud User Guide. You cannot specify the components of the default VPC yourself.

You can create a default VPC if you deleted your previous default VPC. You cannot have more than one default VPC per region.

If your account supports EC2-Classic, you cannot use this action to create a default VPC in a region that supports EC2-Classic. If you want a default VPC in a region that supports EC2-Classic, see "I really want a default VPC for my existing EC2 account. Is that possible?" in the Default VPCs FAQ.

Examples:

Request syntax with placeholder values


resp = client.create_default_vpc({
  dry_run: false,
})

Response structure


resp.vpc.cidr_block #=> String
resp.vpc.dhcp_options_id #=> String
resp.vpc.state #=> String, one of "pending", "available"
resp.vpc.vpc_id #=> String
resp.vpc.instance_tenancy #=> String, one of "default", "dedicated", "host"
resp.vpc.ipv_6_cidr_block_association_set #=> Array
resp.vpc.ipv_6_cidr_block_association_set[0].association_id #=> String
resp.vpc.ipv_6_cidr_block_association_set[0].ipv_6_cidr_block #=> String
resp.vpc.ipv_6_cidr_block_association_set[0].ipv_6_cidr_block_state.state #=> String, one of "associating", "associated", "disassociating", "disassociated", "failing", "failed"
resp.vpc.ipv_6_cidr_block_association_set[0].ipv_6_cidr_block_state.status_message #=> String
resp.vpc.cidr_block_association_set #=> Array
resp.vpc.cidr_block_association_set[0].association_id #=> String
resp.vpc.cidr_block_association_set[0].cidr_block #=> String
resp.vpc.cidr_block_association_set[0].cidr_block_state.state #=> String, one of "associating", "associated", "disassociating", "disassociated", "failing", "failed"
resp.vpc.cidr_block_association_set[0].cidr_block_state.status_message #=> String
resp.vpc.is_default #=> Boolean
resp.vpc.tags #=> Array
resp.vpc.tags[0].key #=> String
resp.vpc.tags[0].value #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

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



2691
2692
2693
2694
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 2691

def create_default_vpc(params = {}, options = {})
  req = build_request(:create_default_vpc, params)
  req.send_request(options)
end

#create_dhcp_options(params = {}) ⇒ Types::CreateDhcpOptionsResult

Creates a set of DHCP options for your VPC. After creating the set, you must associate it with the VPC, causing all existing and new instances that you launch in the VPC to use this set of DHCP options. The following are the individual DHCP options you can specify. For more information about the options, see RFC 2132.

  • domain-name-servers - The IP addresses of up to four domain name servers, or AmazonProvidedDNS. The default DHCP option set specifies AmazonProvidedDNS. If specifying more than one domain name server, specify the IP addresses in a single parameter, separated by commas. If you want your instance to receive a custom DNS hostname as specified in domain-name, you must set domain-name-servers to a custom DNS server.

  • domain-name - If you're using AmazonProvidedDNS in us-east-1, specify ec2.internal. If you're using AmazonProvidedDNS in another region, specify region.compute.internal (for example, ap-northeast-1.compute.internal). Otherwise, specify a domain name (for example, MyCompany.com). This value is used to complete unqualified DNS hostnames. Important: Some Linux operating systems accept multiple domain names separated by spaces. However, Windows and other Linux operating systems treat the value as a single domain, which results in unexpected behavior. If your DHCP options set is associated with a VPC that has instances with multiple operating systems, specify only one domain name.

  • ntp-servers - The IP addresses of up to four Network Time Protocol (NTP) servers.

  • netbios-name-servers - The IP addresses of up to four NetBIOS name servers.

  • netbios-node-type - The NetBIOS node type (1, 2, 4, or 8). We recommend that you specify 2 (broadcast and multicast are not currently supported). For more information about these node types, see RFC 2132.

Your VPC automatically starts out with a set of DHCP options that includes only a DNS server that we provide (AmazonProvidedDNS). If you create a set of options, and if your VPC has an Internet gateway, make sure to set the domain-name-servers option either to AmazonProvidedDNS or to a domain name server of your choice. For more information about DHCP options, see DHCP Options Sets in the Amazon Virtual Private Cloud User Guide.

Examples:

Example: To create a DHCP options set


# This example creates a DHCP options set.

resp = client.create_dhcp_options({
  dhcp_configurations: [
    {
      key: "domain-name-servers", 
      values: [
        "10.2.5.1", 
        "10.2.5.2", 
      ], 
    }, 
  ], 
})

resp.to_h outputs the following:
{
  dhcp_options: {
    dhcp_configurations: [
      {
        key: "domain-name-servers", 
        values: [
          {
            value: "10.2.5.2", 
          }, 
          {
            value: "10.2.5.1", 
          }, 
        ], 
      }, 
    ], 
    dhcp_options_id: "dopt-d9070ebb", 
  }, 
}

Request syntax with placeholder values


resp = client.create_dhcp_options({
  dhcp_configurations: [ # required
    {
      key: "String",
      values: ["String"],
    },
  ],
  dry_run: false,
})

Response structure


resp.dhcp_options.dhcp_configurations #=> Array
resp.dhcp_options.dhcp_configurations[0].key #=> String
resp.dhcp_options.dhcp_configurations[0].values #=> Array
resp.dhcp_options.dhcp_configurations[0].values[0] #=> <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
resp.dhcp_options.dhcp_options_id #=> String
resp.dhcp_options.tags #=> Array
resp.dhcp_options.tags[0].key #=> String
resp.dhcp_options.tags[0].value #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :dhcp_configurations (required, Array<Types::NewDhcpConfiguration>)

    A DHCP configuration option.

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



2823
2824
2825
2826
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 2823

def create_dhcp_options(params = {}, options = {})
  req = build_request(:create_dhcp_options, params)
  req.send_request(options)
end

#create_egress_only_internet_gateway(params = {}) ⇒ Types::CreateEgressOnlyInternetGatewayResult

[IPv6 only] Creates an egress-only Internet gateway for your VPC. An egress-only Internet gateway is used to enable outbound communication over IPv6 from instances in your VPC to the Internet, and prevents hosts outside of your VPC from initiating an IPv6 connection with your instance.

Examples:

Request syntax with placeholder values


resp = client.create_egress_only_internet_gateway({
  client_token: "String",
  dry_run: false,
  vpc_id: "String", # required
})

Response structure


resp.client_token #=> String
resp.egress_only_internet_gateway.attachments #=> Array
resp.egress_only_internet_gateway.attachments[0].state #=> String, one of "attaching", "attached", "detaching", "detached"
resp.egress_only_internet_gateway.attachments[0].vpc_id #=> String
resp.egress_only_internet_gateway.egress_only_internet_gateway_id #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :client_token (String)

    Unique, case-sensitive identifier you provide to ensure the idempotency of the request. For more information, see How to Ensure Idempotency.

  • :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_id (required, String)

    The ID of the VPC for which to create the egress-only Internet gateway.

Returns:

See Also:



2878
2879
2880
2881
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 2878

def create_egress_only_internet_gateway(params = {}, options = {})
  req = build_request(:create_egress_only_internet_gateway, params)
  req.send_request(options)
end

#create_flow_logs(params = {}) ⇒ Types::CreateFlowLogsResult

Creates one or more flow logs to capture IP traffic for a specific network interface, subnet, or VPC. Flow logs are delivered to a specified log group in Amazon CloudWatch Logs. If you specify a VPC or subnet in the request, a log stream is created in CloudWatch Logs for each network interface in the subnet or VPC. Log streams can include information about accepted and rejected traffic to a network interface. You can view the data in your log streams using Amazon CloudWatch Logs.

In your request, you must also specify an IAM role that has permission to publish logs to CloudWatch Logs.

Examples:

Request syntax with placeholder values


resp = client.create_flow_logs({
  client_token: "String",
  deliver_logs_permission_arn: "String", # required
  log_group_name: "String", # required
  resource_ids: ["String"], # required
  resource_type: "VPC", # required, accepts VPC, Subnet, NetworkInterface
  traffic_type: "ACCEPT", # required, accepts ACCEPT, REJECT, ALL
})

Response structure


resp.client_token #=> String
resp.flow_log_ids #=> Array
resp.flow_log_ids[0] #=> String
resp.unsuccessful #=> Array
resp.unsuccessful[0].error.code #=> String
resp.unsuccessful[0].error.message #=> String
resp.unsuccessful[0].resource_id #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :client_token (String)

    Unique, case-sensitive identifier you provide to ensure the idempotency of the request. For more information, see How to Ensure Idempotency.

  • :deliver_logs_permission_arn (required, String)

    The ARN for the IAM role that's used to post flow logs to a CloudWatch Logs log group.

  • :log_group_name (required, String)

    The name of the CloudWatch log group.

  • :resource_ids (required, Array<String>)

    One or more subnet, network interface, or VPC IDs.

    Constraints: Maximum of 1000 resources

  • :resource_type (required, String)

    The type of resource on which to create the flow log.

  • :traffic_type (required, String)

    The type of traffic to log.

Returns:

See Also:



2953
2954
2955
2956
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 2953

def create_flow_logs(params = {}, options = {})
  req = build_request(:create_flow_logs, params)
  req.send_request(options)
end

#create_fpga_image(params = {}) ⇒ Types::CreateFpgaImageResult

Creates an Amazon FPGA Image (AFI) from the specified design checkpoint (DCP).

The create operation is asynchronous. To verify that the AFI is ready for use, check the output logs.

An AFI contains the FPGA bitstream that is ready to download to an FPGA. You can securely deploy an AFI on one or more FPGA-accelerated instances. For more information, see the AWS FPGA Hardware Development Kit.

Examples:

Request syntax with placeholder values


resp = client.create_fpga_image({
  dry_run: false,
  input_storage_location: { # required
    bucket: "String",
    key: "String",
  },
  logs_storage_location: {
    bucket: "String",
    key: "String",
  },
  description: "String",
  name: "String",
  client_token: "String",
})

Response structure


resp.fpga_image_id #=> String
resp.fpga_image_global_id #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

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

  • :input_storage_location (required, Types::StorageLocation)

    The location of the encrypted design checkpoint in Amazon S3. The input must be a tarball.

  • :logs_storage_location (Types::StorageLocation)

    The location in Amazon S3 for the output logs.

  • :description (String)

    A description for the AFI.

  • :name (String)

    A name for the AFI.

  • :client_token (String)

    Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see Ensuring Idempotency.

Returns:

See Also:



3032
3033
3034
3035
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 3032

def create_fpga_image(params = {}, options = {})
  req = build_request(:create_fpga_image, params)
  req.send_request(options)
end

#create_image(params = {}) ⇒ Types::CreateImageResult

Creates an Amazon EBS-backed AMI from an Amazon EBS-backed instance that is either running or stopped.

If you customized your instance with instance store volumes or EBS volumes in addition to the root device volume, the new AMI contains block device mapping information for those volumes. When you launch an instance from this new AMI, the instance automatically launches with those additional volumes.

For more information, see Creating Amazon EBS-Backed Linux AMIs in the Amazon Elastic Compute Cloud User Guide.

Examples:

Request syntax with placeholder values


resp = client.create_image({
  block_device_mappings: [
    {
      device_name: "String",
      virtual_name: "String",
      ebs: {
        encrypted: false,
        delete_on_termination: false,
        iops: 1,
        kms_key_id: "String",
        snapshot_id: "String",
        volume_size: 1,
        volume_type: "standard", # accepts standard, io1, gp2, sc1, st1
      },
      no_device: "String",
    },
  ],
  description: "String",
  dry_run: false,
  instance_id: "String", # required
  name: "String", # required
  no_reboot: false,
})

Response structure


resp.image_id #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :block_device_mappings (Array<Types::BlockDeviceMapping>)

    Information about one or more block device mappings.

  • :description (String)

    A description for the new image.

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

  • :name (required, String)

    A name for the new image.

    Constraints: 3-128 alphanumeric characters, parentheses (()), square brackets ([]), spaces ( ), periods (.), slashes (/), dashes (-), single quotes ('), at-signs (@), or underscores(_)

  • :no_reboot (Boolean)

    By default, Amazon EC2 attempts to shut down and reboot the instance before creating the image. If the 'No Reboot' option is set, Amazon EC2 doesn't shut down the instance before creating the image. When this option is used, file system integrity on the created image can't be guaranteed.

Returns:

See Also:



3120
3121
3122
3123
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 3120

def create_image(params = {}, options = {})
  req = build_request(:create_image, params)
  req.send_request(options)
end

#create_instance_export_task(params = {}) ⇒ Types::CreateInstanceExportTaskResult

Exports a running or stopped instance to an S3 bucket.

For information about the supported operating systems, image formats, and known limitations for the types of instances you can export, see Exporting an Instance as a VM Using VM Import/Export in the VM Import/Export User Guide.

Examples:

Request syntax with placeholder values


resp = client.create_instance_export_task({
  description: "String",
  export_to_s3_task: {
    container_format: "ova", # accepts ova
    disk_image_format: "VMDK", # accepts VMDK, RAW, VHD
    s3_bucket: "String",
    s3_prefix: "String",
  },
  instance_id: "String", # required
  target_environment: "citrix", # accepts citrix, vmware, microsoft
})

Response structure


resp.export_task.description #=> String
resp.export_task.export_task_id #=> String
resp.export_task.export_to_s3_task.container_format #=> String, one of "ova"
resp.export_task.export_to_s3_task.disk_image_format #=> String, one of "VMDK", "RAW", "VHD"
resp.export_task.export_to_s3_task.s3_bucket #=> String
resp.export_task.export_to_s3_task.s3_key #=> String
resp.export_task.instance_export_details.instance_id #=> String
resp.export_task.instance_export_details.target_environment #=> String, one of "citrix", "vmware", "microsoft"
resp.export_task.state #=> String, one of "active", "cancelling", "cancelled", "completed"
resp.export_task.status_message #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :description (String)

    A description for the conversion task or the resource being exported. The maximum length is 255 bytes.

  • :export_to_s3_task (Types::ExportToS3TaskSpecification)

    The format and location for an instance export task.

  • :instance_id (required, String)

    The ID of the instance.

  • :target_environment (String)

    The target virtualization environment.

Returns:

See Also:



3184
3185
3186
3187
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 3184

def create_instance_export_task(params = {}, options = {})
  req = build_request(:create_instance_export_task, params)
  req.send_request(options)
end

#create_internet_gateway(params = {}) ⇒ Types::CreateInternetGatewayResult

Creates an Internet gateway for use with a VPC. After creating the Internet gateway, you attach it to a VPC using AttachInternetGateway.

For more information about your VPC and Internet gateway, see the Amazon Virtual Private Cloud User Guide.

Examples:

Example: To create an Internet gateway


# This example creates an Internet gateway.

resp = client.create_internet_gateway({
})

resp.to_h outputs the following:
{
  internet_gateway: {
    attachments: [
    ], 
    internet_gateway_id: "igw-c0a643a9", 
    tags: [
    ], 
  }, 
}

Request syntax with placeholder values


resp = client.create_internet_gateway({
  dry_run: false,
})

Response structure


resp.internet_gateway.attachments #=> Array
resp.internet_gateway.attachments[0].state #=> String, one of "attaching", "attached", "detaching", "detached"
resp.internet_gateway.attachments[0].vpc_id #=> String
resp.internet_gateway.internet_gateway_id #=> String
resp.internet_gateway.tags #=> Array
resp.internet_gateway.tags[0].key #=> String
resp.internet_gateway.tags[0].value #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

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



3248
3249
3250
3251
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 3248

def create_internet_gateway(params = {}, options = {})
  req = build_request(:create_internet_gateway, params)
  req.send_request(options)
end

#create_key_pair(params = {}) ⇒ Types::KeyPair

Creates a 2048-bit RSA key pair with the specified name. Amazon EC2 stores the public key and displays the private key for you to save to a file. The private key is returned as an unencrypted PEM encoded PKCS#1 private key. If a key with the specified name already exists, Amazon EC2 returns an error.

You can have up to five thousand key pairs per region.

The key pair returned to you is available only in the region in which you create it. If you prefer, you can create your own key pair using a third-party tool and upload it to any region using ImportKeyPair.

For more information, see Key Pairs in the Amazon Elastic Compute Cloud User Guide.

Examples:

Example: To create a key pair


# This example creates a key pair named my-key-pair.

resp = client.create_key_pair({
  key_name: "my-key-pair", 
})

Request syntax with placeholder values


resp = client.create_key_pair({
  key_name: "String", # required
  dry_run: false,
})

Response structure


resp.key_fingerprint #=> String
resp.key_material #=> String
resp.key_name #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :key_name (required, String)

    A unique name for the key pair.

    Constraints: Up to 255 ASCII characters

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



3315
3316
3317
3318
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 3315

def create_key_pair(params = {}, options = {})
  req = build_request(:create_key_pair, params)
  req.send_request(options)
end

#create_launch_template(params = {}) ⇒ Types::CreateLaunchTemplateResult

Creates a launch template. A launch template contains the parameters to launch an instance. When you launch an instance using RunInstances, you can specify a launch template instead of providing the launch parameters in the request.

Examples:

Request syntax with placeholder values


resp = client.create_launch_template({
  dry_run: false,
  client_token: "String",
  launch_template_name: "LaunchTemplateName", # required
  version_description: "VersionDescription",
  launch_template_data: { # required
    kernel_id: "String",
    ebs_optimized: false,
    iam_instance_profile: {
      arn: "String",
      name: "String",
    },
    block_device_mappings: [
      {
        device_name: "String",
        virtual_name: "String",
        ebs: {
          encrypted: false,
          delete_on_termination: false,
          iops: 1,
          kms_key_id: "String",
          snapshot_id: "String",
          volume_size: 1,
          volume_type: "standard", # accepts standard, io1, gp2, sc1, st1
        },
        no_device: "String",
      },
    ],
    network_interfaces: [
      {
        associate_public_ip_address: false,
        delete_on_termination: false,
        description: "String",
        device_index: 1,
        groups: ["String"],
        ipv_6_address_count: 1,
        ipv_6_addresses: [
          {
            ipv_6_address: "String",
          },
        ],
        network_interface_id: "String",
        private_ip_address: "String",
        private_ip_addresses: [
          {
            primary: false,
            private_ip_address: "String", # required
          },
        ],
        secondary_private_ip_address_count: 1,
        subnet_id: "String",
      },
    ],
    image_id: "String",
    instance_type: "t1.micro", # accepts t1.micro, t2.nano, t2.micro, t2.small, t2.medium, t2.large, t2.xlarge, t2.2xlarge, m1.small, m1.medium, m1.large, m1.xlarge, m3.medium, m3.large, m3.xlarge, m3.2xlarge, m4.large, m4.xlarge, m4.2xlarge, m4.4xlarge, m4.10xlarge, m4.16xlarge, m2.xlarge, m2.2xlarge, m2.4xlarge, cr1.8xlarge, r3.large, r3.xlarge, r3.2xlarge, r3.4xlarge, r3.8xlarge, r4.large, r4.xlarge, r4.2xlarge, r4.4xlarge, r4.8xlarge, r4.16xlarge, x1.16xlarge, x1.32xlarge, x1e.xlarge, x1e.2xlarge, x1e.4xlarge, x1e.8xlarge, x1e.16xlarge, x1e.32xlarge, i2.xlarge, i2.2xlarge, i2.4xlarge, i2.8xlarge, i3.large, i3.xlarge, i3.2xlarge, i3.4xlarge, i3.8xlarge, i3.16xlarge, hi1.4xlarge, hs1.8xlarge, c1.medium, c1.xlarge, c3.large, c3.xlarge, c3.2xlarge, c3.4xlarge, c3.8xlarge, c4.large, c4.xlarge, c4.2xlarge, c4.4xlarge, c4.8xlarge, c5.large, c5.xlarge, c5.2xlarge, c5.4xlarge, c5.9xlarge, c5.18xlarge, cc1.4xlarge, cc2.8xlarge, g2.2xlarge, g2.8xlarge, g3.4xlarge, g3.8xlarge, g3.16xlarge, cg1.4xlarge, p2.xlarge, p2.8xlarge, p2.16xlarge, p3.2xlarge, p3.8xlarge, p3.16xlarge, d2.xlarge, d2.2xlarge, d2.4xlarge, d2.8xlarge, f1.2xlarge, f1.16xlarge, m5.large, m5.xlarge, m5.2xlarge, m5.4xlarge, m5.12xlarge, m5.24xlarge, h1.2xlarge, h1.4xlarge, h1.8xlarge, h1.16xlarge
    key_name: "String",
    monitoring: {
      enabled: false,
    },
    placement: {
      availability_zone: "String",
      affinity: "String",
      group_name: "String",
      host_id: "String",
      tenancy: "default", # accepts default, dedicated, host
      spread_domain: "String",
    },
    ram_disk_id: "String",
    disable_api_termination: false,
    instance_initiated_shutdown_behavior: "stop", # accepts stop, terminate
    user_data: "String",
    tag_specifications: [
      {
        resource_type: "customer-gateway", # accepts customer-gateway, dhcp-options, image, instance, internet-gateway, network-acl, network-interface, reserved-instances, route-table, snapshot, spot-instances-request, subnet, security-group, volume, vpc, vpn-connection, vpn-gateway
        tags: [
          {
            key: "String",
            value: "String",
          },
        ],
      },
    ],
    elastic_gpu_specifications: [
      {
        type: "String", # required
      },
    ],
    security_group_ids: ["String"],
    security_groups: ["String"],
    instance_market_options: {
      market_type: "spot", # accepts spot
      spot_options: {
        max_price: "String",
        spot_instance_type: "one-time", # accepts one-time, persistent
        block_duration_minutes: 1,
        valid_until: Time.now,
        instance_interruption_behavior: "hibernate", # accepts hibernate, stop, terminate
      },
    },
    credit_specification: {
      cpu_credits: "String", # required
    },
  },
})

Response structure


resp.launch_template.launch_template_id #=> String
resp.launch_template.launch_template_name #=> String
resp.launch_template.create_time #=> Time
resp.launch_template.created_by #=> String
resp.launch_template.default_version_number #=> Integer
resp.launch_template.latest_version_number #=> Integer
resp.launch_template.tags #=> Array
resp.launch_template.tags[0].key #=> String
resp.launch_template.tags[0].value #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

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

  • :client_token (String)

    Unique, case-sensitive identifier you provide to ensure the idempotency of the request. For more information, see Ensuring Idempotency.

  • :launch_template_name (required, String)

    A name for the launch template.

  • :version_description (String)

    A description for the first version of the launch template.

  • :launch_template_data (required, Types::RequestLaunchTemplateData)

    The information for the launch template.

Returns:

See Also:



3476
3477
3478
3479
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 3476

def create_launch_template(params = {}, options = {})
  req = build_request(:create_launch_template, params)
  req.send_request(options)
end

#create_launch_template_version(params = {}) ⇒ Types::CreateLaunchTemplateVersionResult

Creates a new version for a launch template. You can specify an existing version of launch template from which to base the new version.

Launch template versions are numbered in the order in which they are created. You cannot specify, change, or replace the numbering of launch template versions.

Examples:

Request syntax with placeholder values


resp = client.create_launch_template_version({
  dry_run: false,
  client_token: "String",
  launch_template_id: "String",
  launch_template_name: "LaunchTemplateName",
  source_version: "String",
  version_description: "VersionDescription",
  launch_template_data: { # required
    kernel_id: "String",
    ebs_optimized: false,
    iam_instance_profile: {
      arn: "String",
      name: "String",
    },
    block_device_mappings: [
      {
        device_name: "String",
        virtual_name: "String",
        ebs: {
          encrypted: false,
          delete_on_termination: false,
          iops: 1,
          kms_key_id: "String",
          snapshot_id: "String",
          volume_size: 1,
          volume_type: "standard", # accepts standard, io1, gp2, sc1, st1
        },
        no_device: "String",
      },
    ],
    network_interfaces: [
      {
        associate_public_ip_address: false,
        delete_on_termination: false,
        description: "String",
        device_index: 1,
        groups: ["String"],
        ipv_6_address_count: 1,
        ipv_6_addresses: [
          {
            ipv_6_address: "String",
          },
        ],
        network_interface_id: "String",
        private_ip_address: "String",
        private_ip_addresses: [
          {
            primary: false,
            private_ip_address: "String", # required
          },
        ],
        secondary_private_ip_address_count: 1,
        subnet_id: "String",
      },
    ],
    image_id: "String",
    instance_type: "t1.micro", # accepts t1.micro, t2.nano, t2.micro, t2.small, t2.medium, t2.large, t2.xlarge, t2.2xlarge, m1.small, m1.medium, m1.large, m1.xlarge, m3.medium, m3.large, m3.xlarge, m3.2xlarge, m4.large, m4.xlarge, m4.2xlarge, m4.4xlarge, m4.10xlarge, m4.16xlarge, m2.xlarge, m2.2xlarge, m2.4xlarge, cr1.8xlarge, r3.large, r3.xlarge, r3.2xlarge, r3.4xlarge, r3.8xlarge, r4.large, r4.xlarge, r4.2xlarge, r4.4xlarge, r4.8xlarge, r4.16xlarge, x1.16xlarge, x1.32xlarge, x1e.xlarge, x1e.2xlarge, x1e.4xlarge, x1e.8xlarge, x1e.16xlarge, x1e.32xlarge, i2.xlarge, i2.2xlarge, i2.4xlarge, i2.8xlarge, i3.large, i3.xlarge, i3.2xlarge, i3.4xlarge, i3.8xlarge, i3.16xlarge, hi1.4xlarge, hs1.8xlarge, c1.medium, c1.xlarge, c3.large, c3.xlarge, c3.2xlarge, c3.4xlarge, c3.8xlarge, c4.large, c4.xlarge, c4.2xlarge, c4.4xlarge, c4.8xlarge, c5.large, c5.xlarge, c5.2xlarge, c5.4xlarge, c5.9xlarge, c5.18xlarge, cc1.4xlarge, cc2.8xlarge, g2.2xlarge, g2.8xlarge, g3.4xlarge, g3.8xlarge, g3.16xlarge, cg1.4xlarge, p2.xlarge, p2.8xlarge, p2.16xlarge, p3.2xlarge, p3.8xlarge, p3.16xlarge, d2.xlarge, d2.2xlarge, d2.4xlarge, d2.8xlarge, f1.2xlarge, f1.16xlarge, m5.large, m5.xlarge, m5.2xlarge, m5.4xlarge, m5.12xlarge, m5.24xlarge, h1.2xlarge, h1.4xlarge, h1.8xlarge, h1.16xlarge
    key_name: "String",
    monitoring: {
      enabled: false,
    },
    placement: {
      availability_zone: "String",
      affinity: "String",
      group_name: "String",
      host_id: "String",
      tenancy: "default", # accepts default, dedicated, host
      spread_domain: "String",
    },
    ram_disk_id: "String",
    disable_api_termination: false,
    instance_initiated_shutdown_behavior: "stop", # accepts stop, terminate
    user_data: "String",
    tag_specifications: [
      {
        resource_type: "customer-gateway", # accepts customer-gateway, dhcp-options, image, instance, internet-gateway, network-acl, network-interface, reserved-instances, route-table, snapshot, spot-instances-request, subnet, security-group, volume, vpc, vpn-connection, vpn-gateway
        tags: [
          {
            key: "String",
            value: "String",
          },
        ],
      },
    ],
    elastic_gpu_specifications: [
      {
        type: "String", # required
      },
    ],
    security_group_ids: ["String"],
    security_groups: ["String"],
    instance_market_options: {
      market_type: "spot", # accepts spot
      spot_options: {
        max_price: "String",
        spot_instance_type: "one-time", # accepts one-time, persistent
        block_duration_minutes: 1,
        valid_until: Time.now,
        instance_interruption_behavior: "hibernate", # accepts hibernate, stop, terminate
      },
    },
    credit_specification: {
      cpu_credits: "String", # required
    },
  },
})

Response structure


resp.launch_template_version.launch_template_id #=> String
resp.launch_template_version.launch_template_name #=> String
resp.launch_template_version.version_number #=> Integer
resp.launch_template_version.version_description #=> String
resp.launch_template_version.create_time #=> Time
resp.launch_template_version.created_by #=> String
resp.launch_template_version.default_version #=> Boolean
resp.launch_template_version.launch_template_data.kernel_id #=> String
resp.launch_template_version.launch_template_data.ebs_optimized #=> Boolean
resp.launch_template_version.launch_template_data.iam_instance_profile.arn #=> String
resp.launch_template_version.launch_template_data.iam_instance_profile.name #=> String
resp.launch_template_version.launch_template_data.block_device_mappings #=> Array
resp.launch_template_version.launch_template_data.block_device_mappings[0].device_name #=> String
resp.launch_template_version.launch_template_data.block_device_mappings[0].virtual_name #=> String
resp.launch_template_version.launch_template_data.block_device_mappings[0].ebs.encrypted #=> Boolean
resp.launch_template_version.launch_template_data.block_device_mappings[0].ebs.delete_on_termination #=> Boolean
resp.launch_template_version.launch_template_data.block_device_mappings[0].ebs.iops #=> Integer
resp.launch_template_version.launch_template_data.block_device_mappings[0].ebs.kms_key_id #=> String
resp.launch_template_version.launch_template_data.block_device_mappings[0].ebs.snapshot_id #=> String
resp.launch_template_version.launch_template_data.block_device_mappings[0].ebs.volume_size #=> Integer
resp.launch_template_version.launch_template_data.block_device_mappings[0].ebs.volume_type #=> String, one of "standard", "io1", "gp2", "sc1", "st1"
resp.launch_template_version.launch_template_data.block_device_mappings[0].no_device #=> String
resp.launch_template_version.launch_template_data.network_interfaces #=> Array
resp.launch_template_version.launch_template_data.network_interfaces[0].associate_public_ip_address #=> Boolean
resp.launch_template_version.launch_template_data.network_interfaces[0].delete_on_termination #=> Boolean
resp.launch_template_version.launch_template_data.network_interfaces[0].description #=> String
resp.launch_template_version.launch_template_data.network_interfaces[0].device_index #=> Integer
resp.launch_template_version.launch_template_data.network_interfaces[0].groups #=> Array
resp.launch_template_version.launch_template_data.network_interfaces[0].groups[0] #=> String
resp.launch_template_version.launch_template_data.network_interfaces[0].ipv_6_address_count #=> Integer
resp.launch_template_version.launch_template_data.network_interfaces[0].ipv_6_addresses #=> Array
resp.launch_template_version.launch_template_data.network_interfaces[0].ipv_6_addresses[0].ipv_6_address #=> String
resp.launch_template_version.launch_template_data.network_interfaces[0].network_interface_id #=> String
resp.launch_template_version.launch_template_data.network_interfaces[0].private_ip_address #=> String
resp.launch_template_version.launch_template_data.network_interfaces[0].private_ip_addresses #=> Array
resp.launch_template_version.launch_template_data.network_interfaces[0].private_ip_addresses[0].primary #=> Boolean
resp.launch_template_version.launch_template_data.network_interfaces[0].private_ip_addresses[0].private_ip_address #=> String
resp.launch_template_version.launch_template_data.network_interfaces[0].secondary_private_ip_address_count #=> Integer
resp.launch_template_version.launch_template_data.network_interfaces[0].subnet_id #=> String
resp.launch_template_version.launch_template_data.image_id #=> String
resp.launch_template_version.launch_template_data.instance_type #=> String, one of "t1.micro", "t2.nano", "t2.micro", "t2.small", "t2.medium", "t2.large", "t2.xlarge", "t2.2xlarge", "m1.small", "m1.medium", "m1.large", "m1.xlarge", "m3.medium", "m3.large", "m3.xlarge", "m3.2xlarge", "m4.large", "m4.xlarge", "m4.2xlarge", "m4.4xlarge", "m4.10xlarge", "m4.16xlarge", "m2.xlarge", "m2.2xlarge", "m2.4xlarge", "cr1.8xlarge", "r3.large", "r3.xlarge", "r3.2xlarge", "r3.4xlarge", "r3.8xlarge", "r4.large", "r4.xlarge", "r4.2xlarge", "r4.4xlarge", "r4.8xlarge", "r4.16xlarge", "x1.16xlarge", "x1.32xlarge", "x1e.xlarge", "x1e.2xlarge", "x1e.4xlarge", "x1e.8xlarge", "x1e.16xlarge", "x1e.32xlarge", "i2.xlarge", "i2.2xlarge", "i2.4xlarge", "i2.8xlarge", "i3.large", "i3.xlarge", "i3.2xlarge", "i3.4xlarge", "i3.8xlarge", "i3.16xlarge", "hi1.4xlarge", "hs1.8xlarge", "c1.medium", "c1.xlarge", "c3.large", "c3.xlarge", "c3.2xlarge", "c3.4xlarge", "c3.8xlarge", "c4.large", "c4.xlarge", "c4.2xlarge", "c4.4xlarge", "c4.8xlarge", "c5.large", "c5.xlarge", "c5.2xlarge", "c5.4xlarge", "c5.9xlarge", "c5.18xlarge", "cc1.4xlarge", "cc2.8xlarge", "g2.2xlarge", "g2.8xlarge", "g3.4xlarge", "g3.8xlarge", "g3.16xlarge", "cg1.4xlarge", "p2.xlarge", "p2.8xlarge", "p2.16xlarge", "p3.2xlarge", "p3.8xlarge", "p3.16xlarge", "d2.xlarge", "d2.2xlarge", "d2.4xlarge", "d2.8xlarge", "f1.2xlarge", "f1.16xlarge", "m5.large", "m5.xlarge", "m5.2xlarge", "m5.4xlarge", "m5.12xlarge", "m5.24xlarge", "h1.2xlarge", "h1.4xlarge", "h1.8xlarge", "h1.16xlarge"
resp.launch_template_version.launch_template_data.key_name #=> String
resp.launch_template_version.launch_template_data.monitoring.enabled #=> Boolean
resp.launch_template_version.launch_template_data.placement.availability_zone #=> String
resp.launch_template_version.launch_template_data.placement.affinity #=> String
resp.launch_template_version.launch_template_data.placement.group_name #=> String
resp.launch_template_version.launch_template_data.placement.host_id #=> String
resp.launch_template_version.launch_template_data.placement.tenancy #=> String, one of "default", "dedicated", "host"
resp.launch_template_version.launch_template_data.placement.spread_domain #=> String
resp.launch_template_version.launch_template_data.ram_disk_id #=> String
resp.launch_template_version.launch_template_data.disable_api_termination #=> Boolean
resp.launch_template_version.launch_template_data.instance_initiated_shutdown_behavior #=> String, one of "stop", "terminate"
resp.launch_template_version.launch_template_data.user_data #=> String
resp.launch_template_version.launch_template_data.tag_specifications #=> Array
resp.launch_template_version.launch_template_data.tag_specifications[0].resource_type #=> String, one of "customer-gateway", "dhcp-options", "image", "instance", "internet-gateway", "network-acl", "network-interface", "reserved-instances", "route-table", "snapshot", "spot-instances-request", "subnet", "security-group", "volume", "vpc", "vpn-connection", "vpn-gateway"
resp.launch_template_version.launch_template_data.tag_specifications[0].tags #=> Array
resp.launch_template_version.launch_template_data.tag_specifications[0].tags[0].key #=> String
resp.launch_template_version.launch_template_data.tag_specifications[0].tags[0].value #=> String
resp.launch_template_version.launch_template_data.elastic_gpu_specifications #=> Array
resp.launch_template_version.launch_template_data.elastic_gpu_specifications[0].type #=> String
resp.launch_template_version.launch_template_data.security_group_ids #=> Array
resp.launch_template_version.launch_template_data.security_group_ids[0] #=> String
resp.launch_template_version.launch_template_data.security_groups #=> Array
resp.launch_template_version.launch_template_data.security_groups[0] #=> String
resp.launch_template_version.launch_template_data.instance_market_options.market_type #=> String, one of "spot"
resp.launch_template_version.launch_template_data.instance_market_options.spot_options.max_price #=> String
resp.launch_template_version.launch_template_data.instance_market_options.spot_options.spot_instance_type #=> String, one of "one-time", "persistent"
resp.launch_template_version.launch_template_data.instance_market_options.spot_options.block_duration_minutes #=> Integer
resp.launch_template_version.launch_template_data.instance_market_options.spot_options.valid_until #=> Time
resp.launch_template_version.launch_template_data.instance_market_options.spot_options.instance_interruption_behavior #=> String, one of "hibernate", "stop", "terminate"
resp.launch_template_version.launch_template_data.credit_specification.cpu_credits #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

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

  • :client_token (String)

    Unique, case-sensitive identifier you provide to ensure the idempotency of the request. For more information, see Ensuring Idempotency.

  • :launch_template_id (String)

    The ID of the launch template. You must specify either the launch template ID or launch template name in the request.

  • :launch_template_name (String)

    The name of the launch template. You must specify either the launch template ID or launch template name in the request.

  • :source_version (String)

    The version number of the launch template version on which to base the new version. The new version inherits the same launch parameters as the source version, except for parameters that you specify in LaunchTemplateData.

  • :version_description (String)

    A description for the version of the launch template.

  • :launch_template_data (required, Types::RequestLaunchTemplateData)

    The information for the launch template.

Returns:

See Also:



3715
3716
3717
3718
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 3715

def create_launch_template_version(params = {}, options = {})
  req = build_request(:create_launch_template_version, params)
  req.send_request(options)
end

#create_nat_gateway(params = {}) ⇒ Types::CreateNatGatewayResult

Creates a NAT gateway in the specified subnet. A NAT gateway can be used to enable instances in a private subnet to connect to the Internet. This action creates a network interface in the specified subnet with a private IP address from the IP address range of the subnet. For more information, see NAT Gateways in the Amazon Virtual Private Cloud User Guide.

Examples:

Example: To create a NAT gateway


# This example creates a NAT gateway in subnet subnet-1a2b3c4d and associates an Elastic IP address with the allocation ID
# eipalloc-37fc1a52 with the NAT gateway.

resp = client.create_nat_gateway({
  allocation_id: "eipalloc-37fc1a52", 
  subnet_id: "subnet-1a2b3c4d", 
})

resp.to_h outputs the following:
{
  nat_gateway: {
    create_time: Time.parse("2015-12-17T12:45:26.732Z"), 
    nat_gateway_addresses: [
      {
        allocation_id: "eipalloc-37fc1a52", 
      }, 
    ], 
    nat_gateway_id: "nat-08d48af2a8e83edfd", 
    state: "pending", 
    subnet_id: "subnet-1a2b3c4d", 
    vpc_id: "vpc-1122aabb", 
  }, 
}

Request syntax with placeholder values


resp = client.create_nat_gateway({
  allocation_id: "String", # required
  client_token: "String",
  subnet_id: "String", # required
})

Response structure


resp.client_token #=> String
resp.nat_gateway.create_time #=> Time
resp.nat_gateway.delete_time #=> Time
resp.nat_gateway.failure_code #=> String
resp.nat_gateway.failure_message #=> String
resp.nat_gateway.nat_gateway_addresses #=> Array
resp.nat_gateway.nat_gateway_addresses[0].allocation_id #=> String
resp.nat_gateway.nat_gateway_addresses[0].network_interface_id #=> String
resp.nat_gateway.nat_gateway_addresses[0].private_ip #=> String
resp.nat_gateway.nat_gateway_addresses[0].public_ip #=> String
resp.nat_gateway.nat_gateway_id #=> String
resp.nat_gateway.provisioned_bandwidth.provision_time #=> Time
resp.nat_gateway.provisioned_bandwidth.provisioned #=> String
resp.nat_gateway.provisioned_bandwidth.request_time #=> Time
resp.nat_gateway.provisioned_bandwidth.requested #=> String
resp.nat_gateway.provisioned_bandwidth.status #=> String
resp.nat_gateway.state #=> String, one of "pending", "failed", "available", "deleting", "deleted"
resp.nat_gateway.subnet_id #=> String
resp.nat_gateway.vpc_id #=> String
resp.nat_gateway.tags #=> Array
resp.nat_gateway.tags[0].key #=> String
resp.nat_gateway.tags[0].value #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :allocation_id (required, String)

    The allocation ID of an Elastic IP address to associate with the NAT gateway. If the Elastic IP address is associated with another resource, you must first disassociate it.

  • :client_token (String)

    Unique, case-sensitive identifier you provide to ensure the idempotency of the request. For more information, see How to Ensure Idempotency.

    Constraint: Maximum 64 ASCII characters.

  • :subnet_id (required, String)

    The subnet in which to create the NAT gateway.

Returns:

See Also:



3819
3820
3821
3822
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 3819

def create_nat_gateway(params = {}, options = {})
  req = build_request(:create_nat_gateway, params)
  req.send_request(options)
end

#create_network_acl(params = {}) ⇒ Types::CreateNetworkAclResult

Creates a network ACL in a VPC. Network ACLs provide an optional layer of security (in addition to security groups) for the instances in your VPC.

For more information about network ACLs, see Network ACLs in the Amazon Virtual Private Cloud User Guide.

Examples:

Example: To create a network ACL


# This example creates a network ACL for the specified VPC.

resp = client.create_network_acl({
  vpc_id: "vpc-a01106c2", 
})

resp.to_h outputs the following:
{
  network_acl: {
    associations: [
    ], 
    entries: [
      {
        cidr_block: "0.0.0.0/0", 
        egress: true, 
        protocol: "-1", 
        rule_action: "deny", 
        rule_number: 32767, 
      }, 
      {
        cidr_block: "0.0.0.0/0", 
        egress: false, 
        protocol: "-1", 
        rule_action: "deny", 
        rule_number: 32767, 
      }, 
    ], 
    is_default: false, 
    network_acl_id: "acl-5fb85d36", 
    tags: [
    ], 
    vpc_id: "vpc-a01106c2", 
  }, 
}

Request syntax with placeholder values


resp = client.create_network_acl({
  dry_run: false,
  vpc_id: "String", # required
})

Response structure


resp.network_acl.associations #=> Array
resp.network_acl.associations[0].network_acl_association_id #=> String
resp.network_acl.associations[0].network_acl_id #=> String
resp.network_acl.associations[0].subnet_id #=> String
resp.network_acl.entries #=> Array
resp.network_acl.entries[0].cidr_block #=> String
resp.network_acl.entries[0].egress #=> Boolean
resp.network_acl.entries[0].icmp_type_code.code #=> Integer
resp.network_acl.entries[0].icmp_type_code.type #=> Integer
resp.network_acl.entries[0].ipv_6_cidr_block #=> String
resp.network_acl.entries[0].port_range.from #=> Integer
resp.network_acl.entries[0].port_range.to #=> Integer
resp.network_acl.entries[0].protocol #=> String
resp.network_acl.entries[0].rule_action #=> String, one of "allow", "deny"
resp.network_acl.entries[0].rule_number #=> Integer
resp.network_acl.is_default #=> Boolean
resp.network_acl.network_acl_id #=> String
resp.network_acl.tags #=> Array
resp.network_acl.tags[0].key #=> String
resp.network_acl.tags[0].value #=> String
resp.network_acl.vpc_id #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :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_id (required, String)

    The ID of the VPC.

Returns:

See Also:



3921
3922
3923
3924
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 3921

def create_network_acl(params = {}, options = {})
  req = build_request(:create_network_acl, params)
  req.send_request(options)
end

#create_network_acl_entry(params = {}) ⇒ Struct

Creates an entry (a rule) in a network ACL with the specified rule number. Each network ACL has a set of numbered ingress rules and a separate set of numbered egress rules. When determining whether a packet should be allowed in or out of a subnet associated with the ACL, we process the entries in the ACL according to the rule numbers, in ascending order. Each network ACL has a set of ingress rules and a separate set of egress rules.

We recommend that you leave room between the rule numbers (for example, 100, 110, 120, ...), and not number them one right after the other (for example, 101, 102, 103, ...). This makes it easier to add a rule between existing ones without having to renumber the rules.

After you add an entry, you can't modify it; you must either replace it, or create an entry and delete the old one.

For more information about network ACLs, see Network ACLs in the Amazon Virtual Private Cloud User Guide.

Examples:

Example: To create a network ACL entry


# This example creates an entry for the specified network ACL. The rule allows ingress traffic from anywhere (0.0.0.0/0)
# on UDP port 53 (DNS) into any associated subnet.

resp = client.create_network_acl_entry({
  cidr_block: "0.0.0.0/0", 
  egress: false, 
  network_acl_id: "acl-5fb85d36", 
  port_range: {
    from: 53, 
    to: 53, 
  }, 
  protocol: "udp", 
  rule_action: "allow", 
  rule_number: 100, 
})

Request syntax with placeholder values


resp = client.create_network_acl_entry({
  cidr_block: "String",
  dry_run: false,
  egress: false, # required
  icmp_type_code: {
    code: 1,
    type: 1,
  },
  ipv_6_cidr_block: "String",
  network_acl_id: "String", # required
  port_range: {
    from: 1,
    to: 1,
  },
  protocol: "String", # required
  rule_action: "allow", # required, accepts allow, deny
  rule_number: 1, # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :cidr_block (String)

    The IPv4 network range to allow or deny, in CIDR notation (for example 172.16.0.0/24).

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

  • :egress (required, Boolean)

    Indicates whether this is an egress rule (rule is applied to traffic leaving the subnet).

  • :icmp_type_code (Types::IcmpTypeCode)

    ICMP protocol: The ICMP or ICMPv6 type and code. Required if specifying the ICMP protocol, or protocol 58 (ICMPv6) with an IPv6 CIDR block.

  • :ipv_6_cidr_block (String)

    The IPv6 network range to allow or deny, in CIDR notation (for example 2001:db8:1234:1a00::/64).

  • :network_acl_id (required, String)

    The ID of the network ACL.

  • :port_range (Types::PortRange)

    TCP or UDP protocols: The range of ports the rule applies to.

  • :protocol (required, String)

    The protocol. A value of -1 or all means all protocols. If you specify all, -1, or a protocol number other than tcp, udp, or icmp, traffic on all ports is allowed, regardless of any ports or ICMP types or codes you specify. If you specify protocol 58 (ICMPv6) and specify an IPv4 CIDR block, traffic for all ICMP types and codes allowed, regardless of any that you specify. If you specify protocol 58 (ICMPv6) and specify an IPv6 CIDR block, you must specify an ICMP type and code.

  • :rule_action (required, String)

    Indicates whether to allow or deny the traffic that matches the rule.

  • :rule_number (required, Integer)

    The rule number for the entry (for example, 100). ACL entries are processed in ascending order by rule number.

    Constraints: Positive integer from 1 to 32766. The range 32767 to 65535 is reserved for internal use.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



4044
4045
4046
4047
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 4044

def create_network_acl_entry(params = {}, options = {})
  req = build_request(:create_network_acl_entry, params)
  req.send_request(options)
end

#create_network_interface(params = {}) ⇒ Types::CreateNetworkInterfaceResult

Creates a network interface in the specified subnet.

For more information about network interfaces, see Elastic Network Interfaces in the Amazon Virtual Private Cloud User Guide.

Examples:

Example: To create a network interface


# This example creates a network interface for the specified subnet.

resp = client.create_network_interface({
  description: "my network interface", 
  groups: [
    "sg-903004f8", 
  ], 
  private_ip_address: "10.0.2.17", 
  subnet_id: "subnet-9d4a7b6c", 
})

resp.to_h outputs the following:
{
  network_interface: {
    availability_zone: "us-east-1d", 
    description: "my network interface", 
    groups: [
      {
        group_id: "sg-903004f8", 
        group_name: "default", 
      }, 
    ], 
    mac_address: "02:1a:80:41:52:9c", 
    network_interface_id: "eni-e5aa89a3", 
    owner_id: "123456789012", 
    private_ip_address: "10.0.2.17", 
    private_ip_addresses: [
      {
        primary: true, 
        private_ip_address: "10.0.2.17", 
      }, 
    ], 
    requester_managed: false, 
    source_dest_check: true, 
    status: "pending", 
    subnet_id: "subnet-9d4a7b6c", 
    tag_set: [
    ], 
    vpc_id: "vpc-a01106c2", 
  }, 
}

Request syntax with placeholder values


resp = client.create_network_interface({
  description: "String",
  dry_run: false,
  groups: ["String"],
  ipv_6_address_count: 1,
  ipv_6_addresses: [
    {
      ipv_6_address: "String",
    },
  ],
  private_ip_address: "String",
  private_ip_addresses: [
    {
      primary: false,
      private_ip_address: "String", # required
    },
  ],
  secondary_private_ip_address_count: 1,
  subnet_id: "String", # required
})

Response structure


resp.network_interface.association.allocation_id #=> String
resp.network_interface.association.association_id #=> String
resp.network_interface.association.ip_owner_id #=> String
resp.network_interface.association.public_dns_name #=> String
resp.network_interface.association.public_ip #=> String
resp.network_interface.attachment.attach_time #=> Time
resp.network_interface.attachment.attachment_id #=> String
resp.network_interface.attachment.delete_on_termination #=> Boolean
resp.network_interface.attachment.device_index #=> Integer
resp.network_interface.attachment.instance_id #=> String
resp.network_interface.attachment.instance_owner_id #=> String
resp.network_interface.attachment.status #=> String, one of "attaching", "attached", "detaching", "detached"
resp.network_interface.availability_zone #=> String
resp.network_interface.description #=> String
resp.network_interface.groups #=> Array
resp.network_interface.groups[0].group_name #=> String
resp.network_interface.groups[0].group_id #=> String
resp.network_interface.interface_type #=> String, one of "interface", "natGateway"
resp.network_interface.ipv_6_addresses #=> Array
resp.network_interface.ipv_6_addresses[0].ipv_6_address #=> String
resp.network_interface.mac_address #=> String
resp.network_interface.network_interface_id #=> String
resp.network_interface.owner_id #=> String
resp.network_interface.private_dns_name #=> String
resp.network_interface.private_ip_address #=> String
resp.network_interface.private_ip_addresses #=> Array
resp.network_interface.private_ip_addresses[0].association.allocation_id #=> String
resp.network_interface.private_ip_addresses[0].association.association_id #=> String
resp.network_interface.private_ip_addresses[0].association.ip_owner_id #=> String
resp.network_interface.private_ip_addresses[0].association.public_dns_name #=> String
resp.network_interface.private_ip_addresses[0].association.public_ip #=> String
resp.network_interface.private_ip_addresses[0].primary #=> Boolean
resp.network_interface.private_ip_addresses[0].private_dns_name #=> String
resp.network_interface.private_ip_addresses[0].private_ip_address #=> String
resp.network_interface.requester_id #=> String
resp.network_interface.requester_managed #=> Boolean
resp.network_interface.source_dest_check #=> Boolean
resp.network_interface.status #=> String, one of "available", "attaching", "in-use", "detaching"
resp.network_interface.subnet_id #=> String
resp.network_interface.tag_set #=> Array
resp.network_interface.tag_set[0].key #=> String
resp.network_interface.tag_set[0].value #=> String
resp.network_interface.vpc_id #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :description (String)

    A description for the network interface.

  • :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 (Array<String>)

    The IDs of one or more security groups.

  • :ipv_6_address_count (Integer)

    The number of IPv6 addresses to assign to a network interface. Amazon EC2 automatically selects the IPv6 addresses from the subnet range. You can't use this option if specifying specific IPv6 addresses. If your subnet has the AssignIpv6AddressOnCreation attribute set to true, you can specify 0 to override this setting.

  • :ipv_6_addresses (Array<Types::InstanceIpv6Address>)

    One or more specific IPv6 addresses from the IPv6 CIDR block range of your subnet. You can't use this option if you're specifying a number of IPv6 addresses.

  • :private_ip_address (String)

    The primary private IPv4 address of the network interface. If you don't specify an IPv4 address, Amazon EC2 selects one for you from the subnet's IPv4 CIDR range. If you specify an IP address, you cannot indicate any IP addresses specified in privateIpAddresses as primary (only one IP address can be designated as primary).

  • :private_ip_addresses (Array<Types::PrivateIpAddressSpecification>)

    One or more private IPv4 addresses.

  • :secondary_private_ip_address_count (Integer)

    The number of secondary private IPv4 addresses to assign to a network interface. When you specify a number of secondary IPv4 addresses, Amazon EC2 selects these IP addresses within the subnet's IPv4 CIDR range. You can't specify this option and specify more than one private IP address using privateIpAddresses.

    The number of IP addresses you can assign to a network interface varies by instance type. For more information, see IP Addresses Per ENI Per Instance Type in the Amazon Virtual Private Cloud User Guide.

  • :subnet_id (required, String)

    The ID of the subnet to associate with the network interface.

Returns:

See Also:



4233
4234
4235
4236
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 4233

def create_network_interface(params = {}, options = {})
  req = build_request(:create_network_interface, params)
  req.send_request(options)
end

#create_network_interface_permission(params = {}) ⇒ Types::CreateNetworkInterfacePermissionResult

Grants an AWS authorized partner account permission to attach the specified network interface to an instance in their account.

You can grant permission to a single AWS account only, and only one account at a time.

Examples:

Request syntax with placeholder values


resp = client.create_network_interface_permission({
  network_interface_id: "String", # required
  aws_account_id: "String",
  aws_service: "String",
  permission: "INSTANCE-ATTACH", # required, accepts INSTANCE-ATTACH, EIP-ASSOCIATE
  dry_run: false,
})

Response structure


resp.interface_permission.network_interface_permission_id #=> String
resp.interface_permission.network_interface_id #=> String
resp.interface_permission. #=> String
resp.interface_permission.aws_service #=> String
resp.interface_permission.permission #=> String, one of "INSTANCE-ATTACH", "EIP-ASSOCIATE"
resp.interface_permission.permission_state.state #=> String, one of "pending", "granted", "revoking", "revoked"
resp.interface_permission.permission_state.status_message #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :network_interface_id (required, String)

    The ID of the network interface.

  • :aws_account_id (String)

    The AWS account ID.

  • :aws_service (String)

    The AWS service. Currently not supported.

  • :permission (required, String)

    The type of permission to grant.

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



4290
4291
4292
4293
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 4290

def create_network_interface_permission(params = {}, options = {})
  req = build_request(:create_network_interface_permission, params)
  req.send_request(options)
end

#create_placement_group(params = {}) ⇒ Struct

Creates a placement group in which to launch instances. The strategy of the placement group determines how the instances are organized within the group.

A cluster placement group is a logical grouping of instances within a single Availability Zone that benefit from low network latency, high network throughput. A spread placement group places instances on distinct hardware.

For more information, see Placement Groups in the Amazon Elastic Compute Cloud User Guide.

Examples:

Example: To create a placement group


# This example creates a placement group with the specified name.

resp = client.create_placement_group({
  group_name: "my-cluster", 
  strategy: "cluster", 
})

resp.to_h outputs the following:
{
}

Request syntax with placeholder values


resp = client.create_placement_group({
  dry_run: false,
  group_name: "String", # required
  strategy: "cluster", # required, accepts cluster, spread
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

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

  • :group_name (required, String)

    A name for the placement group. Must be unique within the scope of your account for the region.

    Constraints: Up to 255 ASCII characters

  • :strategy (required, String)

    The placement strategy.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



4354
4355
4356
4357
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 4354

def create_placement_group(params = {}, options = {})
  req = build_request(:create_placement_group, params)
  req.send_request(options)
end

#create_reserved_instances_listing(params = {}) ⇒ Types::CreateReservedInstancesListingResult

Creates a listing for Amazon EC2 Standard Reserved Instances to be sold in the Reserved Instance Marketplace. You can submit one Standard Reserved Instance listing at a time. To get a list of your Standard Reserved Instances, you can use the DescribeReservedInstances operation.

Only Standard Reserved Instances with a capacity reservation can be sold in the Reserved Instance Marketplace. Convertible Reserved Instances and Standard Reserved Instances with a regional benefit cannot be sold.

The Reserved Instance Marketplace matches sellers who want to resell Standard Reserved Instance capacity that they no longer need with buyers who want to purchase additional capacity. Reserved Instances bought and sold through the Reserved Instance Marketplace work like any other Reserved Instances.

To sell your Standard Reserved Instances, you must first register as a seller in the Reserved Instance Marketplace. After completing the registration process, you can create a Reserved Instance Marketplace listing of some or all of your Standard Reserved Instances, and specify the upfront price to receive for them. Your Standard Reserved Instance listings then become available for purchase. To view the details of your Standard Reserved Instance listing, you can use the DescribeReservedInstancesListings operation.

For more information, see Reserved Instance Marketplace in the Amazon Elastic Compute Cloud User Guide.

Examples:

Request syntax with placeholder values


resp = client.create_reserved_instances_listing({
  client_token: "String", # required
  instance_count: 1, # required
  price_schedules: [ # required
    {
      currency_code: "USD", # accepts USD
      price: 1.0,
      term: 1,
    },
  ],
  reserved_instances_id: "String", # required
})

Response structure


resp.reserved_instances_listings #=> Array
resp.reserved_instances_listings[0].client_token #=> String
resp.reserved_instances_listings[0].create_date #=> Time
resp.reserved_instances_listings[0].instance_counts #=> Array
resp.reserved_instances_listings[0].instance_counts[0].instance_count #=> Integer
resp.reserved_instances_listings[0].instance_counts[0].state #=> String, one of "available", "sold", "cancelled", "pending"
resp.reserved_instances_listings[0].price_schedules #=> Array
resp.reserved_instances_listings[0].price_schedules[0].active #=> Boolean
resp.reserved_instances_listings[0].price_schedules[0].currency_code #=> String, one of "USD"
resp.reserved_instances_listings[0].price_schedules[0].price #=> Float
resp.reserved_instances_listings[0].price_schedules[0].term #=> Integer
resp.reserved_instances_listings[0].reserved_instances_id #=> String
resp.reserved_instances_listings[0].reserved_instances_listing_id #=> String
resp.reserved_instances_listings[0].status #=> String, one of "active", "pending", "cancelled", "closed"
resp.reserved_instances_listings[0].status_message #=> String
resp.reserved_instances_listings[0].tags #=> Array
resp.reserved_instances_listings[0].tags[0].key #=> String
resp.reserved_instances_listings[0].tags[0].value #=> String
resp.reserved_instances_listings[0].update_date #=> Time

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :client_token (required, String)

    Unique, case-sensitive identifier you provide to ensure idempotency of your listings. This helps avoid duplicate listings. For more information, see Ensuring Idempotency.

  • :instance_count (required, Integer)

    The number of instances that are a part of a Reserved Instance account to be listed in the Reserved Instance Marketplace. This number should be less than or equal to the instance count associated with the Reserved Instance ID specified in this call.

  • :price_schedules (required, Array<Types::PriceScheduleSpecification>)

    A list specifying the price of the Standard Reserved Instance for each month remaining in the Reserved Instance term.

  • :reserved_instances_id (required, String)

    The ID of the active Standard Reserved Instance.

Returns:

See Also:



4461
4462
4463
4464
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 4461

def create_reserved_instances_listing(params = {}, options = {})
  req = build_request(:create_reserved_instances_listing, params)
  req.send_request(options)
end

#create_route(params = {}) ⇒ Types::CreateRouteResult

Creates a route in a route table within a VPC.

You must specify one of the following targets: Internet gateway or virtual private gateway, NAT instance, NAT gateway, VPC peering connection, network interface, or egress-only Internet gateway.

When determining how to route traffic, we use the route with the most specific match. For example, traffic is destined for the IPv4 address 192.0.2.3, and the route table includes the following two IPv4 routes:

  • 192.0.2.0/24 (goes to some target A)

  • 192.0.2.0/28 (goes to some target B)

Both routes apply to the traffic destined for 192.0.2.3. However, the second route in the list covers a smaller number of IP addresses and is therefore more specific, so we use that route to determine where to target the traffic.

For more information about route tables, see Route Tables in the Amazon Virtual Private Cloud User Guide.

Examples:

Example: To create a route


# This example creates a route for the specified route table. The route matches all traffic (0.0.0.0/0) and routes it to
# the specified Internet gateway.

resp = client.create_route({
  destination_cidr_block: "0.0.0.0/0", 
  gateway_id: "igw-c0a643a9", 
  route_table_id: "rtb-22574640", 
})

Request syntax with placeholder values


resp = client.create_route({
  destination_cidr_block: "String",
  destination_ipv_6_cidr_block: "String",
  dry_run: false,
  egress_only_internet_gateway_id: "String",
  gateway_id: "String",
  instance_id: "String",
  nat_gateway_id: "String",
  network_interface_id: "String",
  route_table_id: "String", # required
  vpc_peering_connection_id: "String",
})

Response structure


resp.return #=> Boolean

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :destination_cidr_block (String)

    The IPv4 CIDR address block used for the destination match. Routing decisions are based on the most specific match.

  • :destination_ipv_6_cidr_block (String)

    The IPv6 CIDR block used for the destination match. Routing decisions are based on the most specific match.

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

  • :egress_only_internet_gateway_id (String)

    [IPv6 traffic only] The ID of an egress-only Internet gateway.

  • :gateway_id (String)

    The ID of an Internet gateway or virtual private gateway attached to your VPC.

  • :instance_id (String)

    The ID of a NAT instance in your VPC. The operation fails if you specify an instance ID unless exactly one network interface is attached.

  • :nat_gateway_id (String)

    [IPv4 traffic only] The ID of a NAT gateway.

  • :network_interface_id (String)

    The ID of a network interface.

  • :route_table_id (required, String)

    The ID of the route table for the route.

  • :vpc_peering_connection_id (String)

    The ID of a VPC peering connection.

Returns:

See Also:



4570
4571
4572
4573
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 4570

def create_route(params = {}, options = {})
  req = build_request(:create_route, params)
  req.send_request(options)
end

#create_route_table(params = {}) ⇒ Types::CreateRouteTableResult

Creates a route table for the specified VPC. After you create a route table, you can add routes and associate the table with a subnet.

For more information about route tables, see Route Tables in the Amazon Virtual Private Cloud User Guide.

Examples:

Example: To create a route table


# This example creates a route table for the specified VPC.

resp = client.create_route_table({
  vpc_id: "vpc-a01106c2", 
})

resp.to_h outputs the following:
{
  route_table: {
    associations: [
    ], 
    propagating_vgws: [
    ], 
    route_table_id: "rtb-22574640", 
    routes: [
      {
        destination_cidr_block: "10.0.0.0/16", 
        gateway_id: "local", 
        state: "active", 
      }, 
    ], 
    tags: [
    ], 
    vpc_id: "vpc-a01106c2", 
  }, 
}

Request syntax with placeholder values


resp = client.create_route_table({
  dry_run: false,
  vpc_id: "String", # required
})

Response structure


resp.route_table.associations #=> Array
resp.route_table.associations[0].main #=> Boolean
resp.route_table.associations[0].route_table_association_id #=> String
resp.route_table.associations[0].route_table_id #=> String
resp.route_table.associations[0].subnet_id #=> String
resp.route_table.propagating_vgws #=> Array
resp.route_table.propagating_vgws[0].gateway_id #=> String
resp.route_table.route_table_id #=> String
resp.route_table.routes #=> Array
resp.route_table.routes[0].destination_cidr_block #=> String
resp.route_table.routes[0].destination_ipv_6_cidr_block #=> String
resp.route_table.routes[0].destination_prefix_list_id #=> String
resp.route_table.routes[0].egress_only_internet_gateway_id #=> String
resp.route_table.routes[0].gateway_id #=> String
resp.route_table.routes[0].instance_id #=> String
resp.route_table.routes[0].instance_owner_id #=> String
resp.route_table.routes[0].nat_gateway_id #=> String
resp.route_table.routes[0].network_interface_id #=> String
resp.route_table.routes[0].origin #=> String, one of "CreateRouteTable", "CreateRoute", "EnableVgwRoutePropagation"
resp.route_table.routes[0].state #=> String, one of "active", "blackhole"
resp.route_table.routes[0].vpc_peering_connection_id #=> String
resp.route_table.tags #=> Array
resp.route_table.tags[0].key #=> String
resp.route_table.tags[0].value #=> String
resp.route_table.vpc_id #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :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_id (required, String)

    The ID of the VPC.

Returns:

See Also:



4667
4668
4669
4670
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 4667

def create_route_table(params = {}, options = {})
  req = build_request(:create_route_table, params)
  req.send_request(options)
end

#create_security_group(params = {}) ⇒ Types::CreateSecurityGroupResult

Creates a security group.

A security group is for use with instances either in the EC2-Classic platform or in a specific VPC. For more information, see Amazon EC2 Security Groups in the Amazon Elastic Compute Cloud User Guide and Security Groups for Your VPC in the Amazon Virtual Private Cloud User Guide.

EC2-Classic: You can have up to 500 security groups.

EC2-VPC: You can create up to 500 security groups per VPC.

When you create a security group, you specify a friendly name of your choice. You can have a security group for use in EC2-Classic with the same name as a security group for use in a VPC. However, you can't have two security groups for use in EC2-Classic with the same name or two security groups for use in a VPC with the same name.

You have a default security group for use in EC2-Classic and a default security group for use in your VPC. If you don't specify a security group when you launch an instance, the instance is launched into the appropriate default security group. A default security group includes a default rule that grants instances unrestricted network access to each other.

You can add or remove rules from your security groups using AuthorizeSecurityGroupIngress, AuthorizeSecurityGroupEgress, RevokeSecurityGroupIngress, and RevokeSecurityGroupEgress.

Examples:

Request syntax with placeholder values


resp = client.create_security_group({
  description: "String", # required
  group_name: "String", # required
  vpc_id: "String",
  dry_run: false,
})

Response structure


resp.group_id #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :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 ._-:/()#,@[]+=&;{\}!$*

  • :vpc_id (String)

    [EC2-VPC] The ID of the VPC. Required for EC2-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:

See Also:



4756
4757
4758
4759
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 4756

def create_security_group(params = {}, options = {})
  req = build_request(:create_security_group, params)
  req.send_request(options)
end

#create_snapshot(params = {}) ⇒ Types::Snapshot

Creates a snapshot of an EBS volume and stores it in Amazon S3. You can use snapshots for backups, to make copies of EBS volumes, and to save data before shutting down an instance.

When a snapshot is created, any AWS Marketplace product codes that are associated with the source volume are propagated to the snapshot.

You can take a snapshot of an attached volume that is in use. However, snapshots only capture data that has been written to your EBS volume at the time the snapshot command is issued; this may exclude any data that has been cached by any applications or the operating system. If you can pause any file systems on the volume long enough to take a snapshot, your snapshot should be complete. However, if you cannot pause all file writes to the volume, you should unmount the volume from within the instance, issue the snapshot command, and then remount the volume to ensure a consistent and complete snapshot. You may remount and use your volume while the snapshot status is pending.

To create a snapshot for EBS volumes that serve as root devices, you should stop the instance before taking the snapshot.

Snapshots that are taken from encrypted volumes are automatically encrypted. Volumes that are created from encrypted snapshots are also automatically encrypted. Your encrypted volumes and any associated snapshots always remain protected.

For more information, see Amazon Elastic Block Store and Amazon EBS Encryption in the Amazon Elastic Compute Cloud User Guide.

Examples:

Example: To create a snapshot


# This example creates a snapshot of the volume with a volume ID of ``vol-1234567890abcdef0`` and a short description to
# identify the snapshot.

resp = client.create_snapshot({
  description: "This is my root volume snapshot.", 
  volume_id: "vol-1234567890abcdef0", 
})

resp.to_h outputs the following:
{
  description: "This is my root volume snapshot.", 
  owner_id: "012345678910", 
  snapshot_id: "snap-066877671789bd71b", 
  start_time: Time.parse("2014-02-28T21:06:01.000Z"), 
  state: "pending", 
  tags: [
  ], 
  volume_id: "vol-1234567890abcdef0", 
  volume_size: 8, 
}

Request syntax with placeholder values


resp = client.create_snapshot({
  description: "String",
  volume_id: "String", # required
  dry_run: false,
})

Response structure


resp.data_encryption_key_id #=> String
resp.description #=> String
resp.encrypted #=> Boolean
resp.kms_key_id #=> String
resp.owner_id #=> String
resp.progress #=> String
resp.snapshot_id #=> String
resp.start_time #=> Time
resp.state #=> String, one of "pending", "completed", "error"
resp.state_message #=> String
resp.volume_id #=> String
resp.volume_size #=> Integer
resp.owner_alias #=> String
resp.tags #=> Array
resp.tags[0].key #=> String
resp.tags[0].value #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :description (String)

    A description for the snapshot.

  • :volume_id (required, String)

    The ID of the EBS volume.

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



4879
4880
4881
4882
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 4879

def create_snapshot(params = {}, options = {})
  req = build_request(:create_snapshot, params)
  req.send_request(options)
end

#create_spot_datafeed_subscription(params = {}) ⇒ Types::CreateSpotDatafeedSubscriptionResult

Creates a data feed for Spot Instances, enabling you to view Spot Instance usage logs. You can create one data feed per AWS account. For more information, see Spot Instance Data Feed in the Amazon Elastic Compute Cloud User Guide.

Examples:

Example: To create a Spot Instance datafeed


# This example creates a Spot Instance data feed for your AWS account.

resp = client.create_spot_datafeed_subscription({
  bucket: "my-s3-bucket", 
  prefix: "spotdata", 
})

resp.to_h outputs the following:
{
  spot_datafeed_subscription: {
    bucket: "my-s3-bucket", 
    owner_id: "123456789012", 
    prefix: "spotdata", 
    state: "Active", 
  }, 
}

Request syntax with placeholder values


resp = client.create_spot_datafeed_subscription({
  bucket: "String", # required
  dry_run: false,
  prefix: "String",
})

Response structure


resp.spot_datafeed_subscription.bucket #=> String
resp.spot_datafeed_subscription.fault.code #=> String
resp.spot_datafeed_subscription.fault.message #=> String
resp.spot_datafeed_subscription.owner_id #=> String
resp.spot_datafeed_subscription.prefix #=> String
resp.spot_datafeed_subscription.state #=> String, one of "Active", "Inactive"

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :bucket (required, String)

    The Amazon S3 bucket in which to store the Spot Instance data feed.

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

  • :prefix (String)

    A prefix for the data feed file names.

Returns:

See Also:



4950
4951
4952
4953
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 4950

def create_spot_datafeed_subscription(params = {}, options = {})
  req = build_request(:create_spot_datafeed_subscription, params)
  req.send_request(options)
end

#create_subnet(params = {}) ⇒ Types::CreateSubnetResult

Creates a subnet in an existing VPC.

When you create each subnet, you provide the VPC ID and the IPv4 CIDR block you want for the subnet. After you create a subnet, you can't change its CIDR block. The size of the subnet's IPv4 CIDR block can be the same as a VPC's IPv4 CIDR block, or a subset of a VPC's IPv4 CIDR block. If you create more than one subnet in a VPC, the subnets' CIDR blocks must not overlap. The smallest IPv4 subnet (and VPC) you can create uses a /28 netmask (16 IPv4 addresses), and the largest uses a /16 netmask (65,536 IPv4 addresses).

If you've associated an IPv6 CIDR block with your VPC, you can create a subnet with an IPv6 CIDR block that uses a /64 prefix length.

AWS reserves both the first four and the last IPv4 address in each subnet's CIDR block. They're not available for use.

If you add more than one subnet to a VPC, they're set up in a star topology with a logical router in the middle.

If you launch an instance in a VPC using an Amazon EBS-backed AMI, the IP address doesn't change if you stop and restart the instance (unlike a similar instance launched outside a VPC, which gets a new IP address when restarted). It's therefore possible to have a subnet with no running instances (they're all stopped), but no remaining IP addresses available.

For more information about subnets, see Your VPC and Subnets in the Amazon Virtual Private Cloud User Guide.

Examples:

Example: To create a subnet


# This example creates a subnet in the specified VPC with the specified CIDR block. We recommend that you let us select an
# Availability Zone for you.

resp = client.create_subnet({
  cidr_block: "10.0.1.0/24", 
  vpc_id: "vpc-a01106c2", 
})

resp.to_h outputs the following:
{
  subnet: {
    availability_zone: "us-west-2c", 
    available_ip_address_count: 251, 
    cidr_block: "10.0.1.0/24", 
    state: "pending", 
    subnet_id: "subnet-9d4a7b6c", 
    vpc_id: "vpc-a01106c2", 
  }, 
}

Request syntax with placeholder values


resp = client.create_subnet({
  availability_zone: "String",
  cidr_block: "String", # required
  ipv_6_cidr_block: "String",
  vpc_id: "String", # required
  dry_run: false,
})

Response structure


resp.subnet.availability_zone #=> String
resp.subnet.available_ip_address_count #=> Integer
resp.subnet.cidr_block #=> String
resp.subnet.default_for_az #=> Boolean
resp.subnet.map_public_ip_on_launch #=> Boolean
resp.subnet.state #=> String, one of "pending", "available"
resp.subnet.subnet_id #=> String
resp.subnet.vpc_id #=> String
resp.subnet.assign_ipv_6_address_on_creation #=> Boolean
resp.subnet.ipv_6_cidr_block_association_set #=> Array
resp.subnet.ipv_6_cidr_block_association_set[0].association_id #=> String
resp.subnet.ipv_6_cidr_block_association_set[0].ipv_6_cidr_block #=> String
resp.subnet.ipv_6_cidr_block_association_set[0].ipv_6_cidr_block_state.state #=> String, one of "associating", "associated", "disassociating", "disassociated", "failing", "failed"
resp.subnet.ipv_6_cidr_block_association_set[0].ipv_6_cidr_block_state.status_message #=> String
resp.subnet.tags #=> Array
resp.subnet.tags[0].key #=> String
resp.subnet.tags[0].value #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

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

  • :vpc_id (required, String)

    The ID of 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:

See Also:



5074
5075
5076
5077
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 5074

def create_subnet(params = {}, options = {})
  req = build_request(:create_subnet, params)
  req.send_request(options)
end

#create_tags(params = {}) ⇒ Struct

Adds or overwrites one or more tags for the specified Amazon EC2 resource or resources. Each resource can have a maximum of 50 tags. Each tag consists of a key and optional value. Tag keys must be unique per resource.

For more information about tags, see Tagging Your Resources in the Amazon Elastic Compute Cloud User Guide. For more information about creating IAM policies that control users' access to resources based on tags, see Supported Resource-Level Permissions for Amazon EC2 API Actions in the Amazon Elastic Compute Cloud User Guide.

Examples:

Example: To add a tag to a resource


# This example adds the tag Stack=production to the specified image, or overwrites an existing tag for the AMI where the
# tag key is Stack.

resp = client.create_tags({
  resources: [
    "ami-78a54011", 
  ], 
  tags: [
    {
      key: "Stack", 
      value: "production", 
    }, 
  ], 
})

Request syntax with placeholder values


resp = client.create_tags({
  dry_run: false,
  resources: ["String"], # required
  tags: [ # required
    {
      key: "String",
      value: "String",
    },
  ],
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

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

  • :resources (required, Array<String>)

    The IDs of one or more resources to tag. For example, ami-1a2b3c4d.

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

  • (Struct)

    Returns an empty response.

See Also:



5146
5147
5148
5149
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 5146

def create_tags(params = {}, options = {})
  req = build_request(:create_tags, params)
  req.send_request(options)
end

#create_volume(params = {}) ⇒ Types::Volume

Creates an EBS volume that can be attached to an instance in the same Availability Zone. The volume is created in the regional endpoint that you send the HTTP request to. For more information see Regions and Endpoints.

You can create a new empty volume or restore a volume from an EBS snapshot. Any AWS Marketplace product codes from the snapshot are propagated to the volume.

You can create encrypted volumes with the Encrypted parameter. Encrypted volumes may only be attached to instances that support Amazon EBS encryption. Volumes that are created from encrypted snapshots are also automatically encrypted. For more information, see Amazon EBS Encryption in the Amazon Elastic Compute Cloud User Guide.

You can tag your volumes during creation. For more information, see Tagging Your Amazon EC2 Resources.

For more information, see Creating an Amazon EBS Volume in the Amazon Elastic Compute Cloud User Guide.

Examples:

Example: To create a new volume


# This example creates an 80 GiB General Purpose (SSD) volume in the Availability Zone ``us-east-1a``.

resp = client.create_volume({
  availability_zone: "us-east-1a", 
  size: 80, 
  volume_type: "gp2", 
})

resp.to_h outputs the following:
{
  availability_zone: "us-east-1a", 
  create_time: Time.parse("2016-08-29T18:52:32.724Z"), 
  encrypted: false, 
  iops: 240, 
  size: 80, 
  snapshot_id: "", 
  state: "creating", 
  volume_id: "vol-6b60b7c7", 
  volume_type: "gp2", 
}

Example: To create a new Provisioned IOPS (SSD) volume from a snapshot


# This example creates a new Provisioned IOPS (SSD) volume with 1000 provisioned IOPS from a snapshot in the Availability
# Zone ``us-east-1a``.

resp = client.create_volume({
  availability_zone: "us-east-1a", 
  iops: 1000, 
  snapshot_id: "snap-066877671789bd71b", 
  volume_type: "io1", 
})

resp.to_h outputs the following:
{
  attachments: [
  ], 
  availability_zone: "us-east-1a", 
  create_time: Time.parse("2016-08-29T18:52:32.724Z"), 
  iops: 1000, 
  size: 500, 
  snapshot_id: "snap-066877671789bd71b", 
  state: "creating", 
  tags: [
  ], 
  volume_id: "vol-1234567890abcdef0", 
  volume_type: "io1", 
}

Request syntax with placeholder values


resp = client.create_volume({
  availability_zone: "String", # required
  encrypted: false,
  iops: 1,
  kms_key_id: "String",
  size: 1,
  snapshot_id: "String",
  volume_type: "standard", # accepts standard, io1, gp2, sc1, st1
  dry_run: false,
  tag_specifications: [
    {
      resource_type: "customer-gateway", # accepts customer-gateway, dhcp-options, image, instance, internet-gateway, network-acl, network-interface, reserved-instances, route-table, snapshot, spot-instances-request, subnet, security-group, volume, vpc, vpn-connection, vpn-gateway
      tags: [
        {
          key: "String",
          value: "String",
        },
      ],
    },
  ],
})

Response structure


resp.attachments #=> Array
resp.attachments[0].attach_time #=> Time
resp.attachments[0].device #=> String
resp.attachments[0].instance_id #=> String
resp.attachments[0].state #=> String, one of "attaching", "attached", "detaching", "detached", "busy"
resp.attachments[0].volume_id #=> String
resp.attachments[0].delete_on_termination #=> Boolean
resp.availability_zone #=> String
resp.create_time #=> Time
resp.encrypted #=> Boolean
resp.kms_key_id #=> String
resp.size #=> Integer
resp.snapshot_id #=> String
resp.state #=> String, one of "creating", "available", "in-use", "deleting", "deleted", "error"
resp.volume_id #=> String
resp.iops #=> Integer
resp.tags #=> Array
resp.tags[0].key #=> String
resp.tags[0].value #=> String
resp.volume_type #=> String, one of "standard", "io1", "gp2", "sc1", "st1"

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :availability_zone (required, String)

    The Availability Zone in which to create the volume. Use DescribeAvailabilityZones to list the Availability Zones that are currently available to you.

  • :encrypted (Boolean)

    Specifies whether the volume should be encrypted. Encrypted Amazon EBS volumes may only be attached to instances that support Amazon EBS encryption. Volumes that are created from encrypted snapshots are automatically encrypted. There is no way to create an encrypted volume from an unencrypted snapshot or vice versa. If your AMI uses encrypted volumes, you can only launch it on supported instance types. For more information, see Amazon EBS Encryption in the Amazon Elastic Compute Cloud User Guide.

  • :iops (Integer)

    Only valid for Provisioned IOPS SSD volumes. The number of I/O operations per second (IOPS) to provision for the volume, with a maximum ratio of 50 IOPS/GiB.

    Constraint: Range is 100 to 20000 for Provisioned IOPS SSD volumes

  • :kms_key_id (String)

    The full ARN of the AWS Key Management Service (AWS KMS) customer master key (CMK) to use when creating the encrypted volume. This parameter is only required if you want to use a non-default CMK; if this parameter is not specified, the default CMK for EBS is used. The ARN contains the arn:aws:kms namespace, followed by the region of the CMK, the AWS account ID of the CMK owner, the key namespace, and then the CMK ID. For example, arn:aws:kms:us-east-1:012345678910:key/abcd1234-a123-456a-a12b-a123b4cd56ef. If a KmsKeyId is specified, the Encrypted flag must also be set.

  • :size (Integer)

    The size of the volume, in GiBs.

    Constraints: 1-16384 for gp2, 4-16384 for io1, 500-16384 for st1, 500-16384 for sc1, and 1-1024 for standard. If you specify a snapshot, the volume size must be equal to or larger than the snapshot size.

    Default: If you're creating the volume from a snapshot and don't specify a volume size, the default is the snapshot size.

  • :snapshot_id (String)

    The snapshot from which to create the volume.

  • :volume_type (String)

    The volume type. This can be gp2 for General Purpose SSD, io1 for Provisioned IOPS SSD, st1 for Throughput Optimized HDD, sc1 for Cold HDD, or standard for Magnetic volumes.

    Default: standard

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

  • :tag_specifications (Array<Types::TagSpecification>)

    The tags to apply to the volume during creation.

Returns:

See Also:



5365
5366
5367
5368
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 5365

def create_volume(params = {}, options = {})
  req = build_request(:create_volume, params)
  req.send_request(options)
end

#create_vpc(params = {}) ⇒ Types::CreateVpcResult

Creates a VPC with the specified IPv4 CIDR block. The smallest VPC you can create uses a /28 netmask (16 IPv4 addresses), and the largest uses a /16 netmask (65,536 IPv4 addresses). To help you decide how big to make your VPC, see Your VPC and Subnets in the Amazon Virtual Private Cloud User Guide.

You can optionally request an Amazon-provided IPv6 CIDR block for the VPC. The IPv6 CIDR block uses a /56 prefix length, and is allocated from Amazon's pool of IPv6 addresses. You cannot choose the IPv6 range for your VPC.

By default, each instance you launch in the VPC has the default DHCP options, which includes only a default DNS server that we provide (AmazonProvidedDNS). For more information about DHCP options, see DHCP Options Sets in the Amazon Virtual Private Cloud User Guide.

You can specify the instance tenancy value for the VPC when you create it. You can't change this value for the VPC after you create it. For more information, see Dedicated Instances in the Amazon Elastic Compute Cloud User Guide.

Examples:

Example: To create a VPC


# This example creates a VPC with the specified CIDR block.

resp = client.create_vpc({
  cidr_block: "10.0.0.0/16", 
})

resp.to_h outputs the following:
{
  vpc: {
    cidr_block: "10.0.0.0/16", 
    dhcp_options_id: "dopt-7a8b9c2d", 
    instance_tenancy: "default", 
    state: "pending", 
    vpc_id: "vpc-a01106c2", 
  }, 
}

Request syntax with placeholder values


resp = client.create_vpc({
  cidr_block: "String", # required
  amazon_provided_ipv_6_cidr_block: false,
  dry_run: false,
  instance_tenancy: "default", # accepts default, dedicated, host
})

Response structure


resp.vpc.cidr_block #=> String
resp.vpc.dhcp_options_id #=> String
resp.vpc.state #=> String, one of "pending", "available"
resp.vpc.vpc_id #=> String
resp.vpc.instance_tenancy #=> String, one of "default", "dedicated", "host"
resp.vpc.ipv_6_cidr_block_association_set #=> Array
resp.vpc.ipv_6_cidr_block_association_set[0].association_id #=> String
resp.vpc.ipv_6_cidr_block_association_set[0].ipv_6_cidr_block #=> String
resp.vpc.ipv_6_cidr_block_association_set[0].ipv_6_cidr_block_state.state #=> String, one of "associating", "associated", "disassociating", "disassociated", "failing", "failed"
resp.vpc.ipv_6_cidr_block_association_set[0].ipv_6_cidr_block_state.status_message #=> String
resp.vpc.cidr_block_association_set #=> Array
resp.vpc.cidr_block_association_set[0].association_id #=> String
resp.vpc.cidr_block_association_set[0].cidr_block #=> String
resp.vpc.cidr_block_association_set[0].cidr_block_state.state #=> String, one of "associating", "associated", "disassociating", "disassociated", "failing", "failed"
resp.vpc.cidr_block_association_set[0].cidr_block_state.status_message #=> String
resp.vpc.is_default #=> Boolean
resp.vpc.tags #=> Array
resp.vpc.tags[0].key #=> String
resp.vpc.tags[0].value #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :cidr_block (required, String)

    The IPv4 network range for the VPC, in CIDR notation. For example, 10.0.0.0/16.

  • :amazon_provided_ipv_6_cidr_block (Boolean)

    Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC. You cannot specify the range of IP addresses, or the size of the CIDR block.

  • :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_tenancy (String)

    The tenancy options for instances launched into the VPC. For default, instances are launched with shared tenancy by default. You can launch instances with any tenancy into a shared tenancy VPC. For dedicated, instances are launched as dedicated tenancy instances by default. You can only launch instances with a tenancy of dedicated or host into a dedicated tenancy VPC.

    Important: The host value cannot be used with this parameter. Use the default or dedicated values only.

    Default: default

Returns:

See Also:



5485
5486
5487
5488
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 5485

def create_vpc(params = {}, options = {})
  req = build_request(:create_vpc, params)
  req.send_request(options)
end

#create_vpc_endpoint(params = {}) ⇒ Types::CreateVpcEndpointResult

Creates a VPC endpoint for a specified service. An endpoint enables you to create a private connection between your VPC and the service. The service may be provided by AWS, an AWS Marketplace partner, or another AWS account. For more information, see VPC Endpoints in the Amazon Virtual Private Cloud User Guide.

A gateway endpoint serves as a target for a route in your route table for traffic destined for the AWS service. You can specify an endpoint policy to attach to the endpoint that will control access to the service from your VPC. You can also specify the VPC route tables that use the endpoint.

An interface endpoint is a network interface in your subnet that serves as an endpoint for communicating with the specified service. You can specify the subnets in which to create an endpoint, and the security groups to associate with the endpoint network interface.

Use DescribeVpcEndpointServices to get a list of supported services.

Examples:

Request syntax with placeholder values


resp = client.create_vpc_endpoint({
  dry_run: false,
  vpc_endpoint_type: "Interface", # accepts Interface, Gateway
  vpc_id: "String", # required
  service_name: "String", # required
  policy_document: "String",
  route_table_ids: ["String"],
  subnet_ids: ["String"],
  security_group_ids: ["String"],
  client_token: "String",
  private_dns_enabled: false,
})

Response structure


resp.vpc_endpoint.vpc_endpoint_id #=> String
resp.vpc_endpoint.vpc_endpoint_type #=> String, one of "Interface", "Gateway"
resp.vpc_endpoint.vpc_id #=> String
resp.vpc_endpoint.service_name #=> String
resp.vpc_endpoint.state #=> String, one of "PendingAcceptance", "Pending", "Available", "Deleting", "Deleted", "Rejected", "Failed", "Expired"
resp.vpc_endpoint.policy_document #=> String
resp.vpc_endpoint.route_table_ids #=> Array
resp.vpc_endpoint.route_table_ids[0] #=> String
resp.vpc_endpoint.subnet_ids #=> Array
resp.vpc_endpoint.subnet_ids[0] #=> String
resp.vpc_endpoint.groups #=> Array
resp.vpc_endpoint.groups[0].group_id #=> String
resp.vpc_endpoint.groups[0].group_name #=> String
resp.vpc_endpoint.private_dns_enabled #=> Boolean
resp.vpc_endpoint.network_interface_ids #=> Array
resp.vpc_endpoint.network_interface_ids[0] #=> String
resp.vpc_endpoint.dns_entries #=> Array
resp.vpc_endpoint.dns_entries[0].dns_name #=> String
resp.vpc_endpoint.dns_entries[0].hosted_zone_id #=> String
resp.vpc_endpoint.creation_timestamp #=> Time
resp.client_token #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :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_endpoint_type (String)

    The type of endpoint.

    Default: Gateway

  • :vpc_id (required, String)

    The ID of the VPC in which the endpoint will be used.

  • :service_name (required, String)

    The service name. To get a list of available services, use the DescribeVpcEndpointServices request.

  • :policy_document (String) — default: Gateway endpoint

    A policy to attach to the endpoint that controls access to the service. The policy must be in valid JSON format. If this parameter is not specified, we attach a default policy that allows full access to the service.

  • :route_table_ids (Array<String>) — default: Gateway endpoint

    One or more route table IDs.

  • :subnet_ids (Array<String>) — default: Interface endpoint

    The ID of one or more subnets in which to create an endpoint network interface.

  • :security_group_ids (Array<String>) — default: Interface endpoint

    The ID of one or more security groups to associate with the endpoint network interface.

  • :client_token (String)

    Unique, case-sensitive identifier you provide to ensure the idempotency of the request. For more information, see How to Ensure Idempotency.

  • :private_dns_enabled (Boolean) — default: Interface endpoint

    Indicate whether to associate a private hosted zone with the specified VPC. The private hosted zone contains a record set for the default public DNS name for the service for the region (for example, kinesis.us-east-1.amazonaws.com) which resolves to the private IP addresses of the endpoint network interfaces in the VPC. This enables you to make requests to the default public DNS name for the service instead of the public DNS names that are automatically generated by the VPC endpoint service.

    To use a private hosted zone, you must set the following VPC attributes to true: enableDnsHostnames and enableDnsSupport. Use ModifyVpcAttribute to set the VPC attributes.

    Default: true

Returns:

See Also:



5621
5622
5623
5624
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 5621

def create_vpc_endpoint(params = {}, options = {})
  req = build_request(:create_vpc_endpoint, params)
  req.send_request(options)
end

#create_vpc_endpoint_connection_notification(params = {}) ⇒ Types::CreateVpcEndpointConnectionNotificationResult

Creates a connection notification for a specified VPC endpoint or VPC endpoint service. A connection notification notifies you of specific endpoint events. You must create an SNS topic to receive notifications. For more information, see Create a Topic in the Amazon Simple Notification Service Developer Guide.

You can create a connection notification for interface endpoints only.

Examples:

Request syntax with placeholder values


resp = client.create_vpc_endpoint_connection_notification({
  dry_run: false,
  service_id: "String",
  vpc_endpoint_id: "String",
  connection_notification_arn: "String", # required
  connection_events: ["String"], # required
  client_token: "String",
})

Response structure


resp.connection_notification.connection_notification_id #=> String
resp.connection_notification.service_id #=> String
resp.connection_notification.vpc_endpoint_id #=> String
resp.connection_notification.connection_notification_type #=> String, one of "Topic"
resp.connection_notification.connection_notification_arn #=> String
resp.connection_notification.connection_events #=> Array
resp.connection_notification.connection_events[0] #=> String
resp.connection_notification.connection_notification_state #=> String, one of "Enabled", "Disabled"
resp.client_token #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

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

  • :service_id (String)

    The ID of the endpoint service.

  • :vpc_endpoint_id (String)

    The ID of the endpoint.

  • :connection_notification_arn (required, String)

    The ARN of the SNS topic for the notifications.

  • :connection_events (required, Array<String>)

    One or more endpoint events for which to receive notifications. Valid values are Accept, Connect, Delete, and Reject.

  • :client_token (String)

    Unique, case-sensitive identifier you provide to ensure the idempotency of the request. For more information, see How to Ensure Idempotency.

Returns:

See Also:



5698
5699
5700
5701
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 5698

def create_vpc_endpoint_connection_notification(params = {}, options = {})
  req = build_request(:create_vpc_endpoint_connection_notification, params)
  req.send_request(options)
end

#create_vpc_endpoint_service_configuration(params = {}) ⇒ Types::CreateVpcEndpointServiceConfigurationResult

Creates a VPC endpoint service configuration to which service consumers (AWS accounts, IAM users, and IAM roles) can connect. Service consumers can create an interface VPC endpoint to connect to your service.

To create an endpoint service configuration, you must first create a Network Load Balancer for your service. For more information, see VPC Endpoint Services in the Amazon Virtual Private Cloud User Guide.

Examples:

Request syntax with placeholder values


resp = client.create_vpc_endpoint_service_configuration({
  dry_run: false,
  acceptance_required: false,
  network_load_balancer_arns: ["String"], # required
  client_token: "String",
})

Response structure


resp.service_configuration.service_type #=> Array
resp.service_configuration.service_type[0].service_type #=> String, one of "Interface", "Gateway"
resp.service_configuration.service_id #=> String
resp.service_configuration.service_name #=> String
resp.service_configuration.service_state #=> String, one of "Pending", "Available", "Deleting", "Deleted", "Failed"
resp.service_configuration.availability_zones #=> Array
resp.service_configuration.availability_zones[0] #=> String
resp.service_configuration.acceptance_required #=> Boolean
resp.service_configuration.network_load_balancer_arns #=> Array
resp.service_configuration.network_load_balancer_arns[0] #=> String
resp.service_configuration.base_endpoint_dns_names #=> Array
resp.service_configuration.base_endpoint_dns_names[0] #=> String
resp.service_configuration.private_dns_name #=> String
resp.client_token #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

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

  • :acceptance_required (Boolean)

    Indicate whether requests from service consumers to create an endpoint to your service must be accepted. To accept a request, use AcceptVpcEndpointConnections.

  • :network_load_balancer_arns (required, Array<String>)

    The Amazon Resource Names (ARNs) of one or more Network Load Balancers for your service.

  • :client_token (String)

    Unique, case-sensitive identifier you provide to ensure the idempotency of the request. For more information, see How to Ensure Idempotency.

Returns:

See Also:



5776
5777
5778
5779
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 5776

def create_vpc_endpoint_service_configuration(params = {}, options = {})
  req = build_request(:create_vpc_endpoint_service_configuration, params)
  req.send_request(options)
end

#create_vpc_peering_connection(params = {}) ⇒ Types::CreateVpcPeeringConnectionResult

Requests a VPC peering connection between two VPCs: a requester VPC that you own and an accepter VPC with which to create the connection. The accepter VPC can belong to another AWS account and can be in a different region to the requester VPC. The requester VPC and accepter VPC cannot have overlapping CIDR blocks.

The owner of the accepter VPC must accept the peering request to activate the peering connection. The VPC peering connection request expires after 7 days, after which it cannot be accepted or rejected.

If you create a VPC peering connection request between VPCs with overlapping CIDR blocks, the VPC peering connection has a status of failed.

Examples:

Request syntax with placeholder values


resp = client.create_vpc_peering_connection({
  dry_run: false,
  peer_owner_id: "String",
  peer_vpc_id: "String",
  vpc_id: "String",
  peer_region: "String",
})

Response structure


resp.vpc_peering_connection.accepter_vpc_info.cidr_block #=> String
resp.vpc_peering_connection.accepter_vpc_info.ipv_6_cidr_block_set #=> Array
resp.vpc_peering_connection.accepter_vpc_info.ipv_6_cidr_block_set[0].ipv_6_cidr_block #=> String
resp.vpc_peering_connection.accepter_vpc_info.cidr_block_set #=> Array
resp.vpc_peering_connection.accepter_vpc_info.cidr_block_set[0].cidr_block #=> String
resp.vpc_peering_connection.accepter_vpc_info.owner_id #=> String
resp.vpc_peering_connection.accepter_vpc_info.peering_options.allow_dns_resolution_from_remote_vpc #=> Boolean
resp.vpc_peering_connection.accepter_vpc_info.peering_options.allow_egress_from_local_classic_link_to_remote_vpc #=> Boolean
resp.vpc_peering_connection.accepter_vpc_info.peering_options.allow_egress_from_local_vpc_to_remote_classic_link #=> Boolean
resp.vpc_peering_connection.accepter_vpc_info.vpc_id #=> String
resp.vpc_peering_connection.accepter_vpc_info.region #=> String
resp.vpc_peering_connection.expiration_time #=> Time
resp.vpc_peering_connection.requester_vpc_info.cidr_block #=> String
resp.vpc_peering_connection.requester_vpc_info.ipv_6_cidr_block_set #=> Array
resp.vpc_peering_connection.requester_vpc_info.ipv_6_cidr_block_set[0].ipv_6_cidr_block #=> String
resp.vpc_peering_connection.requester_vpc_info.cidr_block_set #=> Array
resp.vpc_peering_connection.requester_vpc_info.cidr_block_set[0].cidr_block #=> String
resp.vpc_peering_connection.requester_vpc_info.owner_id #=> String
resp.vpc_peering_connection.requester_vpc_info.peering_options.allow_dns_resolution_from_remote_vpc #=> Boolean
resp.vpc_peering_connection.requester_vpc_info.peering_options.allow_egress_from_local_classic_link_to_remote_vpc #=> Boolean
resp.vpc_peering_connection.requester_vpc_info.peering_options.allow_egress_from_local_vpc_to_remote_classic_link #=> Boolean
resp.vpc_peering_connection.requester_vpc_info.vpc_id #=> String
resp.vpc_peering_connection.requester_vpc_info.region #=> String
resp.vpc_peering_connection.status.code #=> String, one of "initiating-request", "pending-acceptance", "active", "deleted", "rejected", "failed", "expired", "provisioning", "deleting"
resp.vpc_peering_connection.status.message #=> String
resp.vpc_peering_connection.tags #=> Array
resp.vpc_peering_connection.tags[0].key #=> String
resp.vpc_peering_connection.tags[0].value #=> String
resp.vpc_peering_connection.vpc_peering_connection_id #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

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

  • :vpc_id (String)

    The ID of the requester VPC. 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:



5870
5871
5872
5873
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 5870

def create_vpc_peering_connection(params = {}, options = {})
  req = build_request(:create_vpc_peering_connection, params)
  req.send_request(options)
end

#create_vpn_connection(params = {}) ⇒ Types::CreateVpnConnectionResult

Creates a VPN connection between an existing virtual private gateway and a VPN customer gateway. The only supported connection type is ipsec.1.

The response includes information that you need to give to your network administrator to configure your customer gateway.

We strongly recommend that you use HTTPS when calling this operation because the response contains sensitive cryptographic information for configuring your customer gateway.

If you decide to shut down your VPN connection for any reason and later create a new VPN connection, you must reconfigure your customer gateway with the new information returned from this call.

This is an idempotent operation. If you perform the operation more than once, Amazon EC2 doesn't return an error.

For more information, see AWS Managed VPN Connections in the Amazon Virtual Private Cloud User Guide.

Examples:

Request syntax with placeholder values


resp = client.create_vpn_connection({
  customer_gateway_id: "String", # required
  type: "String", # required
  vpn_gateway_id: "String", # required
  dry_run: false,
  options: {
    static_routes_only: false,
    tunnel_options: [
      {
        tunnel_inside_cidr: "String",
        pre_shared_key: "String",
      },
    ],
  },
})

Response structure


resp.vpn_connection.customer_gateway_configuration #=> String
resp.vpn_connection.customer_gateway_id #=> String
resp.vpn_connection.category #=> String
resp.vpn_connection.state #=> String, one of "pending", "available", "deleting", "deleted"
resp.vpn_connection.type #=> String, one of "ipsec.1"
resp.vpn_connection.vpn_connection_id #=> String
resp.vpn_connection.vpn_gateway_id #=> String
resp.vpn_connection.options.static_routes_only #=> Boolean
resp.vpn_connection.routes #=> Array
resp.vpn_connection.routes[0].destination_cidr_block #=> String
resp.vpn_connection.routes[0].source #=> String, one of "Static"
resp.vpn_connection.routes[0].state #=> String, one of "pending", "available", "deleting", "deleted"
resp.vpn_connection.tags #=> Array
resp.vpn_connection.tags[0].key #=> String
resp.vpn_connection.tags[0].value #=> String
resp.vpn_connection.vgw_telemetry #=> Array
resp.vpn_connection.vgw_telemetry[0].accepted_route_count #=> Integer
resp.vpn_connection.vgw_telemetry[0].last_status_change #=> Time
resp.vpn_connection.vgw_telemetry[0].outside_ip_address #=> String
resp.vpn_connection.vgw_telemetry[0].status #=> String, one of "UP", "DOWN"
resp.vpn_connection.vgw_telemetry[0].status_message #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :customer_gateway_id (required, String)

    The ID of the customer gateway.

  • :type (required, String)

    The type of VPN connection (ipsec.1).

  • :vpn_gateway_id (required, String)

    The ID of the virtual private gateway.

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

  • :options (Types::VpnConnectionOptionsSpecification)

    The options for the VPN connection.

Returns:

See Also:



5968
5969
5970
5971
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 5968

def create_vpn_connection(params = {}, options = {})
  req = build_request(:create_vpn_connection, params)
  req.send_request(options)
end

#create_vpn_connection_route(params = {}) ⇒ Struct

Creates a static route associated with a VPN connection between an existing virtual private gateway and a VPN customer gateway. The static route allows traffic to be routed from the virtual private gateway to the VPN customer gateway.

For more information about VPN connections, see AWS Managed VPN Connections in the Amazon Virtual Private Cloud User Guide.

Examples:

Request syntax with placeholder values


resp = client.create_vpn_connection_route({
  destination_cidr_block: "String", # required
  vpn_connection_id: "String", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :destination_cidr_block (required, String)

    The CIDR block associated with the local subnet of the customer network.

  • :vpn_connection_id (required, String)

    The ID of the VPN connection.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



6005
6006
6007
6008
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb', line 6005

def create_vpn_connection_route(params = {}, options = {})
  req = build_request(:create_vpn_connection_route, params)
  req.send_request(options)
end

#create_vpn_gateway(params = {}) ⇒ Types::CreateVpnGatewayResult

Creates a virtual private gateway. A virtual private gateway is the endpoint on the VPC side of your VPN connection. You can create a virtual private gateway before creating the VPC itself.

For more information about virtual private gateways, see AWS Managed VPN Connections in the Amazon Virtual Private Cloud User Guide.

Examples:

Request syntax with placeholder values


resp = client.create_vpn_gateway({
  availability_zone: "String",
  type: "ipsec.1", # required, accepts ipsec.1
  amazon_side_asn: 1,
  dry_run: false,
})

Response structure


resp.vpn_gateway.availability_zone #=> String
resp.vpn_gateway.state #=> String, one of "pending", "available", "deleting", "deleted"
resp.vpn_gateway.type #=> String, one of "ipsec.1"
resp.vpn_gateway.vpc_attachments #=> Array
resp.vpn_gateway.vpc_attachments[0].state #=> String, one of "attaching", "attached", "detaching", "detached"