Class: Aws::EC2::Resource
- Inherits:
-
Object
- Object
- Aws::EC2::Resource
- Includes:
- ResourcePaginationFix
- Defined in:
- gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb,
gems/aws-sdk-ec2/lib/aws-sdk-ec2/customizations/resource.rb
Overview
This class provides a resource oriented interface for EC2. To create a resource object:
resource = Aws::EC2::Resource.new(region: 'us-west-2')
You can supply a client object with custom configuration that will be used for all resource operations.
If you do not pass :client, a default client will be constructed.
client = Aws::EC2::Client.new(region: 'us-west-2')
resource = Aws::EC2::Resource.new(client: client)
Actions collapse
-
#create_dhcp_options(options = {}) ⇒ DhcpOptions
-
#create_instances(options = {}) ⇒ Instance::Collection
-
#create_internet_gateway(options = {}) ⇒ InternetGateway
-
#create_key_pair(options = {}) ⇒ KeyPair
-
#create_nat_gateway(options = {}) ⇒ NatGateway
-
#create_network_acl(options = {}) ⇒ NetworkAcl
-
#create_network_interface(options = {}) ⇒ NetworkInterface
-
#create_placement_group(options = {}) ⇒ PlacementGroup
-
#create_route_table(options = {}) ⇒ RouteTable
-
#create_security_group(options = {}) ⇒ SecurityGroup
-
#create_snapshot(options = {}) ⇒ Snapshot
-
#create_subnet(options = {}) ⇒ Subnet
-
#create_tags(options) ⇒ EmptyStructure
-
#create_volume(options = {}) ⇒ Volume
-
#create_vpc(options = {}) ⇒ Vpc
-
#create_vpc_peering_connection(options = {}) ⇒ VpcPeeringConnection
-
#delete_tags(options = {}) ⇒ EmptyStructure
-
#disassociate_route_table(options = {}) ⇒ EmptyStructure
-
#import_key_pair(options = {}) ⇒ KeyPairInfo
-
#register_image(options = {}) ⇒ Image
Associations collapse
-
#classic_addresses(options = {}) ⇒ ClassicAddress::Collection
-
#dhcp_options(id) ⇒ DhcpOptions
-
#dhcp_options_sets(options = {}) ⇒ DhcpOptions::Collection
-
#image(id) ⇒ Image
-
#images(options = {}) ⇒ Image::Collection
-
#instance(id) ⇒ Instance
-
#instances(options = {}) ⇒ Instance::Collection
-
#internet_gateway(id) ⇒ InternetGateway
-
#internet_gateways(options = {}) ⇒ InternetGateway::Collection
-
#key_pair(name) ⇒ KeyPairInfo
-
#key_pairs(options = {}) ⇒ KeyPairInfo::Collection
-
#nat_gateway(id) ⇒ NatGateway
-
#nat_gateways(options = {}) ⇒ NatGateway::Collection
-
#network_acl(id) ⇒ NetworkAcl
-
#network_acls(options = {}) ⇒ NetworkAcl::Collection
-
#network_interface(id) ⇒ NetworkInterface
-
#network_interfaces(options = {}) ⇒ NetworkInterface::Collection
-
#placement_group(name) ⇒ PlacementGroup
-
#placement_groups(options = {}) ⇒ PlacementGroup::Collection
-
#route_table(id) ⇒ RouteTable
-
#route_table_association(id) ⇒ RouteTableAssociation
-
#route_tables(options = {}) ⇒ RouteTable::Collection
-
#security_group(id) ⇒ SecurityGroup
-
#security_groups(options = {}) ⇒ SecurityGroup::Collection
-
#snapshot(id) ⇒ Snapshot
-
#snapshots(options = {}) ⇒ Snapshot::Collection
-
#subnet(id) ⇒ Subnet
-
#subnets(options = {}) ⇒ Subnet::Collection
-
#volume(id) ⇒ Volume
-
#volumes(options = {}) ⇒ Volume::Collection
-
#vpc(id) ⇒ Vpc
-
#vpc_addresses(options = {}) ⇒ VpcAddress::Collection
-
#vpc_peering_connection(id) ⇒ VpcPeeringConnection
-
#vpc_peering_connections(options = {}) ⇒ VpcPeeringConnection::Collection
-
#vpcs(options = {}) ⇒ Vpc::Collection
Instance Method Summary collapse
-
#client ⇒ Client
-
#initialize(options = {}) ⇒ Resource
constructor
A new instance of Resource.
Constructor Details
Instance Method Details
#classic_addresses(options = {}) ⇒ ClassicAddress::Collection
Examples:
Request syntax with placeholder values
Request syntax with placeholder values
classic_addresses = ec2.classic_addresses({
public_ips: ["String"],
dry_run: false,
filters: [
{
name: "String",
values: ["String"],
},
],
allocation_ids: ["AllocationId"],
})
Parameters:
-
options
(Hash)
(defaults to: {})
—
({})
Options Hash (options):
-
:public_ips
(Array<String>)
—
One or more Elastic IP addresses.
Default: Describes all your Elastic IP addresses.
-
: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 isUnauthorizedOperation. -
:filters
(Array<Types::Filter>)
—
One or more filters. Filter names and values are case-sensitive.
allocation-id- The allocation ID for the address.association-id- The association ID for the address.instance-id- The ID of the instance the address is associated with, if any.network-border-group- A unique set of Availability Zones, Local Zones, or Wavelength Zones from where Amazon Web Services advertises IP addresses.network-interface-id- The ID of the network interface that the address is associated with, if any.network-interface-owner-id- The Amazon Web Services account ID of the owner.private-ip-address- The private IP address associated with the Elastic IP address.public-ip- The Elastic IP address, or the carrier IP address.tag:<key> - The key/value combination of a tag assigned to the resource. Use the tag key in the filter name and the tag value as the filter value. For example, to find all resources that have a tag with the keyOwnerand the valueTeamA, specifytag:Ownerfor the filter name andTeamAfor the filter value.tag-key- The key of a tag assigned to the resource. Use this filter to find all resources assigned a tag with a specific key, regardless of the tag value.
-
:allocation_ids
(Array<String>)
—
Information about the allocation IDs.
Returns:
2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 2258 def classic_addresses(options = {}) batches = Enumerator.new do |y| batch = [] options = Aws::Util.deep_merge(options, filters: [{ name: "domain", values: ["standard"] }]) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.describe_addresses(options) end resp.data.addresses.each do |a| batch << ClassicAddress.new( public_ip: a.public_ip, data: a, client: @client ) end y.yield(batch) end ClassicAddress::Collection.new(batches) end |
#client ⇒ Client
Returns:
- (Client)
32 33 34 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 32 def client @client end |
#create_dhcp_options(options = {}) ⇒ DhcpOptions
Examples:
Request syntax with placeholder values
Request syntax with placeholder values
dhcpoptions = ec2.create_dhcp_options({
dhcp_configurations: [ # required
{
key: "String",
values: ["String"],
},
],
tag_specifications: [
{
resource_type: "capacity-reservation", # accepts capacity-reservation, client-vpn-endpoint, customer-gateway, carrier-gateway, coip-pool, declarative-policies-report, dedicated-host, dhcp-options, egress-only-internet-gateway, elastic-ip, elastic-gpu, export-image-task, export-instance-task, fleet, fpga-image, host-reservation, image, image-usage-report, import-image-task, import-snapshot-task, instance, instance-event-window, internet-gateway, ipam, ipam-pool, ipam-scope, ipv4pool-ec2, ipv6pool-ec2, key-pair, launch-template, local-gateway, local-gateway-route-table, local-gateway-virtual-interface, local-gateway-virtual-interface-group, local-gateway-route-table-vpc-association, local-gateway-route-table-virtual-interface-group-association, natgateway, network-acl, network-interface, network-insights-analysis, network-insights-path, network-insights-access-scope, network-insights-access-scope-analysis, outpost-lag, placement-group, prefix-list, replace-root-volume-task, reserved-instances, route-table, security-group, security-group-rule, service-link-virtual-interface, snapshot, spot-fleet-request, spot-instances-request, subnet, subnet-cidr-reservation, traffic-mirror-filter, traffic-mirror-session, traffic-mirror-target, transit-gateway, transit-gateway-attachment, transit-gateway-connect-peer, transit-gateway-multicast-domain, transit-gateway-policy-table, transit-gateway-metering-policy, transit-gateway-route-table, transit-gateway-route-table-announcement, volume, vpc, vpc-endpoint, vpc-endpoint-connection, vpc-endpoint-service, vpc-endpoint-service-permission, vpc-peering-connection, vpn-connection, vpn-gateway, vpc-flow-log, capacity-reservation-fleet, traffic-mirror-filter-rule, vpc-endpoint-connection-device-type, verified-access-instance, verified-access-group, verified-access-endpoint, verified-access-policy, verified-access-trust-provider, vpn-connection-device-type, vpc-block-public-access-exclusion, vpc-encryption-control, route-server, route-server-endpoint, route-server-peer, ipam-resource-discovery, ipam-resource-discovery-association, instance-connect-endpoint, verified-access-endpoint-target, ipam-external-resource-verification-token, capacity-block, mac-modification-task, ipam-prefix-list-resolver, ipam-policy, ipam-prefix-list-resolver-target, capacity-manager-data-export, vpn-concentrator
tags: [
{
key: "String",
value: "String",
},
],
},
],
dry_run: false,
})
Parameters:
-
options
(Hash)
(defaults to: {})
—
({})
Options Hash (options):
-
:dhcp_configurations
(required, Array<Types::NewDhcpConfiguration>)
—
A DHCP configuration option.
-
:tag_specifications
(Array<Types::TagSpecification>)
—
The tags to assign to the DHCP 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 isUnauthorizedOperation.
Returns:
71 72 73 74 75 76 77 78 79 80 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 71 def create_dhcp_options(options = {}) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.create_dhcp_options(options) end DhcpOptions.new( id: resp.data.dhcp_options.dhcp_options_id, data: resp.data.dhcp_options, client: @client ) end |
#create_instances(options = {}) ⇒ Instance::Collection
Examples:
Request syntax with placeholder values
Request syntax with placeholder values
instance = ec2.create_instances({
block_device_mappings: [
{
ebs: {
delete_on_termination: false,
iops: 1,
snapshot_id: "SnapshotId",
volume_size: 1,
volume_type: "standard", # accepts standard, io1, io2, gp2, sc1, st1, gp3
kms_key_id: "String",
throughput: 1,
outpost_arn: "String",
availability_zone: "String",
encrypted: false,
volume_initialization_rate: 1,
availability_zone_id: "String",
},
no_device: "String",
device_name: "String",
virtual_name: "String",
},
],
image_id: "ImageId",
instance_type: "a1.medium", # accepts a1.medium, a1.large, a1.xlarge, a1.2xlarge, a1.4xlarge, a1.metal, 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.12xlarge, c5.18xlarge, c5.24xlarge, c5.metal, c5a.large, c5a.xlarge, c5a.2xlarge, c5a.4xlarge, c5a.8xlarge, c5a.12xlarge, c5a.16xlarge, c5a.24xlarge, c5ad.large, c5ad.xlarge, c5ad.2xlarge, c5ad.4xlarge, c5ad.8xlarge, c5ad.12xlarge, c5ad.16xlarge, c5ad.24xlarge, c5d.large, c5d.xlarge, c5d.2xlarge, c5d.4xlarge, c5d.9xlarge, c5d.12xlarge, c5d.18xlarge, c5d.24xlarge, c5d.metal, c5n.large, c5n.xlarge, c5n.2xlarge, c5n.4xlarge, c5n.9xlarge, c5n.18xlarge, c5n.metal, c6g.medium, c6g.large, c6g.xlarge, c6g.2xlarge, c6g.4xlarge, c6g.8xlarge, c6g.12xlarge, c6g.16xlarge, c6g.metal, c6gd.medium, c6gd.large, c6gd.xlarge, c6gd.2xlarge, c6gd.4xlarge, c6gd.8xlarge, c6gd.12xlarge, c6gd.16xlarge, c6gd.metal, c6gn.medium, c6gn.large, c6gn.xlarge, c6gn.2xlarge, c6gn.4xlarge, c6gn.8xlarge, c6gn.12xlarge, c6gn.16xlarge, c6i.large, c6i.xlarge, c6i.2xlarge, c6i.4xlarge, c6i.8xlarge, c6i.12xlarge, c6i.16xlarge, c6i.24xlarge, c6i.32xlarge, c6i.metal, cc1.4xlarge, cc2.8xlarge, cg1.4xlarge, cr1.8xlarge, d2.xlarge, d2.2xlarge, d2.4xlarge, d2.8xlarge, d3.xlarge, d3.2xlarge, d3.4xlarge, d3.8xlarge, d3en.xlarge, d3en.2xlarge, d3en.4xlarge, d3en.6xlarge, d3en.8xlarge, d3en.12xlarge, dl1.24xlarge, f1.2xlarge, f1.4xlarge, f1.16xlarge, g2.2xlarge, g2.8xlarge, g3.4xlarge, g3.8xlarge, g3.16xlarge, g3s.xlarge, g4ad.xlarge, g4ad.2xlarge, g4ad.4xlarge, g4ad.8xlarge, g4ad.16xlarge, g4dn.xlarge, g4dn.2xlarge, g4dn.4xlarge, g4dn.8xlarge, g4dn.12xlarge, g4dn.16xlarge, g4dn.metal, g5.xlarge, g5.2xlarge, g5.4xlarge, g5.8xlarge, g5.12xlarge, g5.16xlarge, g5.24xlarge, g5.48xlarge, g5g.xlarge, g5g.2xlarge, g5g.4xlarge, g5g.8xlarge, g5g.16xlarge, g5g.metal, hi1.4xlarge, hpc6a.48xlarge, hs1.8xlarge, h1.2xlarge, h1.4xlarge, h1.8xlarge, h1.16xlarge, i2.xlarge, i2.2xlarge, i2.4xlarge, i2.8xlarge, i3.large, i3.xlarge, i3.2xlarge, i3.4xlarge, i3.8xlarge, i3.16xlarge, i3.metal, i3en.large, i3en.xlarge, i3en.2xlarge, i3en.3xlarge, i3en.6xlarge, i3en.12xlarge, i3en.24xlarge, i3en.metal, im4gn.large, im4gn.xlarge, im4gn.2xlarge, im4gn.4xlarge, im4gn.8xlarge, im4gn.16xlarge, inf1.xlarge, inf1.2xlarge, inf1.6xlarge, inf1.24xlarge, is4gen.medium, is4gen.large, is4gen.xlarge, is4gen.2xlarge, is4gen.4xlarge, is4gen.8xlarge, m1.small, m1.medium, m1.large, m1.xlarge, m2.xlarge, m2.2xlarge, m2.4xlarge, m3.medium, m3.large, m3.xlarge, m3.2xlarge, m4.large, m4.xlarge, m4.2xlarge, m4.4xlarge, m4.10xlarge, m4.16xlarge, m5.large, m5.xlarge, m5.2xlarge, m5.4xlarge, m5.8xlarge, m5.12xlarge, m5.16xlarge, m5.24xlarge, m5.metal, m5a.large, m5a.xlarge, m5a.2xlarge, m5a.4xlarge, m5a.8xlarge, m5a.12xlarge, m5a.16xlarge, m5a.24xlarge, m5ad.large, m5ad.xlarge, m5ad.2xlarge, m5ad.4xlarge, m5ad.8xlarge, m5ad.12xlarge, m5ad.16xlarge, m5ad.24xlarge, m5d.large, m5d.xlarge, m5d.2xlarge, m5d.4xlarge, m5d.8xlarge, m5d.12xlarge, m5d.16xlarge, m5d.24xlarge, m5d.metal, m5dn.large, m5dn.xlarge, m5dn.2xlarge, m5dn.4xlarge, m5dn.8xlarge, m5dn.12xlarge, m5dn.16xlarge, m5dn.24xlarge, m5dn.metal, m5n.large, m5n.xlarge, m5n.2xlarge, m5n.4xlarge, m5n.8xlarge, m5n.12xlarge, m5n.16xlarge, m5n.24xlarge, m5n.metal, m5zn.large, m5zn.xlarge, m5zn.2xlarge, m5zn.3xlarge, m5zn.6xlarge, m5zn.12xlarge, m5zn.metal, m6a.large, m6a.xlarge, m6a.2xlarge, m6a.4xlarge, m6a.8xlarge, m6a.12xlarge, m6a.16xlarge, m6a.24xlarge, m6a.32xlarge, m6a.48xlarge, m6g.metal, m6g.medium, m6g.large, m6g.xlarge, m6g.2xlarge, m6g.4xlarge, m6g.8xlarge, m6g.12xlarge, m6g.16xlarge, m6gd.metal, m6gd.medium, m6gd.large, m6gd.xlarge, m6gd.2xlarge, m6gd.4xlarge, m6gd.8xlarge, m6gd.12xlarge, m6gd.16xlarge, m6i.large, m6i.xlarge, m6i.2xlarge, m6i.4xlarge, m6i.8xlarge, m6i.12xlarge, m6i.16xlarge, m6i.24xlarge, m6i.32xlarge, m6i.metal, mac1.metal, p2.xlarge, p2.8xlarge, p2.16xlarge, p3.2xlarge, p3.8xlarge, p3.16xlarge, p3dn.24xlarge, p4d.24xlarge, r3.large, r3.xlarge, r3.2xlarge, r3.4xlarge, r3.8xlarge, r4.large, r4.xlarge, r4.2xlarge, r4.4xlarge, r4.8xlarge, r4.16xlarge, r5.large, r5.xlarge, r5.2xlarge, r5.4xlarge, r5.8xlarge, r5.12xlarge, r5.16xlarge, r5.24xlarge, r5.metal, r5a.large, r5a.xlarge, r5a.2xlarge, r5a.4xlarge, r5a.8xlarge, r5a.12xlarge, r5a.16xlarge, r5a.24xlarge, r5ad.large, r5ad.xlarge, r5ad.2xlarge, r5ad.4xlarge, r5ad.8xlarge, r5ad.12xlarge, r5ad.16xlarge, r5ad.24xlarge, r5b.large, r5b.xlarge, r5b.2xlarge, r5b.4xlarge, r5b.8xlarge, r5b.12xlarge, r5b.16xlarge, r5b.24xlarge, r5b.metal, r5d.large, r5d.xlarge, r5d.2xlarge, r5d.4xlarge, r5d.8xlarge, r5d.12xlarge, r5d.16xlarge, r5d.24xlarge, r5d.metal, r5dn.large, r5dn.xlarge, r5dn.2xlarge, r5dn.4xlarge, r5dn.8xlarge, r5dn.12xlarge, r5dn.16xlarge, r5dn.24xlarge, r5dn.metal, r5n.large, r5n.xlarge, r5n.2xlarge, r5n.4xlarge, r5n.8xlarge, r5n.12xlarge, r5n.16xlarge, r5n.24xlarge, r5n.metal, r6g.medium, r6g.large, r6g.xlarge, r6g.2xlarge, r6g.4xlarge, r6g.8xlarge, r6g.12xlarge, r6g.16xlarge, r6g.metal, r6gd.medium, r6gd.large, r6gd.xlarge, r6gd.2xlarge, r6gd.4xlarge, r6gd.8xlarge, r6gd.12xlarge, r6gd.16xlarge, r6gd.metal, r6i.large, r6i.xlarge, r6i.2xlarge, r6i.4xlarge, r6i.8xlarge, r6i.12xlarge, r6i.16xlarge, r6i.24xlarge, r6i.32xlarge, r6i.metal, t1.micro, t2.nano, t2.micro, t2.small, t2.medium, t2.large, t2.xlarge, t2.2xlarge, t3.nano, t3.micro, t3.small, t3.medium, t3.large, t3.xlarge, t3.2xlarge, t3a.nano, t3a.micro, t3a.small, t3a.medium, t3a.large, t3a.xlarge, t3a.2xlarge, t4g.nano, t4g.micro, t4g.small, t4g.medium, t4g.large, t4g.xlarge, t4g.2xlarge, u-6tb1.56xlarge, u-6tb1.112xlarge, u-9tb1.112xlarge, u-12tb1.112xlarge, u-6tb1.metal, u-9tb1.metal, u-12tb1.metal, u-18tb1.metal, u-24tb1.metal, vt1.3xlarge, vt1.6xlarge, vt1.24xlarge, x1.16xlarge, x1.32xlarge, x1e.xlarge, x1e.2xlarge, x1e.4xlarge, x1e.8xlarge, x1e.16xlarge, x1e.32xlarge, x2iezn.2xlarge, x2iezn.4xlarge, x2iezn.6xlarge, x2iezn.8xlarge, x2iezn.12xlarge, x2iezn.metal, x2gd.medium, x2gd.large, x2gd.xlarge, x2gd.2xlarge, x2gd.4xlarge, x2gd.8xlarge, x2gd.12xlarge, x2gd.16xlarge, x2gd.metal, z1d.large, z1d.xlarge, z1d.2xlarge, z1d.3xlarge, z1d.6xlarge, z1d.12xlarge, z1d.metal, x2idn.16xlarge, x2idn.24xlarge, x2idn.32xlarge, x2iedn.xlarge, x2iedn.2xlarge, x2iedn.4xlarge, x2iedn.8xlarge, x2iedn.16xlarge, x2iedn.24xlarge, x2iedn.32xlarge, c6a.large, c6a.xlarge, c6a.2xlarge, c6a.4xlarge, c6a.8xlarge, c6a.12xlarge, c6a.16xlarge, c6a.24xlarge, c6a.32xlarge, c6a.48xlarge, c6a.metal, m6a.metal, i4i.large, i4i.xlarge, i4i.2xlarge, i4i.4xlarge, i4i.8xlarge, i4i.16xlarge, i4i.32xlarge, i4i.metal, x2idn.metal, x2iedn.metal, c7g.medium, c7g.large, c7g.xlarge, c7g.2xlarge, c7g.4xlarge, c7g.8xlarge, c7g.12xlarge, c7g.16xlarge, mac2.metal, c6id.large, c6id.xlarge, c6id.2xlarge, c6id.4xlarge, c6id.8xlarge, c6id.12xlarge, c6id.16xlarge, c6id.24xlarge, c6id.32xlarge, c6id.metal, m6id.large, m6id.xlarge, m6id.2xlarge, m6id.4xlarge, m6id.8xlarge, m6id.12xlarge, m6id.16xlarge, m6id.24xlarge, m6id.32xlarge, m6id.metal, r6id.large, r6id.xlarge, r6id.2xlarge, r6id.4xlarge, r6id.8xlarge, r6id.12xlarge, r6id.16xlarge, r6id.24xlarge, r6id.32xlarge, r6id.metal, r6a.large, r6a.xlarge, r6a.2xlarge, r6a.4xlarge, r6a.8xlarge, r6a.12xlarge, r6a.16xlarge, r6a.24xlarge, r6a.32xlarge, r6a.48xlarge, r6a.metal, p4de.24xlarge, u-3tb1.56xlarge, u-18tb1.112xlarge, u-24tb1.112xlarge, trn1.2xlarge, trn1.32xlarge, hpc6id.32xlarge, c6in.large, c6in.xlarge, c6in.2xlarge, c6in.4xlarge, c6in.8xlarge, c6in.12xlarge, c6in.16xlarge, c6in.24xlarge, c6in.32xlarge, m6in.large, m6in.xlarge, m6in.2xlarge, m6in.4xlarge, m6in.8xlarge, m6in.12xlarge, m6in.16xlarge, m6in.24xlarge, m6in.32xlarge, m6idn.large, m6idn.xlarge, m6idn.2xlarge, m6idn.4xlarge, m6idn.8xlarge, m6idn.12xlarge, m6idn.16xlarge, m6idn.24xlarge, m6idn.32xlarge, r6in.large, r6in.xlarge, r6in.2xlarge, r6in.4xlarge, r6in.8xlarge, r6in.12xlarge, r6in.16xlarge, r6in.24xlarge, r6in.32xlarge, r6idn.large, r6idn.xlarge, r6idn.2xlarge, r6idn.4xlarge, r6idn.8xlarge, r6idn.12xlarge, r6idn.16xlarge, r6idn.24xlarge, r6idn.32xlarge, c7g.metal, m7g.medium, m7g.large, m7g.xlarge, m7g.2xlarge, m7g.4xlarge, m7g.8xlarge, m7g.12xlarge, m7g.16xlarge, m7g.metal, r7g.medium, r7g.large, r7g.xlarge, r7g.2xlarge, r7g.4xlarge, r7g.8xlarge, r7g.12xlarge, r7g.16xlarge, r7g.metal, c6in.metal, m6in.metal, m6idn.metal, r6in.metal, r6idn.metal, inf2.xlarge, inf2.8xlarge, inf2.24xlarge, inf2.48xlarge, trn1n.32xlarge, i4g.large, i4g.xlarge, i4g.2xlarge, i4g.4xlarge, i4g.8xlarge, i4g.16xlarge, hpc7g.4xlarge, hpc7g.8xlarge, hpc7g.16xlarge, c7gn.medium, c7gn.large, c7gn.xlarge, c7gn.2xlarge, c7gn.4xlarge, c7gn.8xlarge, c7gn.12xlarge, c7gn.16xlarge, p5.48xlarge, m7i.large, m7i.xlarge, m7i.2xlarge, m7i.4xlarge, m7i.8xlarge, m7i.12xlarge, m7i.16xlarge, m7i.24xlarge, m7i.48xlarge, m7i-flex.large, m7i-flex.xlarge, m7i-flex.2xlarge, m7i-flex.4xlarge, m7i-flex.8xlarge, m7a.medium, m7a.large, m7a.xlarge, m7a.2xlarge, m7a.4xlarge, m7a.8xlarge, m7a.12xlarge, m7a.16xlarge, m7a.24xlarge, m7a.32xlarge, m7a.48xlarge, m7a.metal-48xl, hpc7a.12xlarge, hpc7a.24xlarge, hpc7a.48xlarge, hpc7a.96xlarge, c7gd.medium, c7gd.large, c7gd.xlarge, c7gd.2xlarge, c7gd.4xlarge, c7gd.8xlarge, c7gd.12xlarge, c7gd.16xlarge, m7gd.medium, m7gd.large, m7gd.xlarge, m7gd.2xlarge, m7gd.4xlarge, m7gd.8xlarge, m7gd.12xlarge, m7gd.16xlarge, r7gd.medium, r7gd.large, r7gd.xlarge, r7gd.2xlarge, r7gd.4xlarge, r7gd.8xlarge, r7gd.12xlarge, r7gd.16xlarge, r7a.medium, r7a.large, r7a.xlarge, r7a.2xlarge, r7a.4xlarge, r7a.8xlarge, r7a.12xlarge, r7a.16xlarge, r7a.24xlarge, r7a.32xlarge, r7a.48xlarge, c7i.large, c7i.xlarge, c7i.2xlarge, c7i.4xlarge, c7i.8xlarge, c7i.12xlarge, c7i.16xlarge, c7i.24xlarge, c7i.48xlarge, mac2-m2pro.metal, r7iz.large, r7iz.xlarge, r7iz.2xlarge, r7iz.4xlarge, r7iz.8xlarge, r7iz.12xlarge, r7iz.16xlarge, r7iz.32xlarge, c7a.medium, c7a.large, c7a.xlarge, c7a.2xlarge, c7a.4xlarge, c7a.8xlarge, c7a.12xlarge, c7a.16xlarge, c7a.24xlarge, c7a.32xlarge, c7a.48xlarge, c7a.metal-48xl, r7a.metal-48xl, r7i.large, r7i.xlarge, r7i.2xlarge, r7i.4xlarge, r7i.8xlarge, r7i.12xlarge, r7i.16xlarge, r7i.24xlarge, r7i.48xlarge, dl2q.24xlarge, mac2-m2.metal, i4i.12xlarge, i4i.24xlarge, c7i.metal-24xl, c7i.metal-48xl, m7i.metal-24xl, m7i.metal-48xl, r7i.metal-24xl, r7i.metal-48xl, r7iz.metal-16xl, r7iz.metal-32xl, c7gd.metal, m7gd.metal, r7gd.metal, g6.xlarge, g6.2xlarge, g6.4xlarge, g6.8xlarge, g6.12xlarge, g6.16xlarge, g6.24xlarge, g6.48xlarge, gr6.4xlarge, gr6.8xlarge, c7i-flex.large, c7i-flex.xlarge, c7i-flex.2xlarge, c7i-flex.4xlarge, c7i-flex.8xlarge, u7i-12tb.224xlarge, u7in-16tb.224xlarge, u7in-24tb.224xlarge, u7in-32tb.224xlarge, u7ib-12tb.224xlarge, c7gn.metal, r8g.medium, r8g.large, r8g.xlarge, r8g.2xlarge, r8g.4xlarge, r8g.8xlarge, r8g.12xlarge, r8g.16xlarge, r8g.24xlarge, r8g.48xlarge, r8g.metal-24xl, r8g.metal-48xl, mac2-m1ultra.metal, g6e.xlarge, g6e.2xlarge, g6e.4xlarge, g6e.8xlarge, g6e.12xlarge, g6e.16xlarge, g6e.24xlarge, g6e.48xlarge, c8g.medium, c8g.large, c8g.xlarge, c8g.2xlarge, c8g.4xlarge, c8g.8xlarge, c8g.12xlarge, c8g.16xlarge, c8g.24xlarge, c8g.48xlarge, c8g.metal-24xl, c8g.metal-48xl, m8g.medium, m8g.large, m8g.xlarge, m8g.2xlarge, m8g.4xlarge, m8g.8xlarge, m8g.12xlarge, m8g.16xlarge, m8g.24xlarge, m8g.48xlarge, m8g.metal-24xl, m8g.metal-48xl, x8g.medium, x8g.large, x8g.xlarge, x8g.2xlarge, x8g.4xlarge, x8g.8xlarge, x8g.12xlarge, x8g.16xlarge, x8g.24xlarge, x8g.48xlarge, x8g.metal-24xl, x8g.metal-48xl, i7ie.large, i7ie.xlarge, i7ie.2xlarge, i7ie.3xlarge, i7ie.6xlarge, i7ie.12xlarge, i7ie.18xlarge, i7ie.24xlarge, i7ie.48xlarge, i8g.large, i8g.xlarge, i8g.2xlarge, i8g.4xlarge, i8g.8xlarge, i8g.12xlarge, i8g.16xlarge, i8g.24xlarge, i8g.metal-24xl, u7i-6tb.112xlarge, u7i-8tb.112xlarge, u7inh-32tb.480xlarge, p5e.48xlarge, p5en.48xlarge, f2.12xlarge, f2.48xlarge, trn2.48xlarge, c7i-flex.12xlarge, c7i-flex.16xlarge, m7i-flex.12xlarge, m7i-flex.16xlarge, i7ie.metal-24xl, i7ie.metal-48xl, i8g.48xlarge, c8gd.medium, c8gd.large, c8gd.xlarge, c8gd.2xlarge, c8gd.4xlarge, c8gd.8xlarge, c8gd.12xlarge, c8gd.16xlarge, c8gd.24xlarge, c8gd.48xlarge, c8gd.metal-24xl, c8gd.metal-48xl, i7i.large, i7i.xlarge, i7i.2xlarge, i7i.4xlarge, i7i.8xlarge, i7i.12xlarge, i7i.16xlarge, i7i.24xlarge, i7i.48xlarge, i7i.metal-24xl, i7i.metal-48xl, p6-b200.48xlarge, m8gd.medium, m8gd.large, m8gd.xlarge, m8gd.2xlarge, m8gd.4xlarge, m8gd.8xlarge, m8gd.12xlarge, m8gd.16xlarge, m8gd.24xlarge, m8gd.48xlarge, m8gd.metal-24xl, m8gd.metal-48xl, r8gd.medium, r8gd.large, r8gd.xlarge, r8gd.2xlarge, r8gd.4xlarge, r8gd.8xlarge, r8gd.12xlarge, r8gd.16xlarge, r8gd.24xlarge, r8gd.48xlarge, r8gd.metal-24xl, r8gd.metal-48xl, c8gn.medium, c8gn.large, c8gn.xlarge, c8gn.2xlarge, c8gn.4xlarge, c8gn.8xlarge, c8gn.12xlarge, c8gn.16xlarge, c8gn.24xlarge, c8gn.48xlarge, c8gn.metal-24xl, c8gn.metal-48xl, f2.6xlarge, p6e-gb200.36xlarge, g6f.large, g6f.xlarge, g6f.2xlarge, g6f.4xlarge, gr6f.4xlarge, p5.4xlarge, r8i.large, r8i.xlarge, r8i.2xlarge, r8i.4xlarge, r8i.8xlarge, r8i.12xlarge, r8i.16xlarge, r8i.24xlarge, r8i.32xlarge, r8i.48xlarge, r8i.96xlarge, r8i.metal-48xl, r8i.metal-96xl, r8i-flex.large, r8i-flex.xlarge, r8i-flex.2xlarge, r8i-flex.4xlarge, r8i-flex.8xlarge, r8i-flex.12xlarge, r8i-flex.16xlarge, m8i.large, m8i.xlarge, m8i.2xlarge, m8i.4xlarge, m8i.8xlarge, m8i.12xlarge, m8i.16xlarge, m8i.24xlarge, m8i.32xlarge, m8i.48xlarge, m8i.96xlarge, m8i.metal-48xl, m8i.metal-96xl, m8i-flex.large, m8i-flex.xlarge, m8i-flex.2xlarge, m8i-flex.4xlarge, m8i-flex.8xlarge, m8i-flex.12xlarge, m8i-flex.16xlarge, i8ge.large, i8ge.xlarge, i8ge.2xlarge, i8ge.3xlarge, i8ge.6xlarge, i8ge.12xlarge, i8ge.18xlarge, i8ge.24xlarge, i8ge.48xlarge, i8ge.metal-24xl, i8ge.metal-48xl, mac-m4.metal, mac-m4pro.metal, r8gn.medium, r8gn.large, r8gn.xlarge, r8gn.2xlarge, r8gn.4xlarge, r8gn.8xlarge, r8gn.12xlarge, r8gn.16xlarge, r8gn.24xlarge, r8gn.48xlarge, r8gn.metal-24xl, r8gn.metal-48xl, c8i.large, c8i.xlarge, c8i.2xlarge, c8i.4xlarge, c8i.8xlarge, c8i.12xlarge, c8i.16xlarge, c8i.24xlarge, c8i.32xlarge, c8i.48xlarge, c8i.96xlarge, c8i.metal-48xl, c8i.metal-96xl, c8i-flex.large, c8i-flex.xlarge, c8i-flex.2xlarge, c8i-flex.4xlarge, c8i-flex.8xlarge, c8i-flex.12xlarge, c8i-flex.16xlarge, r8gb.medium, r8gb.large, r8gb.xlarge, r8gb.2xlarge, r8gb.4xlarge, r8gb.8xlarge, r8gb.12xlarge, r8gb.16xlarge, r8gb.24xlarge, r8gb.metal-24xl, m8a.medium, m8a.large, m8a.xlarge, m8a.2xlarge, m8a.4xlarge, m8a.8xlarge, m8a.12xlarge, m8a.16xlarge, m8a.24xlarge, m8a.48xlarge, m8a.metal-24xl, m8a.metal-48xl, trn2.3xlarge, r8a.medium, r8a.large, r8a.xlarge, r8a.2xlarge, r8a.4xlarge, r8a.8xlarge, r8a.12xlarge, r8a.16xlarge, r8a.24xlarge, r8a.48xlarge, r8a.metal-24xl, r8a.metal-48xl
ipv_6_address_count: 1,
ipv_6_addresses: [
{
ipv_6_address: "String",
is_primary_ipv_6: false,
},
],
kernel_id: "KernelId",
key_name: "KeyPairName",
max_count: 1, # required
min_count: 1, # required
monitoring: {
enabled: false, # required
},
placement: {
availability_zone_id: "AvailabilityZoneId",
affinity: "String",
group_name: "PlacementGroupName",
partition_number: 1,
host_id: "String",
tenancy: "default", # accepts default, dedicated, host
spread_domain: "String",
host_resource_group_arn: "String",
group_id: "PlacementGroupId",
availability_zone: "String",
},
ramdisk_id: "RamdiskId",
security_group_ids: ["SecurityGroupId"],
security_groups: ["SecurityGroupName"],
subnet_id: "SubnetId",
user_data: "RunInstancesUserData",
elastic_gpu_specification: [
{
type: "String", # required
},
],
elastic_inference_accelerators: [
{
type: "String", # required
count: 1,
},
],
tag_specifications: [
{
resource_type: "capacity-reservation", # accepts capacity-reservation, client-vpn-endpoint, customer-gateway, carrier-gateway, coip-pool, declarative-policies-report, dedicated-host, dhcp-options, egress-only-internet-gateway, elastic-ip, elastic-gpu, export-image-task, export-instance-task, fleet, fpga-image, host-reservation, image, image-usage-report, import-image-task, import-snapshot-task, instance, instance-event-window, internet-gateway, ipam, ipam-pool, ipam-scope, ipv4pool-ec2, ipv6pool-ec2, key-pair, launch-template, local-gateway, local-gateway-route-table, local-gateway-virtual-interface, local-gateway-virtual-interface-group, local-gateway-route-table-vpc-association, local-gateway-route-table-virtual-interface-group-association, natgateway, network-acl, network-interface, network-insights-analysis, network-insights-path, network-insights-access-scope, network-insights-access-scope-analysis, outpost-lag, placement-group, prefix-list, replace-root-volume-task, reserved-instances, route-table, security-group, security-group-rule, service-link-virtual-interface, snapshot, spot-fleet-request, spot-instances-request, subnet, subnet-cidr-reservation, traffic-mirror-filter, traffic-mirror-session, traffic-mirror-target, transit-gateway, transit-gateway-attachment, transit-gateway-connect-peer, transit-gateway-multicast-domain, transit-gateway-policy-table, transit-gateway-metering-policy, transit-gateway-route-table, transit-gateway-route-table-announcement, volume, vpc, vpc-endpoint, vpc-endpoint-connection, vpc-endpoint-service, vpc-endpoint-service-permission, vpc-peering-connection, vpn-connection, vpn-gateway, vpc-flow-log, capacity-reservation-fleet, traffic-mirror-filter-rule, vpc-endpoint-connection-device-type, verified-access-instance, verified-access-group, verified-access-endpoint, verified-access-policy, verified-access-trust-provider, vpn-connection-device-type, vpc-block-public-access-exclusion, vpc-encryption-control, route-server, route-server-endpoint, route-server-peer, ipam-resource-discovery, ipam-resource-discovery-association, instance-connect-endpoint, verified-access-endpoint-target, ipam-external-resource-verification-token, capacity-block, mac-modification-task, ipam-prefix-list-resolver, ipam-policy, ipam-prefix-list-resolver-target, capacity-manager-data-export, vpn-concentrator
tags: [
{
key: "String",
value: "String",
},
],
},
],
launch_template: {
launch_template_id: "LaunchTemplateId",
launch_template_name: "String",
version: "String",
},
instance_market_options: {
market_type: "spot", # accepts spot, capacity-block, interruptible-capacity-reservation
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
},
cpu_options: {
core_count: 1,
threads_per_core: 1,
amd_sev_snp: "enabled", # accepts enabled, disabled
},
capacity_reservation_specification: {
capacity_reservation_preference: "capacity-reservations-only", # accepts capacity-reservations-only, open, none
capacity_reservation_target: {
capacity_reservation_id: "CapacityReservationId",
capacity_reservation_resource_group_arn: "String",
},
},
hibernation_options: {
configured: false,
},
license_specifications: [
{
license_configuration_arn: "String",
},
],
metadata_options: {
http_tokens: "optional", # accepts optional, required
http_put_response_hop_limit: 1,
http_endpoint: "disabled", # accepts disabled, enabled
http_protocol_ipv_6: "disabled", # accepts disabled, enabled
instance_metadata_tags: "disabled", # accepts disabled, enabled
},
enclave_options: {
enabled: false,
},
private_dns_name_options: {
hostname_type: "ip-name", # accepts ip-name, resource-name
enable_resource_name_dns_a_record: false,
enable_resource_name_dns_aaaa_record: false,
},
maintenance_options: {
auto_recovery: "disabled", # accepts disabled, default
},
disable_api_stop: false,
enable_primary_ipv_6: false,
network_performance_options: {
bandwidth_weighting: "default", # accepts default, vpc-1, ebs-1
},
operator: {
principal: "String",
},
dry_run: false,
disable_api_termination: false,
instance_initiated_shutdown_behavior: "stop", # accepts stop, terminate
private_ip_address: "String",
client_token: "String",
additional_info: "String",
network_interfaces: [
{
associate_public_ip_address: false,
delete_on_termination: false,
description: "String",
device_index: 1,
groups: ["SecurityGroupId"],
ipv_6_address_count: 1,
ipv_6_addresses: [
{
ipv_6_address: "String",
is_primary_ipv_6: false,
},
],
network_interface_id: "NetworkInterfaceId",
private_ip_address: "String",
private_ip_addresses: [
{
primary: false,
private_ip_address: "String",
},
],
secondary_private_ip_address_count: 1,
subnet_id: "String",
associate_carrier_ip_address: false,
interface_type: "String",
network_card_index: 1,
ipv_4_prefixes: [
{
ipv_4_prefix: "String",
},
],
ipv_4_prefix_count: 1,
ipv_6_prefixes: [
{
ipv_6_prefix: "String",
},
],
ipv_6_prefix_count: 1,
primary_ipv_6: false,
ena_srd_specification: {
ena_srd_enabled: false,
ena_srd_udp_specification: {
ena_srd_udp_enabled: false,
},
},
connection_tracking_specification: {
tcp_established_timeout: 1,
udp_stream_timeout: 1,
udp_timeout: 1,
},
ena_queue_count: 1,
},
],
iam_instance_profile: {
arn: "String",
name: "String",
},
ebs_optimized: false,
})
Parameters:
-
options
(Hash)
(defaults to: {})
—
({})
Options Hash (options):
-
:block_device_mappings
(Array<Types::BlockDeviceMapping>)
—
The block device mapping, which defines the EBS volumes and instance store volumes to attach to the instance at launch. For more information, see Block device mappings in the Amazon EC2 User Guide.
-
:image_id
(String)
—
The ID of the AMI. An AMI ID is required to launch an instance and must be specified here or in a launch template.
-
:instance_type
(String)
—
The instance type. For more information, see Amazon EC2 Instance Types Guide.
-
:ipv_6_address_count
(Integer)
—
The number of IPv6 addresses to associate with the primary network interface. Amazon EC2 chooses the IPv6 addresses from the range of your subnet. You cannot specify this option and the option to assign specific IPv6 addresses in the same request. You can specify this option if you've specified a minimum number of instances to launch.
You cannot specify this option and the network interfaces option in the same request.
-
:ipv_6_addresses
(Array<Types::InstanceIpv6Address>)
—
The IPv6 addresses from the range of the subnet to associate with the primary network interface. You cannot specify this option and the option to assign a number of IPv6 addresses in the same request. You cannot specify this option if you've specified a minimum number of instances to launch.
You cannot specify this option and the network interfaces option in the same request.
-
:kernel_id
(String)
—
The ID of the kernel.
We recommend that you use PV-GRUB instead of kernels and RAM disks. For more information, see PV-GRUB in the Amazon EC2 User Guide.
-
:key_name
(String)
—
The name of the key pair. For more information, see Create a key pair for your EC2 instance.
If you do not specify a key pair, you can't connect to the instance unless you choose an AMI that is configured to allow users another way to log in.
-
:max_count
(required, Integer)
—
The maximum number of instances to launch. If you specify a value that is more capacity than Amazon EC2 can launch in the target Availability Zone, Amazon EC2 launches the largest possible number of instances above the specified minimum count.
Constraints: Between 1 and the quota for the specified instance type for your account for this Region. For more information, see Amazon EC2 instance type quotas.
-
:min_count
(required, Integer)
—
The minimum number of instances to launch. If you specify a value that is more capacity than Amazon EC2 can provide in the target Availability Zone, Amazon EC2 does not launch any instances.
Constraints: Between 1 and the quota for the specified instance type for your account for this Region. For more information, see Amazon EC2 instance type quotas.
-
:monitoring
(Types::RunInstancesMonitoringEnabled)
—
Specifies whether detailed monitoring is enabled for the instance.
-
:placement
(Types::Placement)
—
The placement for the instance.
-
:ramdisk_id
(String)
—
The ID of the RAM disk to select. Some kernels require additional drivers at launch. Check the kernel requirements for information about whether you need to specify a RAM disk. To find kernel requirements, go to the Amazon Web Services Resource Center and search for the kernel ID.
We recommend that you use PV-GRUB instead of kernels and RAM disks. For more information, see PV-GRUB in the Amazon EC2 User Guide.
-
:security_group_ids
(Array<String>)
—
The IDs of the security groups.
If you specify a network interface, you must specify any security groups as part of the network interface instead of using this parameter.
-
:security_groups
(Array<String>)
—
[Default VPC] The names of the security groups.
If you specify a network interface, you must specify any security groups as part of the network interface instead of using this parameter.
Default: Amazon EC2 uses the default security group.
-
:subnet_id
(String)
—
The ID of the subnet to launch the instance into.
If you specify a network interface, you must specify any subnets as part of the network interface instead of using this parameter.
-
:user_data
(String)
—
The user data to make available to the instance. User data must be base64-encoded. Depending on the tool or SDK that you're using, the base64-encoding might be performed for you. For more information, see Run commands at launch using instance user data.
-
:elastic_gpu_specification
(Array<Types::ElasticGpuSpecification>)
—
An elastic GPU to associate with the instance.
Amazon Elastic Graphics reached end of life on January 8, 2024. -
:elastic_inference_accelerators
(Array<Types::ElasticInferenceAccelerator>)
—
An elastic inference accelerator to associate with the instance.
Amazon Elastic Inference is no longer available. -
:tag_specifications
(Array<Types::TagSpecification>)
—
The tags to apply to the resources that are created during instance launch.
You can specify tags for the following resources only:
Instances
Volumes
Spot Instance requests
Network interfaces
To tag a resource after it has been created, see CreateTags.
-
:launch_template
(Types::LaunchTemplateSpecification)
—
The launch template. Any additional parameters that you specify for the new instance overwrite the corresponding parameters included in the launch template.
-
:instance_market_options
(Types::InstanceMarketOptionsRequest)
—
The market (purchasing) option for the instances.
For RunInstances, persistent Spot Instance requests are only supported when InstanceInterruptionBehavior is set to either
hibernateorstop. -
:credit_specification
(Types::CreditSpecificationRequest)
—
The credit option for CPU usage of the burstable performance instance. Valid values are
standardandunlimited. To change this attribute after launch, use ModifyInstanceCreditSpecification. For more information, see Burstable performance instances in the Amazon EC2 User Guide.Default:
standard(T2 instances) orunlimited(T3/T3a/T4g instances)For T3 instances with
hosttenancy, onlystandardis supported. -
:cpu_options
(Types::CpuOptionsRequest)
—
The CPU options for the instance. For more information, see Optimize CPU options in the Amazon EC2 User Guide.
-
:capacity_reservation_specification
(Types::CapacityReservationSpecification)
—
Information about the Capacity Reservation targeting option. If you do not specify this parameter, the instance's Capacity Reservation preference defaults to
open, which enables it to run in any open Capacity Reservation that has matching attributes (instance type, platform, Availability Zone, and tenancy). -
:hibernation_options
(Types::HibernationOptionsRequest)
—
Indicates whether an instance is enabled for hibernation. This parameter is valid only if the instance meets the hibernation prerequisites. For more information, see Hibernate your Amazon EC2 instance in the Amazon EC2 User Guide.
You can't enable hibernation and Amazon Web Services Nitro Enclaves on the same instance.
-
:license_specifications
(Array<Types::LicenseConfigurationRequest>)
—
The license configurations.
-
:metadata_options
(Types::InstanceMetadataOptionsRequest)
—
The metadata options for the instance. For more information, see Configure the Instance Metadata Service options.
-
:enclave_options
(Types::EnclaveOptionsRequest)
—
Indicates whether the instance is enabled for Amazon Web Services Nitro Enclaves. For more information, see Amazon Web Services Nitro Enclaves User Guide.
You can't enable Amazon Web Services Nitro Enclaves and hibernation on the same instance.
-
:private_dns_name_options
(Types::PrivateDnsNameOptionsRequest)
—
The options for the instance hostname. The default values are inherited from the subnet. Applies only if creating a network interface, not attaching an existing one.
-
:maintenance_options
(Types::InstanceMaintenanceOptionsRequest)
—
The maintenance and recovery options for the instance.
-
:disable_api_stop
(Boolean)
—
Indicates whether an instance is enabled for stop protection. For more information, see Enable stop protection for your EC2 instances.
-
:enable_primary_ipv_6
(Boolean)
—
If you’re launching an instance into a dual-stack or IPv6-only subnet, you can enable assigning a primary IPv6 address. A primary IPv6 address is an IPv6 GUA address associated with an ENI that you have enabled to use a primary IPv6 address. Use this option if an instance relies on its IPv6 address not changing. When you launch the instance, Amazon Web Services will automatically assign an IPv6 address associated with the ENI attached to your instance to be the primary IPv6 address. Once you enable an IPv6 GUA address to be a primary IPv6, you cannot disable it. When you enable an IPv6 GUA address to be a primary IPv6, the first IPv6 GUA will be made the primary IPv6 address until the instance is terminated or the network interface is detached. If you have multiple IPv6 addresses associated with an ENI attached to your instance and you enable a primary IPv6 address, the first IPv6 GUA address associated with the ENI becomes the primary IPv6 address.
-
:network_performance_options
(Types::InstanceNetworkPerformanceOptionsRequest)
—
Contains settings for the network performance options for the instance.
-
:operator
(Types::OperatorRequest)
—
Reserved for internal use.
-
:dry_run
(Boolean)
—
Checks whether you have the required permissions for the operation, without actually making the request, and provides an error response. If you have the required permissions, the error response is
DryRunOperation. Otherwise, it isUnauthorizedOperation. -
:disable_api_termination
(Boolean)
—
Indicates whether termination protection is enabled for the instance. The default is
false, which means that you can terminate the instance using the Amazon EC2 console, command line tools, or API. You can enable termination protection when you launch an instance, while the instance is running, or while the instance is stopped. -
:instance_initiated_shutdown_behavior
(String)
—
Indicates whether an instance stops or terminates when you initiate shutdown from the instance (using the operating system command for system shutdown).
Default:
stop -
:private_ip_address
(String)
—
The primary IPv4 address. You must specify a value from the IPv4 address range of the subnet.
Only one private IP address can be designated as primary. You can't specify this option if you've specified the option to designate a private IP address as the primary IP address in a network interface specification. You cannot specify this option if you're launching more than one instance in the request.
You cannot specify this option and the network interfaces option in the same request.
-
:client_token
(String)
—
Unique, case-sensitive identifier you provide to ensure the idempotency of the request. If you do not specify a client token, a randomly generated token is used for the request to ensure idempotency.
For more information, see Ensuring idempotency in Amazon EC2 API requests.
Constraints: Maximum 64 ASCII characters
-
:additional_info
(String)
—
Reserved.
-
:network_interfaces
(Array<Types::InstanceNetworkInterfaceSpecification>)
—
The network interfaces to associate with the instance.
-
:iam_instance_profile
(Types::IamInstanceProfileSpecification)
—
The name or Amazon Resource Name (ARN) of an IAM instance profile.
-
:ebs_optimized
(Boolean)
—
Indicates whether the instance is optimized for Amazon EBS I/O. This optimization provides dedicated throughput to Amazon EBS and an optimized configuration stack to provide optimal Amazon EBS I/O performance. This optimization isn't available with all instance types. Additional usage charges apply when using an EBS-optimized instance.
Default:
false
Returns:
615 616 617 618 619 620 621 622 623 624 625 626 627 628 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 615 def create_instances(options = {}) batch = [] resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.run_instances(options) end resp.data.instances.each do |i| batch << Instance.new( id: i.instance_id, data: i, client: @client ) end Instance::Collection.new([batch], size: batch.size) end |
#create_internet_gateway(options = {}) ⇒ InternetGateway
Examples:
Request syntax with placeholder values
Request syntax with placeholder values
internetgateway = ec2.create_internet_gateway({
tag_specifications: [
{
resource_type: "capacity-reservation", # accepts capacity-reservation, client-vpn-endpoint, customer-gateway, carrier-gateway, coip-pool, declarative-policies-report, dedicated-host, dhcp-options, egress-only-internet-gateway, elastic-ip, elastic-gpu, export-image-task, export-instance-task, fleet, fpga-image, host-reservation, image, image-usage-report, import-image-task, import-snapshot-task, instance, instance-event-window, internet-gateway, ipam, ipam-pool, ipam-scope, ipv4pool-ec2, ipv6pool-ec2, key-pair, launch-template, local-gateway, local-gateway-route-table, local-gateway-virtual-interface, local-gateway-virtual-interface-group, local-gateway-route-table-vpc-association, local-gateway-route-table-virtual-interface-group-association, natgateway, network-acl, network-interface, network-insights-analysis, network-insights-path, network-insights-access-scope, network-insights-access-scope-analysis, outpost-lag, placement-group, prefix-list, replace-root-volume-task, reserved-instances, route-table, security-group, security-group-rule, service-link-virtual-interface, snapshot, spot-fleet-request, spot-instances-request, subnet, subnet-cidr-reservation, traffic-mirror-filter, traffic-mirror-session, traffic-mirror-target, transit-gateway, transit-gateway-attachment, transit-gateway-connect-peer, transit-gateway-multicast-domain, transit-gateway-policy-table, transit-gateway-metering-policy, transit-gateway-route-table, transit-gateway-route-table-announcement, volume, vpc, vpc-endpoint, vpc-endpoint-connection, vpc-endpoint-service, vpc-endpoint-service-permission, vpc-peering-connection, vpn-connection, vpn-gateway, vpc-flow-log, capacity-reservation-fleet, traffic-mirror-filter-rule, vpc-endpoint-connection-device-type, verified-access-instance, verified-access-group, verified-access-endpoint, verified-access-policy, verified-access-trust-provider, vpn-connection-device-type, vpc-block-public-access-exclusion, vpc-encryption-control, route-server, route-server-endpoint, route-server-peer, ipam-resource-discovery, ipam-resource-discovery-association, instance-connect-endpoint, verified-access-endpoint-target, ipam-external-resource-verification-token, capacity-block, mac-modification-task, ipam-prefix-list-resolver, ipam-policy, ipam-prefix-list-resolver-target, capacity-manager-data-export, vpn-concentrator
tags: [
{
key: "String",
value: "String",
},
],
},
],
dry_run: false,
})
Parameters:
-
options
(Hash)
(defaults to: {})
—
({})
Options Hash (options):
-
:tag_specifications
(Array<Types::TagSpecification>)
—
The tags to assign to the internet 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 isUnauthorizedOperation.
Returns:
655 656 657 658 659 660 661 662 663 664 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 655 def create_internet_gateway(options = {}) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.create_internet_gateway(options) end InternetGateway.new( id: resp.data.internet_gateway.internet_gateway_id, data: resp.data.internet_gateway, client: @client ) end |
#create_key_pair(options = {}) ⇒ KeyPair
Examples:
Request syntax with placeholder values
Request syntax with placeholder values
keypair = ec2.create_key_pair({
key_name: "String", # required
key_type: "rsa", # accepts rsa, ed25519
tag_specifications: [
{
resource_type: "capacity-reservation", # accepts capacity-reservation, client-vpn-endpoint, customer-gateway, carrier-gateway, coip-pool, declarative-policies-report, dedicated-host, dhcp-options, egress-only-internet-gateway, elastic-ip, elastic-gpu, export-image-task, export-instance-task, fleet, fpga-image, host-reservation, image, image-usage-report, import-image-task, import-snapshot-task, instance, instance-event-window, internet-gateway, ipam, ipam-pool, ipam-scope, ipv4pool-ec2, ipv6pool-ec2, key-pair, launch-template, local-gateway, local-gateway-route-table, local-gateway-virtual-interface, local-gateway-virtual-interface-group, local-gateway-route-table-vpc-association, local-gateway-route-table-virtual-interface-group-association, natgateway, network-acl, network-interface, network-insights-analysis, network-insights-path, network-insights-access-scope, network-insights-access-scope-analysis, outpost-lag, placement-group, prefix-list, replace-root-volume-task, reserved-instances, route-table, security-group, security-group-rule, service-link-virtual-interface, snapshot, spot-fleet-request, spot-instances-request, subnet, subnet-cidr-reservation, traffic-mirror-filter, traffic-mirror-session, traffic-mirror-target, transit-gateway, transit-gateway-attachment, transit-gateway-connect-peer, transit-gateway-multicast-domain, transit-gateway-policy-table, transit-gateway-metering-policy, transit-gateway-route-table, transit-gateway-route-table-announcement, volume, vpc, vpc-endpoint, vpc-endpoint-connection, vpc-endpoint-service, vpc-endpoint-service-permission, vpc-peering-connection, vpn-connection, vpn-gateway, vpc-flow-log, capacity-reservation-fleet, traffic-mirror-filter-rule, vpc-endpoint-connection-device-type, verified-access-instance, verified-access-group, verified-access-endpoint, verified-access-policy, verified-access-trust-provider, vpn-connection-device-type, vpc-block-public-access-exclusion, vpc-encryption-control, route-server, route-server-endpoint, route-server-peer, ipam-resource-discovery, ipam-resource-discovery-association, instance-connect-endpoint, verified-access-endpoint-target, ipam-external-resource-verification-token, capacity-block, mac-modification-task, ipam-prefix-list-resolver, ipam-policy, ipam-prefix-list-resolver-target, capacity-manager-data-export, vpn-concentrator
tags: [
{
key: "String",
value: "String",
},
],
},
],
key_format: "pem", # accepts pem, ppk
dry_run: false,
})
Parameters:
-
options
(Hash)
(defaults to: {})
—
({})
Options Hash (options):
-
:key_name
(required, String)
—
A unique name for the key pair.
Constraints: Up to 255 ASCII characters
-
:key_type
(String)
—
The type of key pair. Note that ED25519 keys are not supported for Windows instances.
Default:
rsa -
:tag_specifications
(Array<Types::TagSpecification>)
—
The tags to apply to the new key pair.
-
:key_format
(String)
—
The format of the key pair.
Default:
pem -
: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 isUnauthorizedOperation.
Returns:
- (KeyPair)
707 708 709 710 711 712 713 714 715 716 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 707 def create_key_pair(options = {}) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.create_key_pair(options) end KeyPair.new( name: resp.data.key_name, data: resp.data, client: @client ) end |
#create_nat_gateway(options = {}) ⇒ NatGateway
Examples:
Request syntax with placeholder values
Request syntax with placeholder values
natgateway = ec2.create_nat_gateway({
availability_mode: "zonal", # accepts zonal, regional
allocation_id: "AllocationId",
client_token: "String",
dry_run: false,
subnet_id: "SubnetId",
vpc_id: "VpcId",
availability_zone_addresses: [
{
availability_zone: "AvailabilityZoneName",
availability_zone_id: "AvailabilityZoneId",
allocation_ids: ["AllocationId"],
},
],
tag_specifications: [
{
resource_type: "capacity-reservation", # accepts capacity-reservation, client-vpn-endpoint, customer-gateway, carrier-gateway, coip-pool, declarative-policies-report, dedicated-host, dhcp-options, egress-only-internet-gateway, elastic-ip, elastic-gpu, export-image-task, export-instance-task, fleet, fpga-image, host-reservation, image, image-usage-report, import-image-task, import-snapshot-task, instance, instance-event-window, internet-gateway, ipam, ipam-pool, ipam-scope, ipv4pool-ec2, ipv6pool-ec2, key-pair, launch-template, local-gateway, local-gateway-route-table, local-gateway-virtual-interface, local-gateway-virtual-interface-group, local-gateway-route-table-vpc-association, local-gateway-route-table-virtual-interface-group-association, natgateway, network-acl, network-interface, network-insights-analysis, network-insights-path, network-insights-access-scope, network-insights-access-scope-analysis, outpost-lag, placement-group, prefix-list, replace-root-volume-task, reserved-instances, route-table, security-group, security-group-rule, service-link-virtual-interface, snapshot, spot-fleet-request, spot-instances-request, subnet, subnet-cidr-reservation, traffic-mirror-filter, traffic-mirror-session, traffic-mirror-target, transit-gateway, transit-gateway-attachment, transit-gateway-connect-peer, transit-gateway-multicast-domain, transit-gateway-policy-table, transit-gateway-metering-policy, transit-gateway-route-table, transit-gateway-route-table-announcement, volume, vpc, vpc-endpoint, vpc-endpoint-connection, vpc-endpoint-service, vpc-endpoint-service-permission, vpc-peering-connection, vpn-connection, vpn-gateway, vpc-flow-log, capacity-reservation-fleet, traffic-mirror-filter-rule, vpc-endpoint-connection-device-type, verified-access-instance, verified-access-group, verified-access-endpoint, verified-access-policy, verified-access-trust-provider, vpn-connection-device-type, vpc-block-public-access-exclusion, vpc-encryption-control, route-server, route-server-endpoint, route-server-peer, ipam-resource-discovery, ipam-resource-discovery-association, instance-connect-endpoint, verified-access-endpoint-target, ipam-external-resource-verification-token, capacity-block, mac-modification-task, ipam-prefix-list-resolver, ipam-policy, ipam-prefix-list-resolver-target, capacity-manager-data-export, vpn-concentrator
tags: [
{
key: "String",
value: "String",
},
],
},
],
connectivity_type: "private", # accepts private, public
private_ip_address: "String",
secondary_allocation_ids: ["AllocationId"],
secondary_private_ip_addresses: ["String"],
secondary_private_ip_address_count: 1,
})
Parameters:
-
options
(Hash)
(defaults to: {})
—
({})
Options Hash (options):
-
:availability_mode
(String)
—
Specifies whether to create a zonal (single-AZ) or regional (multi-AZ) NAT gateway. Defaults to
zonal.A zonal NAT gateway is a NAT Gateway that provides redundancy and scalability within a single availability zone. A regional NAT gateway is a single NAT Gateway that works across multiple availability zones (AZs) in your VPC, providing redundancy, scalability and availability across all the AZs in a Region.
For more information, see Regional NAT gateways for automatic multi-AZ expansion in the Amazon VPC User Guide.
-
:allocation_id
(String)
—
[Public NAT gateways only] The allocation ID of an Elastic IP address to associate with the NAT gateway. You cannot specify an Elastic IP address with a private NAT gateway. If the Elastic IP address is associated with another resource, you must first disassociate it.
-
:client_token
(String)
—
Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see Ensuring idempotency.
Constraint: Maximum 64 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 isUnauthorizedOperation. -
:subnet_id
(String)
—
The ID of the subnet in which to create the NAT gateway.
-
:vpc_id
(String)
—
The ID of the VPC where you want to create a regional NAT gateway.
-
:availability_zone_addresses
(Array<Types::AvailabilityZoneAddress>)
—
For regional NAT gateways only: Specifies which Availability Zones you want the NAT gateway to support and the Elastic IP addresses (EIPs) to use in each AZ. The regional NAT gateway uses these EIPs to handle outbound NAT traffic from their respective AZs. If not specified, the NAT gateway will automatically expand to new AZs and associate EIPs upon detection of an elastic network interface. If you specify this parameter, auto-expansion is disabled and you must manually manage AZ coverage.
A regional NAT gateway is a single NAT Gateway that works across multiple availability zones (AZs) in your VPC, providing redundancy, scalability and availability across all the AZs in a Region.
For more information, see Regional NAT gateways for automatic multi-AZ expansion in the Amazon VPC User Guide.
-
:tag_specifications
(Array<Types::TagSpecification>)
—
The tags to assign to the NAT gateway.
-
:connectivity_type
(String)
—
Indicates whether the NAT gateway supports public or private connectivity. The default is public connectivity.
-
:private_ip_address
(String)
—
The private IPv4 address to assign to the NAT gateway. If you don't provide an address, a private IPv4 address will be automatically assigned.
-
:secondary_allocation_ids
(Array<String>)
—
Secondary EIP allocation IDs. For more information, see Create a NAT gateway in the Amazon VPC User Guide.
-
:secondary_private_ip_addresses
(Array<String>)
—
Secondary private IPv4 addresses. For more information about secondary addresses, see Create a NAT gateway in the Amazon VPC User Guide.
-
:secondary_private_ip_address_count
(Integer)
—
[Private NAT gateway only] The number of secondary private IPv4 addresses you want to assign to the NAT gateway. For more information about secondary addresses, see Create a NAT gateway in the Amazon VPC User Guide.
Returns:
847 848 849 850 851 852 853 854 855 856 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 847 def create_nat_gateway(options = {}) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.create_nat_gateway(options) end NatGateway.new( id: resp.data.nat_gateway.nat_gateway_id, data: resp.data.nat_gateway, client: @client ) end |
#create_network_acl(options = {}) ⇒ NetworkAcl
Examples:
Request syntax with placeholder values
Request syntax with placeholder values
networkacl = ec2.create_network_acl({
tag_specifications: [
{
resource_type: "capacity-reservation", # accepts capacity-reservation, client-vpn-endpoint, customer-gateway, carrier-gateway, coip-pool, declarative-policies-report, dedicated-host, dhcp-options, egress-only-internet-gateway, elastic-ip, elastic-gpu, export-image-task, export-instance-task, fleet, fpga-image, host-reservation, image, image-usage-report, import-image-task, import-snapshot-task, instance, instance-event-window, internet-gateway, ipam, ipam-pool, ipam-scope, ipv4pool-ec2, ipv6pool-ec2, key-pair, launch-template, local-gateway, local-gateway-route-table, local-gateway-virtual-interface, local-gateway-virtual-interface-group, local-gateway-route-table-vpc-association, local-gateway-route-table-virtual-interface-group-association, natgateway, network-acl, network-interface, network-insights-analysis, network-insights-path, network-insights-access-scope, network-insights-access-scope-analysis, outpost-lag, placement-group, prefix-list, replace-root-volume-task, reserved-instances, route-table, security-group, security-group-rule, service-link-virtual-interface, snapshot, spot-fleet-request, spot-instances-request, subnet, subnet-cidr-reservation, traffic-mirror-filter, traffic-mirror-session, traffic-mirror-target, transit-gateway, transit-gateway-attachment, transit-gateway-connect-peer, transit-gateway-multicast-domain, transit-gateway-policy-table, transit-gateway-metering-policy, transit-gateway-route-table, transit-gateway-route-table-announcement, volume, vpc, vpc-endpoint, vpc-endpoint-connection, vpc-endpoint-service, vpc-endpoint-service-permission, vpc-peering-connection, vpn-connection, vpn-gateway, vpc-flow-log, capacity-reservation-fleet, traffic-mirror-filter-rule, vpc-endpoint-connection-device-type, verified-access-instance, verified-access-group, verified-access-endpoint, verified-access-policy, verified-access-trust-provider, vpn-connection-device-type, vpc-block-public-access-exclusion, vpc-encryption-control, route-server, route-server-endpoint, route-server-peer, ipam-resource-discovery, ipam-resource-discovery-association, instance-connect-endpoint, verified-access-endpoint-target, ipam-external-resource-verification-token, capacity-block, mac-modification-task, ipam-prefix-list-resolver, ipam-policy, ipam-prefix-list-resolver-target, capacity-manager-data-export, vpn-concentrator
tags: [
{
key: "String",
value: "String",
},
],
},
],
client_token: "String",
dry_run: false,
vpc_id: "VpcId", # required
})
Parameters:
-
options
(Hash)
(defaults to: {})
—
({})
Options Hash (options):
-
:tag_specifications
(Array<Types::TagSpecification>)
—
The tags to assign to the network ACL.
-
:client_token
(String)
—
Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see Ensuring 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 isUnauthorizedOperation. -
:vpc_id
(required, String)
—
The ID of the VPC.
Returns:
895 896 897 898 899 900 901 902 903 904 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 895 def create_network_acl(options = {}) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.create_network_acl(options) end NetworkAcl.new( id: resp.data.network_acl.network_acl_id, data: resp.data.network_acl, client: @client ) end |
#create_network_interface(options = {}) ⇒ NetworkInterface
Examples:
Request syntax with placeholder values
Request syntax with placeholder values
networkinterface = ec2.create_network_interface({
ipv_4_prefixes: [
{
ipv_4_prefix: "String",
},
],
ipv_4_prefix_count: 1,
ipv_6_prefixes: [
{
ipv_6_prefix: "String",
},
],
ipv_6_prefix_count: 1,
interface_type: "efa", # accepts efa, efa-only, branch, trunk
tag_specifications: [
{
resource_type: "capacity-reservation", # accepts capacity-reservation, client-vpn-endpoint, customer-gateway, carrier-gateway, coip-pool, declarative-policies-report, dedicated-host, dhcp-options, egress-only-internet-gateway, elastic-ip, elastic-gpu, export-image-task, export-instance-task, fleet, fpga-image, host-reservation, image, image-usage-report, import-image-task, import-snapshot-task, instance, instance-event-window, internet-gateway, ipam, ipam-pool, ipam-scope, ipv4pool-ec2, ipv6pool-ec2, key-pair, launch-template, local-gateway, local-gateway-route-table, local-gateway-virtual-interface, local-gateway-virtual-interface-group, local-gateway-route-table-vpc-association, local-gateway-route-table-virtual-interface-group-association, natgateway, network-acl, network-interface, network-insights-analysis, network-insights-path, network-insights-access-scope, network-insights-access-scope-analysis, outpost-lag, placement-group, prefix-list, replace-root-volume-task, reserved-instances, route-table, security-group, security-group-rule, service-link-virtual-interface, snapshot, spot-fleet-request, spot-instances-request, subnet, subnet-cidr-reservation, traffic-mirror-filter, traffic-mirror-session, traffic-mirror-target, transit-gateway, transit-gateway-attachment, transit-gateway-connect-peer, transit-gateway-multicast-domain, transit-gateway-policy-table, transit-gateway-metering-policy, transit-gateway-route-table, transit-gateway-route-table-announcement, volume, vpc, vpc-endpoint, vpc-endpoint-connection, vpc-endpoint-service, vpc-endpoint-service-permission, vpc-peering-connection, vpn-connection, vpn-gateway, vpc-flow-log, capacity-reservation-fleet, traffic-mirror-filter-rule, vpc-endpoint-connection-device-type, verified-access-instance, verified-access-group, verified-access-endpoint, verified-access-policy, verified-access-trust-provider, vpn-connection-device-type, vpc-block-public-access-exclusion, vpc-encryption-control, route-server, route-server-endpoint, route-server-peer, ipam-resource-discovery, ipam-resource-discovery-association, instance-connect-endpoint, verified-access-endpoint-target, ipam-external-resource-verification-token, capacity-block, mac-modification-task, ipam-prefix-list-resolver, ipam-policy, ipam-prefix-list-resolver-target, capacity-manager-data-export, vpn-concentrator
tags: [
{
key: "String",
value: "String",
},
],
},
],
client_token: "String",
enable_primary_ipv_6: false,
connection_tracking_specification: {
tcp_established_timeout: 1,
udp_stream_timeout: 1,
udp_timeout: 1,
},
operator: {
principal: "String",
},
subnet_id: "SubnetId", # required
description: "String",
private_ip_address: "String",
groups: ["SecurityGroupId"],
private_ip_addresses: [
{
primary: false,
private_ip_address: "String",
},
],
secondary_private_ip_address_count: 1,
ipv_6_addresses: [
{
ipv_6_address: "String",
is_primary_ipv_6: false,
},
],
ipv_6_address_count: 1,
dry_run: false,
})
Parameters:
-
options
(Hash)
(defaults to: {})
—
({})
Options Hash (options):
-
:ipv_4_prefixes
(Array<Types::Ipv4PrefixSpecificationRequest>)
—
The IPv4 prefixes assigned to the network interface.
You can't specify IPv4 prefixes if you've specified one of the following: a count of IPv4 prefixes, specific private IPv4 addresses, or a count of private IPv4 addresses.
-
:ipv_4_prefix_count
(Integer)
—
The number of IPv4 prefixes that Amazon Web Services automatically assigns to the network interface.
You can't specify a count of IPv4 prefixes if you've specified one of the following: specific IPv4 prefixes, specific private IPv4 addresses, or a count of private IPv4 addresses.
-
:ipv_6_prefixes
(Array<Types::Ipv6PrefixSpecificationRequest>)
—
The IPv6 prefixes assigned to the network interface.
You can't specify IPv6 prefixes if you've specified one of the following: a count of IPv6 prefixes, specific IPv6 addresses, or a count of IPv6 addresses.
-
:ipv_6_prefix_count
(Integer)
—
The number of IPv6 prefixes that Amazon Web Services automatically assigns to the network interface.
You can't specify a count of IPv6 prefixes if you've specified one of the following: specific IPv6 prefixes, specific IPv6 addresses, or a count of IPv6 addresses.
-
:interface_type
(String)
—
The type of network interface. The default is
interface.If you specify
efa-only, do not assign any IP addresses to the network interface. EFA-only network interfaces do not support IP addresses.The only supported values are
interface,efa,efa-only, andtrunk. -
:tag_specifications
(Array<Types::TagSpecification>)
—
The tags to apply to the new network interface.
-
:client_token
(String)
—
Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see Ensuring idempotency.
-
:enable_primary_ipv_6
(Boolean)
—
If you’re creating a network interface in a dual-stack or IPv6-only subnet, you have the option to assign a primary IPv6 IP address. A primary IPv6 address is an IPv6 GUA address associated with an ENI that you have enabled to use a primary IPv6 address. Use this option if the instance that this ENI will be attached to relies on its IPv6 address not changing. Amazon Web Services will automatically assign an IPv6 address associated with the ENI attached to your instance to be the primary IPv6 address. Once you enable an IPv6 GUA address to be a primary IPv6, you cannot disable it. When you enable an IPv6 GUA address to be a primary IPv6, the first IPv6 GUA will be made the primary IPv6 address until the instance is terminated or the network interface is detached. If you have multiple IPv6 addresses associated with an ENI attached to your instance and you enable a primary IPv6 address, the first IPv6 GUA address associated with the ENI becomes the primary IPv6 address.
-
:connection_tracking_specification
(Types::ConnectionTrackingSpecificationRequest)
—
A connection tracking specification for the network interface.
-
:operator
(Types::OperatorRequest)
—
Reserved for internal use.
-
:subnet_id
(required, String)
—
The ID of the subnet to associate with the network interface.
-
:description
(String)
—
A description for the network interface.
-
: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
privateIpAddressesas primary (only one IP address can be designated as primary). -
:groups
(Array<String>)
—
The IDs of the security groups.
-
:private_ip_addresses
(Array<Types::PrivateIpAddressSpecification>)
—
The private IPv4 addresses.
You can't specify private IPv4 addresses if you've specified one of the following: a count of private IPv4 addresses, specific IPv4 prefixes, or a count of IPv4 prefixes.
-
: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.You can't specify a count of private IPv4 addresses if you've specified one of the following: specific private IPv4 addresses, specific IPv4 prefixes, or a count of IPv4 prefixes.
-
:ipv_6_addresses
(Array<Types::InstanceIpv6Address>)
—
The IPv6 addresses from the IPv6 CIDR block range of your subnet.
You can't specify IPv6 addresses using this parameter if you've specified one of the following: a count of IPv6 addresses, specific IPv6 prefixes, or a count of IPv6 prefixes.
-
: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 specify a count of IPv6 addresses using this parameter if you've specified one of the following: specific IPv6 addresses, specific IPv6 prefixes, or a count of IPv6 prefixes.
If your subnet has the
AssignIpv6AddressOnCreationattribute set, you can override that setting by specifying 0 as the IPv6 address count. -
: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 isUnauthorizedOperation.
Returns:
1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 1080 def create_network_interface(options = {}) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.create_network_interface(options) end NetworkInterface.new( id: resp.data.network_interface.network_interface_id, data: resp.data.network_interface, client: @client ) end |
#create_placement_group(options = {}) ⇒ PlacementGroup
Examples:
Request syntax with placeholder values
Request syntax with placeholder values
placementgroup = ec2.create_placement_group({
partition_count: 1,
tag_specifications: [
{
resource_type: "capacity-reservation", # accepts capacity-reservation, client-vpn-endpoint, customer-gateway, carrier-gateway, coip-pool, declarative-policies-report, dedicated-host, dhcp-options, egress-only-internet-gateway, elastic-ip, elastic-gpu, export-image-task, export-instance-task, fleet, fpga-image, host-reservation, image, image-usage-report, import-image-task, import-snapshot-task, instance, instance-event-window, internet-gateway, ipam, ipam-pool, ipam-scope, ipv4pool-ec2, ipv6pool-ec2, key-pair, launch-template, local-gateway, local-gateway-route-table, local-gateway-virtual-interface, local-gateway-virtual-interface-group, local-gateway-route-table-vpc-association, local-gateway-route-table-virtual-interface-group-association, natgateway, network-acl, network-interface, network-insights-analysis, network-insights-path, network-insights-access-scope, network-insights-access-scope-analysis, outpost-lag, placement-group, prefix-list, replace-root-volume-task, reserved-instances, route-table, security-group, security-group-rule, service-link-virtual-interface, snapshot, spot-fleet-request, spot-instances-request, subnet, subnet-cidr-reservation, traffic-mirror-filter, traffic-mirror-session, traffic-mirror-target, transit-gateway, transit-gateway-attachment, transit-gateway-connect-peer, transit-gateway-multicast-domain, transit-gateway-policy-table, transit-gateway-metering-policy, transit-gateway-route-table, transit-gateway-route-table-announcement, volume, vpc, vpc-endpoint, vpc-endpoint-connection, vpc-endpoint-service, vpc-endpoint-service-permission, vpc-peering-connection, vpn-connection, vpn-gateway, vpc-flow-log, capacity-reservation-fleet, traffic-mirror-filter-rule, vpc-endpoint-connection-device-type, verified-access-instance, verified-access-group, verified-access-endpoint, verified-access-policy, verified-access-trust-provider, vpn-connection-device-type, vpc-block-public-access-exclusion, vpc-encryption-control, route-server, route-server-endpoint, route-server-peer, ipam-resource-discovery, ipam-resource-discovery-association, instance-connect-endpoint, verified-access-endpoint-target, ipam-external-resource-verification-token, capacity-block, mac-modification-task, ipam-prefix-list-resolver, ipam-policy, ipam-prefix-list-resolver-target, capacity-manager-data-export, vpn-concentrator
tags: [
{
key: "String",
value: "String",
},
],
},
],
spread_level: "host", # accepts host, rack
dry_run: false,
group_name: "String",
strategy: "cluster", # accepts cluster, spread, partition
})
Parameters:
-
options
(Hash)
(defaults to: {})
—
({})
Options Hash (options):
-
:partition_count
(Integer)
—
The number of partitions. Valid only when Strategy is set to
partition. -
:tag_specifications
(Array<Types::TagSpecification>)
—
The tags to apply to the new placement group.
-
:spread_level
(String)
—
Determines how placement groups spread instances.
Host – You can use
hostonly with Outpost placement groups.Rack – No usage restrictions.
-
:dry_run
(Boolean)
—
Checks whether you have the required permissions for the operation, without actually making the request, and provides an error response. If you have the required permissions, the error response is
DryRunOperation. Otherwise, it isUnauthorizedOperation. -
:group_name
(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
(String)
—
The placement strategy.
Returns:
1136 1137 1138 1139 1140 1141 1142 1143 1144 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 1136 def create_placement_group(options = {}) Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.create_placement_group(options) end PlacementGroup.new( name: options[:group_name], client: @client ) end |
#create_route_table(options = {}) ⇒ RouteTable
Examples:
Request syntax with placeholder values
Request syntax with placeholder values
routetable = ec2.create_route_table({
tag_specifications: [
{
resource_type: "capacity-reservation", # accepts capacity-reservation, client-vpn-endpoint, customer-gateway, carrier-gateway, coip-pool, declarative-policies-report, dedicated-host, dhcp-options, egress-only-internet-gateway, elastic-ip, elastic-gpu, export-image-task, export-instance-task, fleet, fpga-image, host-reservation, image, image-usage-report, import-image-task, import-snapshot-task, instance, instance-event-window, internet-gateway, ipam, ipam-pool, ipam-scope, ipv4pool-ec2, ipv6pool-ec2, key-pair, launch-template, local-gateway, local-gateway-route-table, local-gateway-virtual-interface, local-gateway-virtual-interface-group, local-gateway-route-table-vpc-association, local-gateway-route-table-virtual-interface-group-association, natgateway, network-acl, network-interface, network-insights-analysis, network-insights-path, network-insights-access-scope, network-insights-access-scope-analysis, outpost-lag, placement-group, prefix-list, replace-root-volume-task, reserved-instances, route-table, security-group, security-group-rule, service-link-virtual-interface, snapshot, spot-fleet-request, spot-instances-request, subnet, subnet-cidr-reservation, traffic-mirror-filter, traffic-mirror-session, traffic-mirror-target, transit-gateway, transit-gateway-attachment, transit-gateway-connect-peer, transit-gateway-multicast-domain, transit-gateway-policy-table, transit-gateway-metering-policy, transit-gateway-route-table, transit-gateway-route-table-announcement, volume, vpc, vpc-endpoint, vpc-endpoint-connection, vpc-endpoint-service, vpc-endpoint-service-permission, vpc-peering-connection, vpn-connection, vpn-gateway, vpc-flow-log, capacity-reservation-fleet, traffic-mirror-filter-rule, vpc-endpoint-connection-device-type, verified-access-instance, verified-access-group, verified-access-endpoint, verified-access-policy, verified-access-trust-provider, vpn-connection-device-type, vpc-block-public-access-exclusion, vpc-encryption-control, route-server, route-server-endpoint, route-server-peer, ipam-resource-discovery, ipam-resource-discovery-association, instance-connect-endpoint, verified-access-endpoint-target, ipam-external-resource-verification-token, capacity-block, mac-modification-task, ipam-prefix-list-resolver, ipam-policy, ipam-prefix-list-resolver-target, capacity-manager-data-export, vpn-concentrator
tags: [
{
key: "String",
value: "String",
},
],
},
],
client_token: "String",
dry_run: false,
vpc_id: "VpcId", # required
})
Parameters:
-
options
(Hash)
(defaults to: {})
—
({})
Options Hash (options):
-
:tag_specifications
(Array<Types::TagSpecification>)
—
The tags to assign to the route table.
-
:client_token
(String)
—
Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see Ensuring 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 isUnauthorizedOperation. -
:vpc_id
(required, String)
—
The ID of the VPC.
Returns:
1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 1183 def create_route_table(options = {}) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.create_route_table(options) end RouteTable.new( id: resp.data.route_table.route_table_id, data: resp.data.route_table, client: @client ) end |
#create_security_group(options = {}) ⇒ SecurityGroup
Examples:
Request syntax with placeholder values
Request syntax with placeholder values
securitygroup = ec2.create_security_group({
description: "String", # required
group_name: "String", # required
vpc_id: "VpcId",
tag_specifications: [
{
resource_type: "capacity-reservation", # accepts capacity-reservation, client-vpn-endpoint, customer-gateway, carrier-gateway, coip-pool, declarative-policies-report, dedicated-host, dhcp-options, egress-only-internet-gateway, elastic-ip, elastic-gpu, export-image-task, export-instance-task, fleet, fpga-image, host-reservation, image, image-usage-report, import-image-task, import-snapshot-task, instance, instance-event-window, internet-gateway, ipam, ipam-pool, ipam-scope, ipv4pool-ec2, ipv6pool-ec2, key-pair, launch-template, local-gateway, local-gateway-route-table, local-gateway-virtual-interface, local-gateway-virtual-interface-group, local-gateway-route-table-vpc-association, local-gateway-route-table-virtual-interface-group-association, natgateway, network-acl, network-interface, network-insights-analysis, network-insights-path, network-insights-access-scope, network-insights-access-scope-analysis, outpost-lag, placement-group, prefix-list, replace-root-volume-task, reserved-instances, route-table, security-group, security-group-rule, service-link-virtual-interface, snapshot, spot-fleet-request, spot-instances-request, subnet, subnet-cidr-reservation, traffic-mirror-filter, traffic-mirror-session, traffic-mirror-target, transit-gateway, transit-gateway-attachment, transit-gateway-connect-peer, transit-gateway-multicast-domain, transit-gateway-policy-table, transit-gateway-metering-policy, transit-gateway-route-table, transit-gateway-route-table-announcement, volume, vpc, vpc-endpoint, vpc-endpoint-connection, vpc-endpoint-service, vpc-endpoint-service-permission, vpc-peering-connection, vpn-connection, vpn-gateway, vpc-flow-log, capacity-reservation-fleet, traffic-mirror-filter-rule, vpc-endpoint-connection-device-type, verified-access-instance, verified-access-group, verified-access-endpoint, verified-access-policy, verified-access-trust-provider, vpn-connection-device-type, vpc-block-public-access-exclusion, vpc-encryption-control, route-server, route-server-endpoint, route-server-peer, ipam-resource-discovery, ipam-resource-discovery-association, instance-connect-endpoint, verified-access-endpoint-target, ipam-external-resource-verification-token, capacity-block, mac-modification-task, ipam-prefix-list-resolver, ipam-policy, ipam-prefix-list-resolver-target, capacity-manager-data-export, vpn-concentrator
tags: [
{
key: "String",
value: "String",
},
],
},
],
dry_run: false,
})
Parameters:
-
options
(Hash)
(defaults to: {})
—
({})
Options Hash (options):
-
:description
(required, String)
—
A description for the security group.
Constraints: Up to 255 characters in length
Valid characters: a-z, A-Z, 0-9, spaces, and ._-:/()#,@[]+=&;{}!$*
-
:group_name
(required, String)
—
The name of the security group. Names are case-insensitive and must be unique within the VPC.
Constraints: Up to 255 characters in length. Can't start with
sg-.Valid characters: a-z, A-Z, 0-9, spaces, and ._-:/()#,@[]+=&;{}!$*
-
:vpc_id
(String)
—
The ID of the VPC. Required for a nondefault VPC.
-
:tag_specifications
(Array<Types::TagSpecification>)
—
The tags to assign to the security group.
-
: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 isUnauthorizedOperation.
Returns:
1239 1240 1241 1242 1243 1244 1245 1246 1247 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 1239 def create_security_group(options = {}) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.create_security_group(options) end SecurityGroup.new( id: resp.data.group_id, client: @client ) end |
#create_snapshot(options = {}) ⇒ Snapshot
Examples:
Request syntax with placeholder values
Request syntax with placeholder values
snapshot = ec2.create_snapshot({
description: "String",
outpost_arn: "String",
volume_id: "VolumeId", # required
tag_specifications: [
{
resource_type: "capacity-reservation", # accepts capacity-reservation, client-vpn-endpoint, customer-gateway, carrier-gateway, coip-pool, declarative-policies-report, dedicated-host, dhcp-options, egress-only-internet-gateway, elastic-ip, elastic-gpu, export-image-task, export-instance-task, fleet, fpga-image, host-reservation, image, image-usage-report, import-image-task, import-snapshot-task, instance, instance-event-window, internet-gateway, ipam, ipam-pool, ipam-scope, ipv4pool-ec2, ipv6pool-ec2, key-pair, launch-template, local-gateway, local-gateway-route-table, local-gateway-virtual-interface, local-gateway-virtual-interface-group, local-gateway-route-table-vpc-association, local-gateway-route-table-virtual-interface-group-association, natgateway, network-acl, network-interface, network-insights-analysis, network-insights-path, network-insights-access-scope, network-insights-access-scope-analysis, outpost-lag, placement-group, prefix-list, replace-root-volume-task, reserved-instances, route-table, security-group, security-group-rule, service-link-virtual-interface, snapshot, spot-fleet-request, spot-instances-request, subnet, subnet-cidr-reservation, traffic-mirror-filter, traffic-mirror-session, traffic-mirror-target, transit-gateway, transit-gateway-attachment, transit-gateway-connect-peer, transit-gateway-multicast-domain, transit-gateway-policy-table, transit-gateway-metering-policy, transit-gateway-route-table, transit-gateway-route-table-announcement, volume, vpc, vpc-endpoint, vpc-endpoint-connection, vpc-endpoint-service, vpc-endpoint-service-permission, vpc-peering-connection, vpn-connection, vpn-gateway, vpc-flow-log, capacity-reservation-fleet, traffic-mirror-filter-rule, vpc-endpoint-connection-device-type, verified-access-instance, verified-access-group, verified-access-endpoint, verified-access-policy, verified-access-trust-provider, vpn-connection-device-type, vpc-block-public-access-exclusion, vpc-encryption-control, route-server, route-server-endpoint, route-server-peer, ipam-resource-discovery, ipam-resource-discovery-association, instance-connect-endpoint, verified-access-endpoint-target, ipam-external-resource-verification-token, capacity-block, mac-modification-task, ipam-prefix-list-resolver, ipam-policy, ipam-prefix-list-resolver-target, capacity-manager-data-export, vpn-concentrator
tags: [
{
key: "String",
value: "String",
},
],
},
],
location: "regional", # accepts regional, local
dry_run: false,
})
Parameters:
-
options
(Hash)
(defaults to: {})
—
({})
Options Hash (options):
-
:description
(String)
—
A description for the snapshot.
-
:outpost_arn
(String)
—
Only supported for volumes on Outposts. If the source volume is not on an Outpost, omit this parameter. To create the snapshot on the same Outpost as the source volume, specify the ARN of that Outpost. The snapshot must be created on the same Outpost as the volume.
To create the snapshot in the parent Region of the Outpost, omit this parameter.
For more information, see Create local snapshots from volumes on an Outpost in the Amazon EBS User Guide.
-
:volume_id
(required, String)
—
The ID of the Amazon EBS volume.
-
:tag_specifications
(Array<Types::TagSpecification>)
—
The tags to apply to the snapshot during creation.
-
:location
(String)
—
Only supported for volumes in Local Zones. If the source volume is not in a Local Zone, omit this parameter. To create a local snapshot in the same Local Zone as the source volume, specify
local.To create a regional snapshot in the parent Region of the Local Zone, specify
regionalor omit this parameter.
Default value:
regional -
: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 isUnauthorizedOperation.
Returns:
- (Snapshot)
1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 1314 def create_snapshot(options = {}) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.create_snapshot(options) end Snapshot.new( id: resp.data.snapshot_id, data: resp.data, client: @client ) end |
#create_subnet(options = {}) ⇒ Subnet
Examples:
Request syntax with placeholder values
Request syntax with placeholder values
subnet = ec2.create_subnet({
tag_specifications: [
{
resource_type: "capacity-reservation", # accepts capacity-reservation, client-vpn-endpoint, customer-gateway, carrier-gateway, coip-pool, declarative-policies-report, dedicated-host, dhcp-options, egress-only-internet-gateway, elastic-ip, elastic-gpu, export-image-task, export-instance-task, fleet, fpga-image, host-reservation, image, image-usage-report, import-image-task, import-snapshot-task, instance, instance-event-window, internet-gateway, ipam, ipam-pool, ipam-scope, ipv4pool-ec2, ipv6pool-ec2, key-pair, launch-template, local-gateway, local-gateway-route-table, local-gateway-virtual-interface, local-gateway-virtual-interface-group, local-gateway-route-table-vpc-association, local-gateway-route-table-virtual-interface-group-association, natgateway, network-acl, network-interface, network-insights-analysis, network-insights-path, network-insights-access-scope, network-insights-access-scope-analysis, outpost-lag, placement-group, prefix-list, replace-root-volume-task, reserved-instances, route-table, security-group, security-group-rule, service-link-virtual-interface, snapshot, spot-fleet-request, spot-instances-request, subnet, subnet-cidr-reservation, traffic-mirror-filter, traffic-mirror-session, traffic-mirror-target, transit-gateway, transit-gateway-attachment, transit-gateway-connect-peer, transit-gateway-multicast-domain, transit-gateway-policy-table, transit-gateway-metering-policy, transit-gateway-route-table, transit-gateway-route-table-announcement, volume, vpc, vpc-endpoint, vpc-endpoint-connection, vpc-endpoint-service, vpc-endpoint-service-permission, vpc-peering-connection, vpn-connection, vpn-gateway, vpc-flow-log, capacity-reservation-fleet, traffic-mirror-filter-rule, vpc-endpoint-connection-device-type, verified-access-instance, verified-access-group, verified-access-endpoint, verified-access-policy, verified-access-trust-provider, vpn-connection-device-type, vpc-block-public-access-exclusion, vpc-encryption-control, route-server, route-server-endpoint, route-server-peer, ipam-resource-discovery, ipam-resource-discovery-association, instance-connect-endpoint, verified-access-endpoint-target, ipam-external-resource-verification-token, capacity-block, mac-modification-task, ipam-prefix-list-resolver, ipam-policy, ipam-prefix-list-resolver-target, capacity-manager-data-export, vpn-concentrator
tags: [
{
key: "String",
value: "String",
},
],
},
],
availability_zone: "String",
availability_zone_id: "String",
cidr_block: "String",
ipv_6_cidr_block: "String",
outpost_arn: "String",
vpc_id: "VpcId", # required
ipv_6_native: false,
ipv_4_ipam_pool_id: "IpamPoolId",
ipv_4_netmask_length: 1,
ipv_6_ipam_pool_id: "IpamPoolId",
ipv_6_netmask_length: 1,
dry_run: false,
})
Parameters:
-
options
(Hash)
(defaults to: {})
—
({})
Options Hash (options):
-
:tag_specifications
(Array<Types::TagSpecification>)
—
The tags to assign to the subnet.
-
:availability_zone
(String)
—
The Availability Zone or Local Zone for the subnet.
Default: Amazon Web Services selects one for you. If you create more than one subnet in your VPC, we do not necessarily select a different zone for each subnet.
To create a subnet in a Local Zone, set this value to the Local Zone ID, for example
us-west-2-lax-1a. For information about the Regions that support Local Zones, see Available Local Zones.To create a subnet in an Outpost, set this value to the Availability Zone for the Outpost and specify the Outpost ARN.
-
:availability_zone_id
(String)
—
The AZ ID or the Local Zone ID of the subnet.
-
:cidr_block
(String)
—
The IPv4 network range for the subnet, in CIDR notation. For example,
10.0.0.0/24. We modify the specified CIDR block to its canonical form; for example, if you specify100.68.0.18/18, we modify it to100.68.0.0/18.This parameter is not supported for an IPv6 only subnet.
-
:ipv_6_cidr_block
(String)
—
The IPv6 network range for the subnet, in CIDR notation. This parameter is required for an IPv6 only subnet.
-
:outpost_arn
(String)
—
The Amazon Resource Name (ARN) of the Outpost. If you specify an Outpost ARN, you must also specify the Availability Zone of the Outpost subnet.
-
:vpc_id
(required, String)
—
The ID of the VPC.
-
:ipv_6_native
(Boolean)
—
Indicates whether to create an IPv6 only subnet.
-
:ipv_4_ipam_pool_id
(String)
—
An IPv4 IPAM pool ID for the subnet.
-
:ipv_4_netmask_length
(Integer)
—
An IPv4 netmask length for the subnet.
-
:ipv_6_ipam_pool_id
(String)
—
An IPv6 IPAM pool ID for the subnet.
-
:ipv_6_netmask_length
(Integer)
—
An IPv6 netmask length for the 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 isUnauthorizedOperation.
Returns:
- (Subnet)
1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 1406 def create_subnet(options = {}) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.create_subnet(options) end Subnet.new( id: resp.data.subnet.subnet_id, data: resp.data.subnet, client: @client ) end |
#create_tags(options) ⇒ EmptyStructure
Examples:
Request syntax with placeholder values
Request syntax with placeholder values
ec2.create_tags({
dry_run: false,
resources: ["TaggableResourceId"], # required
tags: [ # required
{
key: "String",
value: "String",
},
],
})
Parameters:
-
options
(Hash)
—
({})
Options Hash (options):
-
:dry_run
(Boolean)
—
Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is
DryRunOperation. Otherwise, it isUnauthorizedOperation. -
:resources
(required, Array<String>)
—
The IDs of the resources, separated by spaces.
Constraints: Up to 1000 resource IDs. We recommend breaking up this request into smaller batches.
-
:tags
(required, Array<Types::Tag>)
—
The tags. The
valueparameter 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:
- (EmptyStructure)
1445 1446 1447 1448 1449 1450 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 1445 def create_tags(options = {}) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.create_tags(options) end resp.data end |
#create_volume(options = {}) ⇒ Volume
Examples:
Request syntax with placeholder values
Request syntax with placeholder values
volume = ec2.create_volume({
availability_zone: "AvailabilityZoneName",
availability_zone_id: "AvailabilityZoneId",
encrypted: false,
iops: 1,
kms_key_id: "KmsKeyId",
outpost_arn: "String",
size: 1,
snapshot_id: "SnapshotId",
volume_type: "standard", # accepts standard, io1, io2, gp2, sc1, st1, gp3
tag_specifications: [
{
resource_type: "capacity-reservation", # accepts capacity-reservation, client-vpn-endpoint, customer-gateway, carrier-gateway, coip-pool, declarative-policies-report, dedicated-host, dhcp-options, egress-only-internet-gateway, elastic-ip, elastic-gpu, export-image-task, export-instance-task, fleet, fpga-image, host-reservation, image, image-usage-report, import-image-task, import-snapshot-task, instance, instance-event-window, internet-gateway, ipam, ipam-pool, ipam-scope, ipv4pool-ec2, ipv6pool-ec2, key-pair, launch-template, local-gateway, local-gateway-route-table, local-gateway-virtual-interface, local-gateway-virtual-interface-group, local-gateway-route-table-vpc-association, local-gateway-route-table-virtual-interface-group-association, natgateway, network-acl, network-interface, network-insights-analysis, network-insights-path, network-insights-access-scope, network-insights-access-scope-analysis, outpost-lag, placement-group, prefix-list, replace-root-volume-task, reserved-instances, route-table, security-group, security-group-rule, service-link-virtual-interface, snapshot, spot-fleet-request, spot-instances-request, subnet, subnet-cidr-reservation, traffic-mirror-filter, traffic-mirror-session, traffic-mirror-target, transit-gateway, transit-gateway-attachment, transit-gateway-connect-peer, transit-gateway-multicast-domain, transit-gateway-policy-table, transit-gateway-metering-policy, transit-gateway-route-table, transit-gateway-route-table-announcement, volume, vpc, vpc-endpoint, vpc-endpoint-connection, vpc-endpoint-service, vpc-endpoint-service-permission, vpc-peering-connection, vpn-connection, vpn-gateway, vpc-flow-log, capacity-reservation-fleet, traffic-mirror-filter-rule, vpc-endpoint-connection-device-type, verified-access-instance, verified-access-group, verified-access-endpoint, verified-access-policy, verified-access-trust-provider, vpn-connection-device-type, vpc-block-public-access-exclusion, vpc-encryption-control, route-server, route-server-endpoint, route-server-peer, ipam-resource-discovery, ipam-resource-discovery-association, instance-connect-endpoint, verified-access-endpoint-target, ipam-external-resource-verification-token, capacity-block, mac-modification-task, ipam-prefix-list-resolver, ipam-policy, ipam-prefix-list-resolver-target, capacity-manager-data-export, vpn-concentrator
tags: [
{
key: "String",
value: "String",
},
],
},
],
multi_attach_enabled: false,
throughput: 1,
client_token: "String",
volume_initialization_rate: 1,
operator: {
principal: "String",
},
dry_run: false,
})
Parameters:
-
options
(Hash)
(defaults to: {})
—
({})
Options Hash (options):
-
:availability_zone
(String)
—
The ID of the Availability Zone in which to create the volume. For example,
us-east-1a.Either
AvailabilityZoneorAvailabilityZoneIdmust be specified, but not both. -
:availability_zone_id
(String)
—
The ID of the Availability Zone in which to create the volume. For example,
use1-az1.Either
AvailabilityZoneorAvailabilityZoneIdmust be specified, but not both. -
:encrypted
(Boolean)
—
Indicates whether the volume should be encrypted. The effect of setting the encryption state to
truedepends on the volume origin (new or from a snapshot), starting encryption state, ownership, and whether encryption by default is enabled. For more information, see Encryption by default in the Amazon EBS User Guide.Encrypted Amazon EBS volumes must be attached to instances that support Amazon EBS encryption. For more information, see Supported instance types.
-
:iops
(Integer)
—
The number of I/O operations per second (IOPS) to provision for the volume. Required for
io1andio2volumes. Optional forgp3volumes. Omit for all other volume types.Valid ranges:
gp3:
3,000(default)- 80,000IOPSio1:
100 - 64,000IOPSio2:
100 - 256,000IOPS
Instances built on the Nitro System can support up to 256,000 IOPS. Other instances can support up to 32,000 IOPS. -
:kms_key_id
(String)
—
The identifier of the KMS key to use for Amazon EBS encryption. If this parameter is not specified, your KMS key for Amazon EBS is used. If
KmsKeyIdis specified, the encrypted state must betrue.You can specify the KMS key using any of the following:
Key ID. For example, 1234abcd-12ab-34cd-56ef-1234567890ab.
Key alias. For example, alias/ExampleAlias.
Key ARN. For example, arn:aws:kms:us-east-1:012345678910:key/1234abcd-12ab-34cd-56ef-1234567890ab.
Alias ARN. For example, arn:aws:kms:us-east-1:012345678910:alias/ExampleAlias.
Amazon Web Services authenticates the KMS key asynchronously. Therefore, if you specify an ID, alias, or ARN that is not valid, the action can appear to complete, but eventually fails.
-
:outpost_arn
(String)
—
The Amazon Resource Name (ARN) of the Outpost on which to create the volume.
If you intend to use a volume with an instance running on an outpost, then you must create the volume on the same outpost as the instance. You can't use a volume created in an Amazon Web Services Region with an instance on an Amazon Web Services outpost, or the other way around.
-
:size
(Integer)
—
The size of the volume, in GiBs. You must specify either a snapshot ID or a volume size. If you specify a snapshot, the default is the snapshot size, and you can specify a volume size that is equal to or larger than the snapshot size.
Valid sizes:
gp2:
1 - 16,384GiBgp3:
1 - 65,536GiBio1:
4 - 16,384GiBio2:
4 - 65,536GiBst1 and sc1:
125 - 16,384GiBstandard:
1 - 1024GiB
-
:snapshot_id
(String)
—
The snapshot from which to create the volume. You must specify either a snapshot ID or a volume size.
-
:volume_type
(String)
—
The volume type. This parameter can be one of the following values:
General Purpose SSD:
gp2|gp3Provisioned IOPS SSD:
io1|io2Throughput Optimized HDD:
st1Cold HDD:
sc1Magnetic:
standard
Throughput Optimized HDD (
st1) and Cold HDD (sc1) volumes can't be used as boot volumes.For more information, see Amazon EBS volume types in the Amazon EBS User Guide.
Default:
gp2 -
:tag_specifications
(Array<Types::TagSpecification>)
—
The tags to apply to the volume during creation.
-
:multi_attach_enabled
(Boolean)
—
Indicates whether to enable Amazon EBS Multi-Attach. If you enable Multi-Attach, you can attach the volume to up to 16 Instances built on the Nitro System in the same Availability Zone. This parameter is supported with
io1andio2volumes only. For more information, see Amazon EBS Multi-Attach in the Amazon EBS User Guide. -
:throughput
(Integer)
—
The throughput to provision for the volume, in MiB/s. Supported for
gp3volumes only. Omit for all other volume types.Valid Range:
125 - 2000MiB/s -
:client_token
(String)
—
Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see Ensure Idempotency.
-
:volume_initialization_rate
(Integer)
—
Specifies the Amazon EBS Provisioned Rate for Volume Initialization (volume initialization rate), in MiB/s, at which to download the snapshot blocks from Amazon S3 to the volume. This is also known as volume initialization. Specifying a volume initialization rate ensures that the volume is initialized at a predictable and consistent rate after creation.
This parameter is supported only for volumes created from snapshots. Omit this parameter if:
You want to create the volume using fast snapshot restore. You must specify a snapshot that is enabled for fast snapshot restore. In this case, the volume is fully initialized at creation.
If you specify a snapshot that is enabled for fast snapshot restore and a volume initialization rate, the volume will be initialized at the specified rate instead of fast snapshot restore. You want to create a volume that is initialized at the default rate.
For more information, see Initialize Amazon EBS volumes in the Amazon EC2 User Guide.
Valid range: 100 - 300 MiB/s
-
:operator
(Types::OperatorRequest)
—
Reserved for internal use.
-
: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 isUnauthorizedOperation.
Returns:
- (Volume)
1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 1716 def create_volume(options = {}) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.create_volume(options) end Volume.new( id: resp.data.volume_id, data: resp.data, client: @client ) end |
#create_vpc(options = {}) ⇒ Vpc
Examples:
Request syntax with placeholder values
Request syntax with placeholder values
vpc = ec2.create_vpc({
cidr_block: "String",
ipv_6_pool: "Ipv6PoolEc2Id",
ipv_6_cidr_block: "String",
ipv_4_ipam_pool_id: "IpamPoolId",
ipv_4_netmask_length: 1,
ipv_6_ipam_pool_id: "IpamPoolId",
ipv_6_netmask_length: 1,
ipv_6_cidr_block_network_border_group: "String",
vpc_encryption_control: {
mode: "monitor", # required, accepts monitor, enforce
internet_gateway_exclusion: "enable", # accepts enable, disable
egress_only_internet_gateway_exclusion: "enable", # accepts enable, disable
nat_gateway_exclusion: "enable", # accepts enable, disable
virtual_private_gateway_exclusion: "enable", # accepts enable, disable
vpc_peering_exclusion: "enable", # accepts enable, disable
lambda_exclusion: "enable", # accepts enable, disable
vpc_lattice_exclusion: "enable", # accepts enable, disable
elastic_file_system_exclusion: "enable", # accepts enable, disable
},
tag_specifications: [
{
resource_type: "capacity-reservation", # accepts capacity-reservation, client-vpn-endpoint, customer-gateway, carrier-gateway, coip-pool, declarative-policies-report, dedicated-host, dhcp-options, egress-only-internet-gateway, elastic-ip, elastic-gpu, export-image-task, export-instance-task, fleet, fpga-image, host-reservation, image, image-usage-report, import-image-task, import-snapshot-task, instance, instance-event-window, internet-gateway, ipam, ipam-pool, ipam-scope, ipv4pool-ec2, ipv6pool-ec2, key-pair, launch-template, local-gateway, local-gateway-route-table, local-gateway-virtual-interface, local-gateway-virtual-interface-group, local-gateway-route-table-vpc-association, local-gateway-route-table-virtual-interface-group-association, natgateway, network-acl, network-interface, network-insights-analysis, network-insights-path, network-insights-access-scope, network-insights-access-scope-analysis, outpost-lag, placement-group, prefix-list, replace-root-volume-task, reserved-instances, route-table, security-group, security-group-rule, service-link-virtual-interface, snapshot, spot-fleet-request, spot-instances-request, subnet, subnet-cidr-reservation, traffic-mirror-filter, traffic-mirror-session, traffic-mirror-target, transit-gateway, transit-gateway-attachment, transit-gateway-connect-peer, transit-gateway-multicast-domain, transit-gateway-policy-table, transit-gateway-metering-policy, transit-gateway-route-table, transit-gateway-route-table-announcement, volume, vpc, vpc-endpoint, vpc-endpoint-connection, vpc-endpoint-service, vpc-endpoint-service-permission, vpc-peering-connection, vpn-connection, vpn-gateway, vpc-flow-log, capacity-reservation-fleet, traffic-mirror-filter-rule, vpc-endpoint-connection-device-type, verified-access-instance, verified-access-group, verified-access-endpoint, verified-access-policy, verified-access-trust-provider, vpn-connection-device-type, vpc-block-public-access-exclusion, vpc-encryption-control, route-server, route-server-endpoint, route-server-peer, ipam-resource-discovery, ipam-resource-discovery-association, instance-connect-endpoint, verified-access-endpoint-target, ipam-external-resource-verification-token, capacity-block, mac-modification-task, ipam-prefix-list-resolver, ipam-policy, ipam-prefix-list-resolver-target, capacity-manager-data-export, vpn-concentrator
tags: [
{
key: "String",
value: "String",
},
],
},
],
dry_run: false,
instance_tenancy: "default", # accepts default, dedicated, host
amazon_provided_ipv_6_cidr_block: false,
})
Parameters:
-
options
(Hash)
(defaults to: {})
—
({})
Options Hash (options):
-
:cidr_block
(String)
—
The IPv4 network range for the VPC, in CIDR notation. For example,
10.0.0.0/16. We modify the specified CIDR block to its canonical form; for example, if you specify100.68.0.18/18, we modify it to100.68.0.0/18. -
:ipv_6_pool
(String)
—
The ID of an IPv6 address pool from which to allocate the IPv6 CIDR block.
-
:ipv_6_cidr_block
(String)
—
The IPv6 CIDR block from the IPv6 address pool. You must also specify
Ipv6Poolin the request.To let Amazon choose the IPv6 CIDR block for you, omit this parameter.
-
:ipv_4_ipam_pool_id
(String)
—
The ID of an IPv4 IPAM pool you want to use for allocating this VPC's CIDR. For more information, see What is IPAM? in the Amazon VPC IPAM User Guide.
-
:ipv_4_netmask_length
(Integer)
—
The netmask length of the IPv4 CIDR you want to allocate to this VPC from an Amazon VPC IP Address Manager (IPAM) pool. For more information about IPAM, see What is IPAM? in the Amazon VPC IPAM User Guide.
-
:ipv_6_ipam_pool_id
(String)
—
The ID of an IPv6 IPAM pool which will be used to allocate this VPC an IPv6 CIDR. IPAM is a VPC feature that you can use to automate your IP address management workflows including assigning, tracking, troubleshooting, and auditing IP addresses across Amazon Web Services Regions and accounts throughout your Amazon Web Services Organization. For more information, see What is IPAM? in the Amazon VPC IPAM User Guide.
-
:ipv_6_netmask_length
(Integer)
—
The netmask length of the IPv6 CIDR you want to allocate to this VPC from an Amazon VPC IP Address Manager (IPAM) pool. For more information about IPAM, see What is IPAM? in the Amazon VPC IPAM User Guide.
-
:ipv_6_cidr_block_network_border_group
(String)
—
The name of the location from which we advertise the IPV6 CIDR block. Use this parameter to limit the address to this location.
You must set
AmazonProvidedIpv6CidrBlocktotrueto use this parameter. -
:vpc_encryption_control
(Types::VpcEncryptionControlConfiguration)
—
Specifies the encryption control configuration to apply to the VPC during creation. VPC Encryption Control enables you to enforce encryption for all data in transit within and between VPCs to meet compliance requirements.
For more information, see Enforce VPC encryption in transit in the Amazon VPC User Guide.
-
:tag_specifications
(Array<Types::TagSpecification>)
—
The tags to assign to 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 isUnauthorizedOperation. -
: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. Fordedicated, instances are launched as dedicated tenancy instances by default. You can only launch instances with a tenancy ofdedicatedorhostinto a dedicated tenancy VPC.Important: The
hostvalue cannot be used with this parameter. Use thedefaultordedicatedvalues only.Default:
default -
: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.
Returns:
- (Vpc)
1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 1858 def create_vpc(options = {}) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.create_vpc(options) end Vpc.new( id: resp.data.vpc.vpc_id, data: resp.data.vpc, client: @client ) end |
#create_vpc_peering_connection(options = {}) ⇒ VpcPeeringConnection
Examples:
Request syntax with placeholder values
Request syntax with placeholder values
vpcpeeringconnection = ec2.create_vpc_peering_connection({
peer_region: "String",
tag_specifications: [
{
resource_type: "capacity-reservation", # accepts capacity-reservation, client-vpn-endpoint, customer-gateway, carrier-gateway, coip-pool, declarative-policies-report, dedicated-host, dhcp-options, egress-only-internet-gateway, elastic-ip, elastic-gpu, export-image-task, export-instance-task, fleet, fpga-image, host-reservation, image, image-usage-report, import-image-task, import-snapshot-task, instance, instance-event-window, internet-gateway, ipam, ipam-pool, ipam-scope, ipv4pool-ec2, ipv6pool-ec2, key-pair, launch-template, local-gateway, local-gateway-route-table, local-gateway-virtual-interface, local-gateway-virtual-interface-group, local-gateway-route-table-vpc-association, local-gateway-route-table-virtual-interface-group-association, natgateway, network-acl, network-interface, network-insights-analysis, network-insights-path, network-insights-access-scope, network-insights-access-scope-analysis, outpost-lag, placement-group, prefix-list, replace-root-volume-task, reserved-instances, route-table, security-group, security-group-rule, service-link-virtual-interface, snapshot, spot-fleet-request, spot-instances-request, subnet, subnet-cidr-reservation, traffic-mirror-filter, traffic-mirror-session, traffic-mirror-target, transit-gateway, transit-gateway-attachment, transit-gateway-connect-peer, transit-gateway-multicast-domain, transit-gateway-policy-table, transit-gateway-metering-policy, transit-gateway-route-table, transit-gateway-route-table-announcement, volume, vpc, vpc-endpoint, vpc-endpoint-connection, vpc-endpoint-service, vpc-endpoint-service-permission, vpc-peering-connection, vpn-connection, vpn-gateway, vpc-flow-log, capacity-reservation-fleet, traffic-mirror-filter-rule, vpc-endpoint-connection-device-type, verified-access-instance, verified-access-group, verified-access-endpoint, verified-access-policy, verified-access-trust-provider, vpn-connection-device-type, vpc-block-public-access-exclusion, vpc-encryption-control, route-server, route-server-endpoint, route-server-peer, ipam-resource-discovery, ipam-resource-discovery-association, instance-connect-endpoint, verified-access-endpoint-target, ipam-external-resource-verification-token, capacity-block, mac-modification-task, ipam-prefix-list-resolver, ipam-policy, ipam-prefix-list-resolver-target, capacity-manager-data-export, vpn-concentrator
tags: [
{
key: "String",
value: "String",
},
],
},
],
dry_run: false,
vpc_id: "VpcId", # required
peer_vpc_id: "String",
peer_owner_id: "String",
})
Parameters:
-
options
(Hash)
(defaults to: {})
—
({})
Options Hash (options):
-
: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.
-
:tag_specifications
(Array<Types::TagSpecification>)
—
The tags to assign to the peering connection.
-
: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 isUnauthorizedOperation. -
:vpc_id
(required, String)
—
The ID of the requester VPC. You must specify this parameter in the request.
-
:peer_vpc_id
(String)
—
The ID of the VPC with which you are creating the VPC peering connection. You must specify this parameter in the request.
-
:peer_owner_id
(String)
—
The Amazon Web Services account ID of the owner of the accepter VPC.
Default: Your Amazon Web Services account ID
Returns:
1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 1913 def create_vpc_peering_connection(options = {}) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.create_vpc_peering_connection(options) end VpcPeeringConnection.new( id: resp.data.vpc_peering_connection.vpc_peering_connection_id, data: resp.data.vpc_peering_connection, client: @client ) end |
#delete_tags(options = {}) ⇒ EmptyStructure
Examples:
Request syntax with placeholder values
Request syntax with placeholder values
ec2.delete_tags({
dry_run: false,
resources: ["TaggableResourceId"], # required
tags: [
{
key: "String",
value: "String",
},
],
})
Parameters:
-
options
(Hash)
(defaults to: {})
—
({})
Options Hash (options):
-
:dry_run
(Boolean)
—
Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is
DryRunOperation. Otherwise, it isUnauthorizedOperation. -
:resources
(required, Array<String>)
—
The IDs of the resources, separated by spaces.
Constraints: Up to 1000 resource IDs. We recommend breaking up this request into smaller batches.
-
:tags
(Array<Types::Tag>)
—
The tags to delete. Specify a tag key and an optional tag value to delete specific tags. If you specify a tag key without a tag value, we delete any tag with this key regardless of its value. If you specify a tag key with an empty string as the tag value, we delete the tag only if its value is an empty string.
If you omit this parameter, we delete all user-defined tags for the specified resources. We do not delete Amazon Web Services-generated tags (tags that have the
aws:prefix).Constraints: Up to 1000 tags.
Returns:
- (EmptyStructure)
1488 1489 1490 1491 1492 1493 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 1488 def delete_tags(options = {}) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.delete_tags(options) end resp.data end |
#dhcp_options(id) ⇒ DhcpOptions
2282 2283 2284 2285 2286 2287 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 2282 def dhcp_options(id) DhcpOptions.new( id: id, client: @client ) end |
#dhcp_options_sets(options = {}) ⇒ DhcpOptions::Collection
Examples:
Request syntax with placeholder values
Request syntax with placeholder values
dhcp_options_sets = ec2.dhcp_options_sets({
dhcp_options_ids: ["DhcpOptionsId"],
dry_run: false,
filters: [
{
name: "String",
values: ["String"],
},
],
})
Parameters:
-
options
(Hash)
(defaults to: {})
—
({})
Options Hash (options):
-
:dhcp_options_ids
(Array<String>)
—
The IDs of DHCP option sets.
-
: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 isUnauthorizedOperation. -
:filters
(Array<Types::Filter>)
—
The filters.
dhcp-options-id- The ID of a DHCP options set.key- The key for one of the options (for example,domain-name).value- The value for one of the options.owner-id- The ID of the Amazon Web Services account that owns the DHCP options set.tag- The key/value combination of a tag assigned to the resource. Use the tag key in the filter name and the tag value as the filter value. For example, to find all resources that have a tag with the keyOwnerand the valueTeamA, specifytag:Ownerfor the filter name andTeamAfor the filter value.tag-key- The key of a tag assigned to the resource. Use this filter to find all resources assigned a tag with a specific key, regardless of the tag value.
Returns:
2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 2331 def dhcp_options_sets(options = {}) batches = Enumerator.new do |y| resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.describe_dhcp_options(options) end resp.each_page do |page| batch = [] page.data.dhcp_options.each do |d| batch << DhcpOptions.new( id: d.dhcp_options_id, data: d, client: @client ) end y.yield(batch) end end DhcpOptions::Collection.new(batches) end |
#disassociate_route_table(options = {}) ⇒ EmptyStructure
Examples:
Request syntax with placeholder values
Request syntax with placeholder values
ec2.disassociate_route_table({
dry_run: false,
association_id: "RouteTableAssociationId", # required
})
Parameters:
-
options
(Hash)
(defaults to: {})
—
({})
Options Hash (options):
-
:dry_run
(Boolean)
—
Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is
DryRunOperation. Otherwise, it isUnauthorizedOperation. -
:association_id
(required, String)
—
The association ID representing the current association between the route table and subnet or gateway.
Returns:
- (EmptyStructure)
1940 1941 1942 1943 1944 1945 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 1940 def disassociate_route_table(options = {}) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.disassociate_route_table(options) end resp.data end |
#image(id) ⇒ Image
2353 2354 2355 2356 2357 2358 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 2353 def image(id) Image.new( id: id, client: @client ) end |
#images(options = {}) ⇒ Image::Collection
Examples:
Request syntax with placeholder values
Request syntax with placeholder values
images = ec2.images({
executable_users: ["String"],
image_ids: ["ImageId"],
owners: ["String"],
include_deprecated: false,
include_disabled: false,
dry_run: false,
filters: [
{
name: "String",
values: ["String"],
},
],
})
Parameters:
-
options
(Hash)
(defaults to: {})
—
({})
Options Hash (options):
-
:executable_users
(Array<String>)
—
Scopes the images by users with explicit launch permissions. Specify an Amazon Web Services account ID,
self(the sender of the request), orall(public AMIs).If you specify an Amazon Web Services account ID that is not your own, only AMIs shared with that specific Amazon Web Services account ID are returned. However, AMIs that are shared with the account’s organization or organizational unit (OU) are not returned.
If you specify
selfor your own Amazon Web Services account ID, AMIs shared with your account are returned. In addition, AMIs that are shared with the organization or OU of which you are member are also returned.If you specify
all, all public AMIs are returned.
-
:image_ids
(Array<String>)
—
The image IDs.
Default: Describes all images available to you.
-
:owners
(Array<String>)
—
Scopes the results to images with the specified owners. You can specify a combination of Amazon Web Services account IDs,
self,amazon,aws-backup-vault, andaws-marketplace. If you omit this parameter, the results include all images for which you have launch permissions, regardless of ownership. -
:include_deprecated
(Boolean)
—
Specifies whether to include deprecated AMIs.
Default: No deprecated AMIs are included in the response.
If you are the AMI owner, all deprecated AMIs appear in the response regardless of what you specify for this parameter. -
:include_disabled
(Boolean)
—
Specifies whether to include disabled AMIs.
Default: No disabled AMIs are included in the response.
-
: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 isUnauthorizedOperation. -
:filters
(Array<Types::Filter>)
—
The filters.
architecture- The image architecture (i386|x86_64|arm64|x86_64_mac|arm64_mac).block-device-mapping.delete-on-termination- A Boolean value that indicates whether the Amazon EBS volume is deleted on instance termination.block-device-mapping.device-name- The device name specified in the block device mapping (for example,/dev/sdhorxvdh).block-device-mapping.snapshot-id- The ID of the snapshot used for the Amazon EBS volume.block-device-mapping.volume-size- The volume size of the Amazon EBS volume, in GiB.block-device-mapping.volume-type- The volume type of the Amazon EBS volume (io1|io2|gp2|gp3|sc1|st1|standard).block-device-mapping.encrypted- A Boolean that indicates whether the Amazon EBS volume is encrypted.creation-date- The time when the image was created, in the ISO 8601 format in the UTC time zone (YYYY-MM-DDThh:mm:ss.sssZ), for example,2021-09-29T11:04:43.305Z. You can use a wildcard (*), for example,2021-09-29T*, which matches an entire day.description- The description of the image (provided during image creation).ena-support- A Boolean that indicates whether enhanced networking with ENA is enabled.free-tier-eligible- A Boolean that indicates whether this image can be used under the Amazon Web Services Free Tier (true|false).hypervisor- The hypervisor type (ovm|xen).image-allowed- A Boolean that indicates whether the image meets the criteria specified for Allowed AMIs.image-id- The ID of the image.image-type- The image type (machine|kernel|ramdisk).is-public- A Boolean that indicates whether the image is public.kernel-id- The kernel ID.manifest-location- The location of the image manifest.name- The name of the AMI (provided during image creation).owner-alias- The owner alias (amazon|aws-backup-vault|aws-marketplace). The valid aliases are defined in an Amazon-maintained list. This is not the Amazon Web Services account alias that can be set using the IAM console. We recommend that you use the Owner request parameter instead of this filter.owner-id- The Amazon Web Services account ID of the owner. We recommend that you use the Owner request parameter instead of this filter.platform- The platform. The only supported value iswindows.product-code- The product code.product-code.type- The type of the product code (marketplace).ramdisk-id- The RAM disk ID.root-device-name- The device name of the root device volume (for example,/dev/sda1).root-device-type- The type of the root device volume (ebs|instance-store).source-image-id- The ID of the source AMI from which the AMI was created.source-image-region- The Region of the source AMI.source-instance-id- The ID of the instance that the AMI was created from if the AMI was created using CreateImage. This filter is applicable only if the AMI was created using CreateImage.state- The state of the image (available|pending|failed).state-reason-code- The reason code for the state change.state-reason-message- The message for the state change.sriov-net-support- A value ofsimpleindicates that enhanced networking with the Intel 82599 VF interface is enabled.tag:<key>- The key/value combination of a tag assigned to the resource. Use the tag key in the filter name and the tag value as the filter value. For example, to find all resources that have a tag with the keyOwnerand the valueTeamA, specifytag:Ownerfor the filter name andTeamAfor the filter value.tag-key- The key of a tag assigned to the resource. Use this filter to find all resources assigned a tag with a specific key, regardless of the tag value.virtualization-type- The virtualization type (paravirtual|hvm).
Returns:
2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 2539 def images(options = {}) batches = Enumerator.new do |y| resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.describe_images(options) end resp.each_page do |page| batch = [] page.data.images.each do |i| batch << Image.new( id: i.image_id, data: i, client: @client ) end y.yield(batch) end end Image::Collection.new(batches) end |
#import_key_pair(options = {}) ⇒ KeyPairInfo
Examples:
Request syntax with placeholder values
Request syntax with placeholder values
keypairinfo = ec2.import_key_pair({
tag_specifications: [
{
resource_type: "capacity-reservation", # accepts capacity-reservation, client-vpn-endpoint, customer-gateway, carrier-gateway, coip-pool, declarative-policies-report, dedicated-host, dhcp-options, egress-only-internet-gateway, elastic-ip, elastic-gpu, export-image-task, export-instance-task, fleet, fpga-image, host-reservation, image, image-usage-report, import-image-task, import-snapshot-task, instance, instance-event-window, internet-gateway, ipam, ipam-pool, ipam-scope, ipv4pool-ec2, ipv6pool-ec2, key-pair, launch-template, local-gateway, local-gateway-route-table, local-gateway-virtual-interface, local-gateway-virtual-interface-group, local-gateway-route-table-vpc-association, local-gateway-route-table-virtual-interface-group-association, natgateway, network-acl, network-interface, network-insights-analysis, network-insights-path, network-insights-access-scope, network-insights-access-scope-analysis, outpost-lag, placement-group, prefix-list, replace-root-volume-task, reserved-instances, route-table, security-group, security-group-rule, service-link-virtual-interface, snapshot, spot-fleet-request, spot-instances-request, subnet, subnet-cidr-reservation, traffic-mirror-filter, traffic-mirror-session, traffic-mirror-target, transit-gateway, transit-gateway-attachment, transit-gateway-connect-peer, transit-gateway-multicast-domain, transit-gateway-policy-table, transit-gateway-metering-policy, transit-gateway-route-table, transit-gateway-route-table-announcement, volume, vpc, vpc-endpoint, vpc-endpoint-connection, vpc-endpoint-service, vpc-endpoint-service-permission, vpc-peering-connection, vpn-connection, vpn-gateway, vpc-flow-log, capacity-reservation-fleet, traffic-mirror-filter-rule, vpc-endpoint-connection-device-type, verified-access-instance, verified-access-group, verified-access-endpoint, verified-access-policy, verified-access-trust-provider, vpn-connection-device-type, vpc-block-public-access-exclusion, vpc-encryption-control, route-server, route-server-endpoint, route-server-peer, ipam-resource-discovery, ipam-resource-discovery-association, instance-connect-endpoint, verified-access-endpoint-target, ipam-external-resource-verification-token, capacity-block, mac-modification-task, ipam-prefix-list-resolver, ipam-policy, ipam-prefix-list-resolver-target, capacity-manager-data-export, vpn-concentrator
tags: [
{
key: "String",
value: "String",
},
],
},
],
dry_run: false,
key_name: "String", # required
public_key_material: "data", # required
})
Parameters:
-
options
(Hash)
(defaults to: {})
—
({})
Options Hash (options):
-
:tag_specifications
(Array<Types::TagSpecification>)
—
The tags to apply to the imported key pair.
-
: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 isUnauthorizedOperation. -
:key_name
(required, String)
—
A unique name for the key pair.
-
:public_key_material
(required, String, StringIO, File)
—
The public key.
Returns:
1978 1979 1980 1981 1982 1983 1984 1985 1986 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 1978 def import_key_pair(options = {}) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.import_key_pair(options) end KeyPairInfo.new( name: resp.data.key_name, client: @client ) end |
#instance(id) ⇒ Instance
2561 2562 2563 2564 2565 2566 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 2561 def instance(id) Instance.new( id: id, client: @client ) end |
#instances(options = {}) ⇒ Instance::Collection
Examples:
Request syntax with placeholder values
Request syntax with placeholder values
instances = ec2.instances({
instance_ids: ["InstanceId"],
dry_run: false,
filters: [
{
name: "String",
values: ["String"],
},
],
})
Parameters:
-
options
(Hash)
(defaults to: {})
—
({})
Options Hash (options):
-
:instance_ids
(Array<String>)
—
The instance IDs.
Default: Describes all your instances.
-
:dry_run
(Boolean)
—
Checks whether you have the required permissions for the operation, without actually making the request, and provides an error response. If you have the required permissions, the error response is
DryRunOperation. Otherwise, it isUnauthorizedOperation. -
:filters
(Array<Types::Filter>)
—
The filters.
affinity- The affinity setting for an instance running on a Dedicated Host (default|host).architecture- The instance architecture (i386|x86_64|arm64).availability-zone- The Availability Zone of the instance.availability-zone-id- The ID of the Availability Zone of the instance.block-device-mapping.attach-time- The attach time for an EBS volume mapped to the instance, for example,2022-09-15T17:15:20.000Z.block-device-mapping.delete-on-termination- A Boolean that indicates whether the EBS volume is deleted on instance termination.block-device-mapping.device-name- The device name specified in the block device mapping (for example,/dev/sdhorxvdh).block-device-mapping.status- The status for the EBS volume (attaching|attached|detaching|detached).block-device-mapping.volume-id- The volume ID of the EBS volume.boot-mode- The boot mode that was specified by the AMI (legacy-bios|uefi|uefi-preferred).capacity-reservation-id- The ID of the Capacity Reservation into which the instance was launched.capacity-reservation-specification.capacity-reservation-preference- The instance's Capacity Reservation preference (
open|none).
- The instance's Capacity Reservation preference (
capacity-reservation-specification.capacity-reservation-target.capacity-reservation-id- The ID of the targeted Capacity Reservation.
capacity-reservation-specification.capacity-reservation-target.capacity-reservation-resource-group-arn- The ARN of the targeted Capacity Reservation group.
client-token- The idempotency token you provided when you launched the instance.current-instance-boot-mode- The boot mode that is used to launch the instance at launch or start (legacy-bios|uefi).dns-name- The public DNS name of the instance.ebs-optimized- A Boolean that indicates whether the instance is optimized for Amazon EBS I/O.ena-support- A Boolean that indicates whether the instance is enabled for enhanced networking with ENA.enclave-options.enabled- A Boolean that indicates whether the instance is enabled for Amazon Web Services Nitro Enclaves.hibernation-options.configured- A Boolean that indicates whether the instance is enabled for hibernation. A value oftruemeans that the instance is enabled for hibernation.host-id- The ID of the Dedicated Host on which the instance is running, if applicable.hypervisor- The hypervisor type of the instance (ovm|xen). The valuexenis used for both Xen and Nitro hypervisors.iam-instance-profile.arn- The instance profile associated with the instance. Specified as an ARN.iam-instance-profile.id- The instance profile associated with the instance. Specified as an ID.image-id- The ID of the image used to launch the instance.instance-id- The ID of the instance.instance-lifecycle- Indicates whether this is a Spot Instance, a Scheduled Instance, or a Capacity Block (spot|scheduled|capacity-block).instance-state-code- The state of the instance, as a 16-bit unsigned integer. The high byte is used for internal purposes and should be ignored. The low byte is set based on the state represented. The valid values are: 0 (pending), 16 (running), 32 (shutting-down), 48 (terminated), 64 (stopping), and 80 (stopped).instance-state-name- The state of the instance (pending|running|shutting-down|terminated|stopping|stopped).instance-type- The type of instance (for example,t2.micro).instance.group-id- The ID of the security group for the instance.instance.group-name- The name of the security group for the instance.ip-address- The public IPv4 address of the instance.ipv6-address- The IPv6 address of the instance.kernel-id- The kernel ID.key-name- The name of the key pair used when the instance was launched.launch-index- When launching multiple instances, this is the index for the instance in the launch group (for example, 0, 1, 2, and so on).launch-time- The time when the instance was launched, in the ISO 8601 format in the UTC time zone (YYYY-MM-DDThh:mm:ss.sssZ), for example,2021-09-29T11:04:43.305Z. You can use a wildcard (*), for example,2021-09-29T*, which matches an entire day.maintenance-options.auto-recovery- The current automatic recovery behavior of the instance (disabled|default).metadata-options.http-endpoint- The status of access to the HTTP metadata endpoint on your instance (enabled|disabled)metadata-options.http-protocol-ipv4- Indicates whether the IPv4 endpoint is enabled (disabled|enabled).metadata-options.http-protocol-ipv6- Indicates whether the IPv6 endpoint is enabled (disabled|enabled).metadata-options.http-put-response-hop-limit- The HTTP metadata request put response hop limit (integer, possible values1to64)metadata-options.http-tokens- The metadata request authorization state (optional|required)metadata-options.instance-metadata-tags- The status of access to instance tags from the instance metadata (enabled|disabled)metadata-options.state- The state of the metadata option changes (pending|applied).monitoring-state- Indicates whether detailed monitoring is enabled (disabled|enabled).network-interface.addresses.association.allocation-id- The allocation ID.network-interface.addresses.association.association-id- The association ID.network-interface.addresses.association.carrier-ip- The carrier IP address.network-interface.addresses.association.customer-owned-ip- The customer-owned IP address.network-interface.addresses.association.ip-owner-id- The owner ID of the private IPv4 address associated with the network interface.network-interface.addresses.association.public-dns-name- The public DNS name.network-interface.addresses.association.public-ip- The ID of the association of an Elastic IP address (IPv4) with a network interface.network-interface.addresses.primary- Specifies whether the IPv4 address of the network interface is the primary private IPv4 address.network-interface.addresses.private-dns-name- The private DNS name.network-interface.addresses.private-ip-address- The private IPv4 address associated with the network interface.network-interface.association.allocation-id- The allocation ID returned when you allocated the Elastic IP address (IPv4) for your network interface.network-interface.association.association-id- The association ID returned when the network interface was associated with an IPv4 address.network-interface.association.carrier-ip- The customer-owned IP address.network-interface.association.customer-owned-ip- The customer-owned IP address.network-interface.association.ip-owner-id- The owner of the Elastic IP address (IPv4) associated with the network interface.network-interface.association.public-dns-name- The public DNS name.network-interface.association.public-ip- The address of the Elastic IP address (IPv4) bound to the network interface.network-interface.attachment.attach-time- The time that the network interface was attached to an instance.network-interface.attachment.attachment-id- The ID of the interface attachment.network-interface.attachment.delete-on-termination- Specifies whether the attachment is deleted when an instance is terminated.network-interface.attachment.device-index- The device index to which the network interface is attached.network-interface.attachment.instance-id- The ID of the instance to which the network interface is attached.network-interface.attachment.instance-owner-id- The owner ID of the instance to which the network interface is attached.network-interface.attachment.network-card-index- The index of the network card.network-interface.attachment.status- The status of the attachment (attaching|attached|detaching|detached).network-interface.availability-zone- The Availability Zone for the network interface.network-interface.deny-all-igw-traffic- A Boolean that indicates whether a network interface with an IPv6 address is unreachable from the public internet.network-interface.description- The description of the network interface.network-interface.group-id- The ID of a security group associated with the network interface.network-interface.group-name- The name of a security group associated with the network interface.network-interface.ipv4-prefixes.ipv4-prefix- The IPv4 prefixes that are assigned to the network interface.network-interface.ipv6-address- The IPv6 address associated with the network interface.network-interface.ipv6-addresses.ipv6-address- The IPv6 address associated with the network interface.network-interface.ipv6-addresses.is-primary-ipv6- A Boolean that indicates whether this is the primary IPv6 address.network-interface.ipv6-native- A Boolean that indicates whether this is an IPv6 only network interface.network-interface.ipv6-prefixes.ipv6-prefix- The IPv6 prefix assigned to the network interface.network-interface.mac-address- The MAC address of the network interface.network-interface.network-interface-id- The ID of the network interface.network-interface.operator.managed- A Boolean that indicates whether the instance has a managed network interface.network-interface.operator.principal- The principal that manages the network interface. Only valid for instances with managed network interfaces, wheremanagedistrue.network-interface.outpost-arn- The ARN of the Outpost.network-interface.owner-id- The ID of the owner of the network interface.network-interface.private-dns-name- The private DNS name of the network interface.network-interface.private-ip-address- The private IPv4 address.network-interface.public-dns-name- The public DNS name.network-interface.requester-id- The requester ID for the network interface.network-interface.requester-managed- Indicates whether the network interface is being managed by Amazon Web Services.network-interface.status- The status of the network interface (available) |in-use).network-interface.source-dest-check- Whether the network interface performs source/destination checking. A value oftruemeans that checking is enabled, andfalsemeans that checking is disabled. The value must befalsefor the network interface to perform network address translation (NAT) in your VPC.network-interface.subnet-id- The ID of the subnet for the network interface.network-interface.tag-key- The key of a tag assigned to the network interface.network-interface.tag-value- The value of a tag assigned to the network interface.network-interface.vpc-id- The ID of the VPC for the network interface.network-performance-options.bandwidth-weighting- Where the performance boost is applied, if applicable. Valid values:default,vpc-1,ebs-1.operator.managed- A Boolean that indicates whether this is a managed instance.operator.principal- The principal that manages the instance. Only valid for managed instances, wheremanagedistrue.outpost-arn- The Amazon Resource Name (ARN) of the Outpost.owner-id- The Amazon Web Services account ID of the instance owner.placement-group-name- The name of the placement group for the instance.placement-partition-number- The partition in which the instance is located.platform- The platform. To list only Windows instances, usewindows.platform-details- The platform (Linux/UNIX|Red Hat BYOL Linux|Red Hat Enterprise Linux|Red Hat Enterprise Linux with HA|Red Hat Enterprise Linux with High Availability|Red Hat Enterprise Linux with SQL Server Standard and HA|Red Hat Enterprise Linux with SQL Server Enterprise and HA|Red Hat Enterprise Linux with SQL Server Standard|Red Hat Enterprise Linux with SQL Server Web|Red Hat Enterprise Linux with SQL Server Enterprise|SQL Server Enterprise|SQL Server Standard|SQL Server Web|SUSE Linux|Ubuntu Pro|Windows|Windows BYOL|Windows with SQL Server Enterprise|Windows with SQL Server Standard|Windows with SQL Server Web).private-dns-name- The private IPv4 DNS name of the instance.private-dns-name-options.enable-resource-name-dns-a-record- A Boolean that indicates whether to respond to DNS queries for instance hostnames with DNS A records.private-dns-name-options.enable-resource-name-dns-aaaa-record- A Boolean that indicates whether to respond to DNS queries for instance hostnames with DNS AAAA records.private-dns-name-options.hostname-type- The type of hostname (ip-name|resource-name).private-ip-address- The private IPv4 address of the instance. This can only be used to filter by the primary IP address of the network interface attached to the instance. To filter by additional IP addresses assigned to the network interface, use the filternetwork-interface.addresses.private-ip-address.product-code- The product code associated with the AMI used to launch the instance.product-code.type- The type of product code (devpay|marketplace).ramdisk-id- The RAM disk ID.reason- The reason for the current state of the instance (for example, shows "User Initiated [date]" when you stop or terminate the instance). Similar to the state-reason-code filter.requester-id- The ID of the entity that launched the instance on your behalf (for example, Amazon Web Services Management Console, Amazon EC2 Auto Scaling, and so on).reservation-id- The ID of the instance's reservation. A reservation ID is created any time you launch an instance. A reservation ID has a one-to-one relationship with an instance launch request, but can be associated with more than one instance if you launch multiple instances using the same launch request. For example, if you launch one instance, you get one reservation ID. If you launch ten instances using the same launch request, you also get one reservation ID.root-device-name- The device name of the root device volume (for example,/dev/sda1).root-device-type- The type of the root device volume (ebs|instance-store).source-dest-check- Indicates whether the instance performs source/destination checking. A value oftruemeans that checking is enabled, andfalsemeans that checking is disabled. The value must befalsefor the instance to perform network address translation (NAT) in your VPC.spot-instance-request-id- The ID of the Spot Instance request.state-reason-code- The reason code for the state change.state-reason-message- A message that describes the state change.subnet-id- The ID of the subnet for the instance.tag:<key>- The key/value combination of a tag assigned to the resource. Use the tag key in the filter name and the tag value as the filter value. For example, to find all resources that have a tag with the keyOwnerand the valueTeamA, specifytag:Ownerfor the filter name andTeamAfor the filter value.tag-key- The key of a tag assigned to the resource. Use this filter to find all resources that have a tag with a specific key, regardless of the tag value.tenancy- The tenancy of an instance (dedicated|default|host).tpm-support- Indicates if the instance is configured for NitroTPM support (v2.0).usage-operation- The usage operation value for the instance (RunInstances|RunInstances:00g0|RunInstances:0010|RunInstances:1010|RunInstances:1014|RunInstances:1110|RunInstances:0014|RunInstances:0210|RunInstances:0110|RunInstances:0100|RunInstances:0004|RunInstances:0200|RunInstances:000g|RunInstances:0g00|RunInstances:0002|RunInstances:0800|RunInstances:0102|RunInstances:0006|RunInstances:0202).usage-operation-update-time- The time that the usage operation was last updated, for example,2022-09-15T17:15:20.000Z.virtualization-type- The virtualization type of the instance (paravirtual|hvm).vpc-id- The ID of the VPC that the instance is running in.
Returns:
3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 3038 def instances(options = {}) batches = Enumerator.new do |y| resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.describe_instances(options) end resp.each_page do |page| batch = [] page.data.reservations.each do |r| r.instances.each do |i| batch << Instance.new( id: i.instance_id, data: i, client: @client ) end end y.yield(batch) end end Instance::Collection.new(batches) end |
#internet_gateway(id) ⇒ InternetGateway
3062 3063 3064 3065 3066 3067 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 3062 def internet_gateway(id) InternetGateway.new( id: id, client: @client ) end |
#internet_gateways(options = {}) ⇒ InternetGateway::Collection
Examples:
Request syntax with placeholder values
Request syntax with placeholder values
internet_gateways = ec2.internet_gateways({
dry_run: false,
internet_gateway_ids: ["InternetGatewayId"],
filters: [
{
name: "String",
values: ["String"],
},
],
})
Parameters:
-
options
(Hash)
(defaults to: {})
—
({})
Options Hash (options):
-
:dry_run
(Boolean)
—
Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is
DryRunOperation. Otherwise, it isUnauthorizedOperation. -
:internet_gateway_ids
(Array<String>)
—
The IDs of the internet gateways.
Default: Describes all your internet gateways.
-
:filters
(Array<Types::Filter>)
—
The filters.
attachment.state- The current state of the attachment between the gateway and the VPC (available). Present only if a VPC is attached.attachment.vpc-id- The ID of an attached VPC.internet-gateway-id- The ID of the Internet gateway.owner-id- The ID of the Amazon Web Services account that owns the internet gateway.tag- The key/value combination of a tag assigned to the resource. Use the tag key in the filter name and the tag value as the filter value. For example, to find all resources that have a tag with the keyOwnerand the valueTeamA, specifytag:Ownerfor the filter name andTeamAfor the filter value.tag-key- The key of a tag assigned to the resource. Use this filter to find all resources assigned a tag with a specific key, regardless of the tag value.
Returns:
3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 3115 def internet_gateways(options = {}) batches = Enumerator.new do |y| resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.describe_internet_gateways(options) end resp.each_page do |page| batch = [] page.data.internet_gateways.each do |i| batch << InternetGateway.new( id: i.internet_gateway_id, data: i, client: @client ) end y.yield(batch) end end InternetGateway::Collection.new(batches) end |
#key_pair(name) ⇒ KeyPairInfo
3137 3138 3139 3140 3141 3142 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 3137 def key_pair(name) KeyPairInfo.new( name: name, client: @client ) end |
#key_pairs(options = {}) ⇒ KeyPairInfo::Collection
Examples:
Request syntax with placeholder values
Request syntax with placeholder values
key_pairs = ec2.key_pairs({
key_names: ["KeyPairName"],
key_pair_ids: ["KeyPairId"],
include_public_key: false,
dry_run: false,
filters: [
{
name: "String",
values: ["String"],
},
],
})
Parameters:
-
options
(Hash)
(defaults to: {})
—
({})
Options Hash (options):
-
:key_names
(Array<String>)
—
The key pair names.
Default: Describes all of your key pairs.
-
:key_pair_ids
(Array<String>)
—
The IDs of the key pairs.
-
:include_public_key
(Boolean)
—
If
true, the public key material is included in the response.Default:
false -
: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 isUnauthorizedOperation. -
:filters
(Array<Types::Filter>)
—
The filters.
key-pair-id- The ID of the key pair.fingerprint- The fingerprint of the key pair.key-name- The name of the key pair.tag-key- The key of a tag assigned to the resource. Use this filter to find all resources assigned a tag with a specific key, regardless of the tag value.tag:<key> - The key/value combination of a tag assigned to the resource. Use the tag key in the filter name and the tag value as the filter value. For example, to find all resources that have a tag with the keyOwnerand the valueTeamA, specifytag:Ownerfor the filter name andTeamAfor the filter value.
Returns:
3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 3193 def key_pairs(options = {}) batches = Enumerator.new do |y| batch = [] resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.describe_key_pairs(options) end resp.data.key_pairs.each do |k| batch << KeyPairInfo.new( name: k.key_name, data: k, client: @client ) end y.yield(batch) end KeyPairInfo::Collection.new(batches) end |
#nat_gateway(id) ⇒ NatGateway
3213 3214 3215 3216 3217 3218 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 3213 def nat_gateway(id) NatGateway.new( id: id, client: @client ) end |
#nat_gateways(options = {}) ⇒ NatGateway::Collection
Examples:
Request syntax with placeholder values
Request syntax with placeholder values
nat_gateways = ec2.nat_gateways({
dry_run: false,
filter: [
{
name: "String",
values: ["String"],
},
],
nat_gateway_ids: ["NatGatewayId"],
})
Parameters:
-
options
(Hash)
(defaults to: {})
—
({})
Options Hash (options):
-
:dry_run
(Boolean)
—
Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is
DryRunOperation. Otherwise, it isUnauthorizedOperation. -
:filter
(Array<Types::Filter>)
—
The filters.
nat-gateway-id- The ID of the NAT gateway.state- The state of the NAT gateway (pending|failed|available|deleting|deleted).subnet-id- The ID of the subnet in which the NAT gateway resides.tag- The key/value combination of a tag assigned to the resource. Use the tag key in the filter name and the tag value as the filter value. For example, to find all resources that have a tag with the keyOwnerand the valueTeamA, specifytag:Ownerfor the filter name andTeamAfor the filter value.tag-key- The key of a tag assigned to the resource. Use this filter to find all resources assigned a tag with a specific key, regardless of the tag value.vpc-id- The ID of the VPC in which the NAT gateway resides.
-
:nat_gateway_ids
(Array<String>)
—
The IDs of the NAT gateways.
Returns:
3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 3262 def nat_gateways(options = {}) batches = Enumerator.new do |y| resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.describe_nat_gateways(options) end resp.each_page do |page| batch = [] page.data.nat_gateways.each do |n| batch << NatGateway.new( id: n.nat_gateway_id, data: n, client: @client ) end y.yield(batch) end end NatGateway::Collection.new(batches) end |
#network_acl(id) ⇒ NetworkAcl
3284 3285 3286 3287 3288 3289 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 3284 def network_acl(id) NetworkAcl.new( id: id, client: @client ) end |
#network_acls(options = {}) ⇒ NetworkAcl::Collection
Examples:
Request syntax with placeholder values
Request syntax with placeholder values
network_acls = ec2.network_acls({
dry_run: false,
network_acl_ids: ["NetworkAclId"],
filters: [
{
name: "String",
values: ["String"],
},
],
})
Parameters:
-
options
(Hash)
(defaults to: {})
—
({})
Options Hash (options):
-
:dry_run
(Boolean)
—
Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is
DryRunOperation. Otherwise, it isUnauthorizedOperation. -
:network_acl_ids
(Array<String>)
—
The IDs of the network ACLs.
-
:filters
(Array<Types::Filter>)
—
The filters.
association.association-id- The ID of an association ID for the ACL.association.network-acl-id- The ID of the network ACL involved in the association.association.subnet-id- The ID of the subnet involved in the association.default- Indicates whether the ACL is the default network ACL for the VPC.entry.cidr- The IPv4 CIDR range specified in the entry.entry.icmp.code- The ICMP code specified in the entry, if any.entry.icmp.type- The ICMP type specified in the entry, if any.entry.ipv6-cidr- The IPv6 CIDR range specified in the entry.entry.port-range.from- The start of the port range specified in the entry.entry.port-range.to- The end of the port range specified in the entry.entry.protocol- The protocol specified in the entry (tcp|udp|icmpor a protocol number).entry.rule-action- Allows or denies the matching traffic (allow|deny).entry.egress- A Boolean that indicates the type of rule. Specifytruefor egress rules, orfalsefor ingress rules.entry.rule-number- The number of an entry (in other words, rule) in the set of ACL entries.network-acl-id- The ID of the network ACL.owner-id- The ID of the Amazon Web Services account that owns the network ACL.tag- The key/value combination of a tag assigned to the resource. Use the tag key in the filter name and the tag value as the filter value. For example, to find all resources that have a tag with the keyOwnerand the valueTeamA, specifytag:Ownerfor the filter name andTeamAfor the filter value.tag-key- The key of a tag assigned to the resource. Use this filter to find all resources assigned a tag with a specific key, regardless of the tag value.vpc-id- The ID of the VPC for the network ACL.
Returns:
3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 3369 def network_acls(options = {}) batches = Enumerator.new do |y| resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.describe_network_acls(options) end resp.each_page do |page| batch = [] page.data.network_acls.each do |n| batch << NetworkAcl.new( id: n.network_acl_id, data: n, client: @client ) end y.yield(batch) end end NetworkAcl::Collection.new(batches) end |
#network_interface(id) ⇒ NetworkInterface
3391 3392 3393 3394 3395 3396 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 3391 def network_interface(id) NetworkInterface.new( id: id, client: @client ) end |
#network_interfaces(options = {}) ⇒ NetworkInterface::Collection
Examples:
Request syntax with placeholder values
Request syntax with placeholder values
network_interfaces = ec2.network_interfaces({
dry_run: false,
network_interface_ids: ["NetworkInterfaceId"],
filters: [
{
name: "String",
values: ["String"],
},
],
})
Parameters:
-
options
(Hash)
(defaults to: {})
—
({})
Options Hash (options):
-
:dry_run
(Boolean)
—
Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is
DryRunOperation. Otherwise, it isUnauthorizedOperation. -
:network_interface_ids
(Array<String>)
—
The network interface IDs.
Default: Describes all your network interfaces.
-
:filters
(Array<Types::Filter>)
—
One or more filters.
association.allocation-id- The allocation ID returned when you allocated the Elastic IP address (IPv4) for your network interface.association.association-id- The association ID returned when the network interface was associated with an IPv4 address.addresses.association.owner-id- The owner ID of the addresses associated with the network interface.addresses.association.public-ip- The association ID returned when the network interface was associated with the Elastic IP address (IPv4).addresses.primary- Whether the private IPv4 address is the primary IP address associated with the network interface.addresses.private-ip-address- The private IPv4 addresses associated with the network interface.association.ip-owner-id- The owner of the Elastic IP address (IPv4) associated with the network interface.association.public-ip- The address of the Elastic IP address (IPv4) bound to the network interface.association.public-dns-name- The public DNS name for the network interface (IPv4).attachment.attach-time- The time that the network interface was attached to an instance.attachment.attachment-id- The ID of the interface attachment.attachment.delete-on-termination- Indicates whether the attachment is deleted when an instance is terminated.attachment.device-index- The device index to which the network interface is attached.attachment.instance-id- The ID of the instance to which the network interface is attached.attachment.instance-owner-id- The owner ID of the instance to which the network interface is attached.attachment.status- The status of the attachment (attaching|attached|detaching|detached).availability-zone- The Availability Zone of the network interface.availability-zone-id- The ID of the Availability Zone of the network interface.description- The description of the network interface.group-id- The ID of a security group associated with the network interface.ipv6-addresses.ipv6-address- An IPv6 address associated with the network interface.interface-type- The type of network interface (api_gateway_managed|aws_codestar_connections_managed|branch|ec2_instance_connect_endpoint|efa|efa-only|efs|evs|gateway_load_balancer|gateway_load_balancer_endpoint|global_accelerator_managed|interface|iot_rules_managed|lambda|load_balancer|nat_gateway|network_load_balancer|quicksight|transit_gateway|trunk|vpc_endpoint).mac-address- The MAC address of the network interface.network-interface-id- The ID of the network interface.operator.managed- A Boolean that indicates whether this is a managed network interface.operator.principal- The principal that manages the network interface. Only valid for managed network interfaces, wheremanagedistrue.owner-id- The Amazon Web Services account ID of the network interface owner.private-dns-name- The private DNS name of the network interface (IPv4).private-ip-address- The private IPv4 address or addresses of the network interface.requester-id- The alias or Amazon Web Services account ID of the principal or service that created the network interface.requester-managed- Indicates whether the network interface is being managed by an Amazon Web Services service (for example, Amazon Web Services Management Console, Auto Scaling, and so on).source-dest-check- Indicates whether the network interface performs source/destination checking. A value oftruemeans checking is enabled, andfalsemeans checking is disabled. The value must befalsefor the network interface to perform network address translation (NAT) in your VPC.status- The status of the network interface. If the network interface is not attached to an instance, the status isavailable; if a network interface is attached to an instance the status isin-use.subnet-id- The ID of the subnet for the network interface.tag:<key> - The key/value combination of a tag assigned to the resource. Use the tag key in the filter name and the tag value as the filter value. For example, to find all resources that have a tag with the keyOwnerand the valueTeamA, specifytag:Ownerfor the filter name andTeamAfor the filter value.tag-key- The key of a tag assigned to the resource. Use this filter to find all resources assigned a tag with a specific key, regardless of the tag value.vpc-id- The ID of the VPC for the network interface.
Returns:
3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 3546 def network_interfaces(options = {}) batches = Enumerator.new do |y| resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.describe_network_interfaces(options) end resp.each_page do |page| batch = [] page.data.network_interfaces.each do |n| batch << NetworkInterface.new( id: n.network_interface_id, data: n, client: @client ) end y.yield(batch) end end NetworkInterface::Collection.new(batches) end |
#placement_group(name) ⇒ PlacementGroup
3568 3569 3570 3571 3572 3573 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 3568 def placement_group(name) PlacementGroup.new( name: name, client: @client ) end |
#placement_groups(options = {}) ⇒ PlacementGroup::Collection
Examples:
Request syntax with placeholder values
Request syntax with placeholder values
placement_groups = ec2.placement_groups({
group_ids: ["PlacementGroupId"],
dry_run: false,
group_names: ["PlacementGroupName"],
filters: [
{
name: "String",
values: ["String"],
},
],
})
Parameters:
-
options
(Hash)
(defaults to: {})
—
({})
Options Hash (options):
-
:group_ids
(Array<String>)
—
The IDs of the placement groups.
-
:dry_run
(Boolean)
—
Checks whether you have the required permissions for the operation, without actually making the request, and provides an error response. If you have the required permissions, the error response is
DryRunOperation. Otherwise, it isUnauthorizedOperation. -
:group_names
(Array<String>)
—
The names of the placement groups.
Constraints:
You can specify a name only if the placement group is owned by your account.
If a placement group is shared with your account, specifying the name results in an error. You must use the
GroupIdparameter instead.
-
:filters
(Array<Types::Filter>)
—
The filters.
group-name- The name of the placement group.group-arn- The Amazon Resource Name (ARN) of the placement group.spread-level- The spread level for the placement group (host|rack).state- The state of the placement group (pending|available|deleting|deleted).strategy- The strategy of the placement group (cluster|spread|partition).tag:<key>- The key/value combination of a tag assigned to the resource. Use the tag key in the filter name and the tag value as the filter value. For example, to find all resources that have a tag with the keyOwnerand the valueTeamA, specifytag:Ownerfor the filter name andTeamAfor the filter value.tag-key- The key of a tag assigned to the resource. Use this filter to find all resources that have a tag with a specific key, regardless of the tag value.
Returns:
3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 3633 def placement_groups(options = {}) batches = Enumerator.new do |y| batch = [] resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.describe_placement_groups(options) end resp.data.placement_groups.each do |p| batch << PlacementGroup.new( name: p.group_name, data: p, client: @client ) end y.yield(batch) end PlacementGroup::Collection.new(batches) end |
#register_image(options = {}) ⇒ Image
Examples:
Request syntax with placeholder values
Request syntax with placeholder values
image = ec2.register_image({
image_location: "String",
billing_products: ["String"],
boot_mode: "legacy-bios", # accepts legacy-bios, uefi, uefi-preferred
tpm_support: "v2.0", # accepts v2.0
uefi_data: "StringType",
imds_support: "v2.0", # accepts v2.0
tag_specifications: [
{
resource_type: "capacity-reservation", # accepts capacity-reservation, client-vpn-endpoint, customer-gateway, carrier-gateway, coip-pool, declarative-policies-report, dedicated-host, dhcp-options, egress-only-internet-gateway, elastic-ip, elastic-gpu, export-image-task, export-instance-task, fleet, fpga-image, host-reservation, image, image-usage-report, import-image-task, import-snapshot-task, instance, instance-event-window, internet-gateway, ipam, ipam-pool, ipam-scope, ipv4pool-ec2, ipv6pool-ec2, key-pair, launch-template, local-gateway, local-gateway-route-table, local-gateway-virtual-interface, local-gateway-virtual-interface-group, local-gateway-route-table-vpc-association, local-gateway-route-table-virtual-interface-group-association, natgateway, network-acl, network-interface, network-insights-analysis, network-insights-path, network-insights-access-scope, network-insights-access-scope-analysis, outpost-lag, placement-group, prefix-list, replace-root-volume-task, reserved-instances, route-table, security-group, security-group-rule, service-link-virtual-interface, snapshot, spot-fleet-request, spot-instances-request, subnet, subnet-cidr-reservation, traffic-mirror-filter, traffic-mirror-session, traffic-mirror-target, transit-gateway, transit-gateway-attachment, transit-gateway-connect-peer, transit-gateway-multicast-domain, transit-gateway-policy-table, transit-gateway-metering-policy, transit-gateway-route-table, transit-gateway-route-table-announcement, volume, vpc, vpc-endpoint, vpc-endpoint-connection, vpc-endpoint-service, vpc-endpoint-service-permission, vpc-peering-connection, vpn-connection, vpn-gateway, vpc-flow-log, capacity-reservation-fleet, traffic-mirror-filter-rule, vpc-endpoint-connection-device-type, verified-access-instance, verified-access-group, verified-access-endpoint, verified-access-policy, verified-access-trust-provider, vpn-connection-device-type, vpc-block-public-access-exclusion, vpc-encryption-control, route-server, route-server-endpoint, route-server-peer, ipam-resource-discovery, ipam-resource-discovery-association, instance-connect-endpoint, verified-access-endpoint-target, ipam-external-resource-verification-token, capacity-block, mac-modification-task, ipam-prefix-list-resolver, ipam-policy, ipam-prefix-list-resolver-target, capacity-manager-data-export, vpn-concentrator
tags: [
{
key: "String",
value: "String",
},
],
},
],
dry_run: false,
name: "String", # required
description: "String",
architecture: "i386", # accepts i386, x86_64, arm64, x86_64_mac, arm64_mac
kernel_id: "KernelId",
ramdisk_id: "RamdiskId",
root_device_name: "String",
block_device_mappings: [
{
ebs: {
delete_on_termination: false,
iops: 1,
snapshot_id: "SnapshotId",
volume_size: 1,
volume_type: "standard", # accepts standard, io1, io2, gp2, sc1, st1, gp3
kms_key_id: "String",
throughput: 1,
outpost_arn: "String",
availability_zone: "String",
encrypted: false,
volume_initialization_rate: 1,
availability_zone_id: "String",
},
no_device: "String",
device_name: "String",
virtual_name: "String",
},
],
virtualization_type: "String",
sriov_net_support: "String",
ena_support: false,
})
Parameters:
-
options
(Hash)
(defaults to: {})
—
({})
Options Hash (options):
-
:image_location
(String)
—
The full path to your AMI manifest in Amazon S3 storage. The specified bucket must have the
aws-exec-readcanned access control list (ACL) to ensure that it can be accessed by Amazon EC2. For more information, see Canned ACL in the Amazon S3 Service Developer Guide. -
:billing_products
(Array<String>)
—
The billing product codes. Your account must be authorized to specify billing product codes.
If your account is not authorized to specify billing product codes, you can publish AMIs that include billable software and list them on the Amazon Web Services Marketplace. You must first register as a seller on the Amazon Web Services Marketplace. For more information, see Getting started as an Amazon Web Services Marketplace seller and AMI-based products in Amazon Web Services Marketplace in the Amazon Web Services Marketplace Seller Guide.
-
:boot_mode
(String)
—
The boot mode of the AMI. A value of
uefi-preferredindicates that the AMI supports both UEFI and Legacy BIOS.The operating system contained in the AMI must be configured to support the specified boot mode. For more information, see Instance launch behavior with Amazon EC2 boot modes in the Amazon EC2 User Guide.
-
:tpm_support
(String)
—
Set to
v2.0to enable Trusted Platform Module (TPM) support. For more information, see NitroTPM in the Amazon EC2 User Guide. -
:uefi_data
(String)
—
Base64 representation of the non-volatile UEFI variable store. To retrieve the UEFI data, use the GetInstanceUefiData command. You can inspect and modify the UEFI data by using the python-uefivars tool on GitHub. For more information, see UEFI Secure Boot for Amazon EC2 instances in the Amazon EC2 User Guide.
-
:imds_support
(String)
—
Set to
v2.0to indicate that IMDSv2 is specified in the AMI. Instances launched from this AMI will haveHttpTokensautomatically set torequiredso that, by default, the instance requires that IMDSv2 is used when requesting instance metadata. In addition,HttpPutResponseHopLimitis set to2. For more information, see Configure the AMI in the Amazon EC2 User Guide.If you set the value to v2.0, make sure that your AMI software can support IMDSv2. -
:tag_specifications
(Array<Types::TagSpecification>)
—
The tags to apply to the AMI.
To tag the AMI, the value for
ResourceTypemust beimage. If you specify another value forResourceType, the request fails.To tag an AMI after it has been registered, see CreateTags.
-
: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 isUnauthorizedOperation. -
:name
(required, String)
—
A name for your AMI.
Constraints: 3-128 alphanumeric characters, parentheses (()), square brackets ([]), spaces ( ), periods (.), slashes (/), dashes (-), single quotes ('), at-signs (@), or underscores(_)
-
:description
(String)
—
A description for your AMI.
-
:architecture
(String)
—
The architecture of the AMI.
Default: For Amazon EBS-backed AMIs,
i386. For instance store-backed AMIs, the architecture specified in the manifest file. -
:kernel_id
(String)
—
The ID of the kernel.
-
:ramdisk_id
(String)
—
The ID of the RAM disk.
-
:root_device_name
(String)
—
The device name of the root device volume (for example,
/dev/sda1). -
:block_device_mappings
(Array<Types::BlockDeviceMapping>)
—
The block device mapping entries.
If you specify an Amazon EBS volume using the ID of an Amazon EBS snapshot, you can't specify the encryption state of the volume.
If you create an AMI on an Outpost, then all backing snapshots must be on the same Outpost or in the Region of that Outpost. AMIs on an Outpost that include local snapshots can be used to launch instances on the same Outpost only. For more information, Create AMIs from local snapshots in the Amazon EBS User Guide.
-
:virtualization_type
(String)
—
The type of virtualization (
hvm|paravirtual).Default:
paravirtual -
:sriov_net_support
(String)
—
Set to
simpleto enable enhanced networking with the Intel 82599 Virtual Function interface for the AMI and any instances that you launch from the AMI.There is no way to disable
sriovNetSupportat this time.This option is supported only for HVM AMIs. Specifying this option with a PV AMI can make instances launched from the AMI unreachable.
-
:ena_support
(Boolean)
—
Set to
trueto enable enhanced networking with ENA for the AMI and any instances that you launch from the AMI.This option is supported only for HVM AMIs. Specifying this option with a PV AMI can make instances launched from the AMI unreachable.
Returns:
- (Image)
2186 2187 2188 2189 2190 2191 2192 2193 2194 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 2186 def register_image(options = {}) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.register_image(options) end Image.new( id: resp.data.image_id, client: @client ) end |
#route_table(id) ⇒ RouteTable
3653 3654 3655 3656 3657 3658 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 3653 def route_table(id) RouteTable.new( id: id, client: @client ) end |
#route_table_association(id) ⇒ RouteTableAssociation
3662 3663 3664 3665 3666 3667 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 3662 def route_table_association(id) RouteTableAssociation.new( id: id, client: @client ) end |
#route_tables(options = {}) ⇒ RouteTable::Collection
Examples:
Request syntax with placeholder values
Request syntax with placeholder values
route_tables = ec2.route_tables({
dry_run: false,
route_table_ids: ["RouteTableId"],
filters: [
{
name: "String",
values: ["String"],
},
],
})
Parameters:
-
options
(Hash)
(defaults to: {})
—
({})
Options Hash (options):
-
:dry_run
(Boolean)
—
Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is
DryRunOperation. Otherwise, it isUnauthorizedOperation. -
:route_table_ids
(Array<String>)
—
The IDs of the route tables.
-
:filters
(Array<Types::Filter>)
—
The filters.
association.gateway-id- The ID of the gateway involved in the association.association.route-table-association-id- The ID of an association ID for the route table.association.route-table-id- The ID of the route table involved in the association.association.subnet-id- The ID of the subnet involved in the association.association.main- Indicates whether the route table is the main route table for the VPC (true|false). Route tables that do not have an association ID are not returned in the response.owner-id- The ID of the Amazon Web Services account that owns the route table.route-table-id- The ID of the route table.route.destination-cidr-block- The IPv4 CIDR range specified in a route in the table.route.destination-ipv6-cidr-block- The IPv6 CIDR range specified in a route in the route table.route.destination-prefix-list-id- The ID (prefix) of the Amazon Web Services service specified in a route in the table.route.egress-only-internet-gateway-id- The ID of an egress-only Internet gateway specified in a route in the route table.route.gateway-id- The ID of a gateway specified in a route in the table.route.instance-id- The ID of an instance specified in a route in the table.route.nat-gateway-id- The ID of a NAT gateway.route.transit-gateway-id- The ID of a transit gateway.route.origin- Describes how the route was created.CreateRouteTableindicates that the route was automatically created when the route table was created;CreateRouteindicates that the route was manually added to the route table;EnableVgwRoutePropagationindicates that the route was propagated by route propagation.route.state- The state of a route in the route table (active|blackhole). The blackhole state indicates that the route's target isn't available (for example, the specified gateway isn't attached to the VPC, the specified NAT instance has been terminated, and so on).route.vpc-peering-connection-id- The ID of a VPC peering connection specified in a route in the table.tag- The key/value combination of a tag assigned to the resource. Use the tag key in the filter name and the tag value as the filter value. For example, to find all resources that have a tag with the keyOwnerand the valueTeamA, specifytag:Ownerfor the filter name andTeamAfor the filter value.tag-key- The key of a tag assigned to the resource. Use this filter to find all resources assigned a tag with a specific key, regardless of the tag value.vpc-id- The ID of the VPC for the route table.
Returns:
3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 3763 def route_tables(options = {}) batches = Enumerator.new do |y| resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.describe_route_tables(options) end resp.each_page do |page| batch = [] page.data.route_tables.each do |r| batch << RouteTable.new( id: r.route_table_id, data: r, client: @client ) end y.yield(batch) end end RouteTable::Collection.new(batches) end |
#security_group(id) ⇒ SecurityGroup
3785 3786 3787 3788 3789 3790 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 3785 def security_group(id) SecurityGroup.new( id: id, client: @client ) end |
#security_groups(options = {}) ⇒ SecurityGroup::Collection
Examples:
Request syntax with placeholder values
Request syntax with placeholder values
security_groups = ec2.security_groups({
group_ids: ["SecurityGroupId"],
group_names: ["SecurityGroupName"],
dry_run: false,
filters: [
{
name: "String",
values: ["String"],
},
],
})
Parameters:
-
options
(Hash)
(defaults to: {})
—
({})
Options Hash (options):
-
:group_ids
(Array<String>)
—
The IDs of the security groups. Required for security groups in a nondefault VPC.
Default: Describes all of your security groups.
-
:group_names
(Array<String>)
—
[Default VPC] The names of the security groups. You can specify either the security group name or the security group ID.
Default: Describes all of your security groups.
-
:dry_run
(Boolean)
—
Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is
DryRunOperation. Otherwise, it isUnauthorizedOperation. -
:filters
(Array<Types::Filter>)
—
The filters. If using multiple filters for rules, the results include security groups for which any combination of rules - not necessarily a single rule - match all filters.
description- The description of the security group.egress.ip-permission.cidr- An IPv4 CIDR block for an outbound security group rule.egress.ip-permission.from-port- For an outbound rule, the start of port range for the TCP and UDP protocols, or an ICMP type number.egress.ip-permission.group-id- The ID of a security group that has been referenced in an outbound security group rule.egress.ip-permission.group-name- The name of a security group that is referenced in an outbound security group rule.egress.ip-permission.ipv6-cidr- An IPv6 CIDR block for an outbound security group rule.egress.ip-permission.prefix-list-id- The ID of a prefix list to which a security group rule allows outbound access.egress.ip-permission.protocol- The IP protocol for an outbound security group rule (tcp|udp|icmp, a protocol number, or -1 for all protocols).egress.ip-permission.to-port- For an outbound rule, the end of port range for the TCP and UDP protocols, or an ICMP code.egress.ip-permission.user-id- The ID of an Amazon Web Services account that has been referenced in an outbound security group rule.group-id- The ID of the security group.group-name- The name of the security group.ip-permission.cidr- An IPv4 CIDR block for an inbound security group rule.ip-permission.from-port- For an inbound rule, the start of port range for the TCP and UDP protocols, or an ICMP type number.ip-permission.group-id- The ID of a security group that has been referenced in an inbound security group rule.ip-permission.group-name- The name of a security group that is referenced in an inbound security group rule.ip-permission.ipv6-cidr- An IPv6 CIDR block for an inbound security group rule.ip-permission.prefix-list-id- The ID of a prefix list from which a security group rule allows inbound access.ip-permission.protocol- The IP protocol for an inbound security group rule (tcp|udp|icmp, a protocol number, or -1 for all protocols).ip-permission.to-port- For an inbound rule, the end of port range for the TCP and UDP protocols, or an ICMP code.ip-permission.user-id- The ID of an Amazon Web Services account that has been referenced in an inbound security group rule.owner-id- The Amazon Web Services account ID of the owner of the security group.tag:<key> - The key/value combination of a tag assigned to the resource. Use the tag key in the filter name and the tag value as the filter value. For example, to find all resources that have a tag with the keyOwnerand the valueTeamA, specifytag:Ownerfor the filter name andTeamAfor the filter value.tag-key- The key of a tag assigned to the resource. Use this filter to find all resources assigned a tag with a specific key, regardless of the tag value.vpc-id- The ID of the VPC specified when the security group was created.
Returns:
3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 3904 def security_groups(options = {}) batches = Enumerator.new do |y| resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.describe_security_groups(options) end resp.each_page do |page| batch = [] page.data.security_groups.each do |s| batch << SecurityGroup.new( id: s.group_id, data: s, client: @client ) end y.yield(batch) end end SecurityGroup::Collection.new(batches) end |
#snapshot(id) ⇒ Snapshot
3926 3927 3928 3929 3930 3931 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 3926 def snapshot(id) Snapshot.new( id: id, client: @client ) end |
#snapshots(options = {}) ⇒ Snapshot::Collection
Examples:
Request syntax with placeholder values
Request syntax with placeholder values
snapshots = ec2.snapshots({
owner_ids: ["String"],
restorable_by_user_ids: ["String"],
snapshot_ids: ["SnapshotId"],
dry_run: false,
filters: [
{
name: "String",
values: ["String"],
},
],
})
Parameters:
-
options
(Hash)
(defaults to: {})
—
({})
Options Hash (options):
-
:owner_ids
(Array<String>)
—
Scopes the results to snapshots with the specified owners. You can specify a combination of Amazon Web Services account IDs,
self, andamazon. -
:restorable_by_user_ids
(Array<String>)
—
The IDs of the Amazon Web Services accounts that can create volumes from the snapshot.
-
:snapshot_ids
(Array<String>)
—
The snapshot IDs.
Default: Describes the snapshots for which you have create volume permissions.
-
: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 isUnauthorizedOperation. -
:filters
(Array<Types::Filter>)
—
The filters.
description- A description of the snapshot.encrypted- Indicates whether the snapshot is encrypted (true|false)owner-alias- The owner alias, from an Amazon-maintained list (amazon). This is not the user-configured Amazon Web Services account alias set using the IAM console. We recommend that you use the related parameter instead of this filter.owner-id- The Amazon Web Services account ID of the owner. We recommend that you use the related parameter instead of this filter.progress- The progress of the snapshot, as a percentage (for example, 80%).snapshot-id- The snapshot ID.start-time- The time stamp when the snapshot was initiated.status- The status of the snapshot (pending|completed|error).storage-tier- The storage tier of the snapshot (archive|standard).transfer-type- The type of operation used to create the snapshot (time-based|standard).tag:<key> - The key/value combination of a tag assigned to the resource. Use the tag key in the filter name and the tag value as the filter value. For example, to find all resources that have a tag with the keyOwnerand the valueTeamA, specifytag:Ownerfor the filter name andTeamAfor the filter value.tag-key- The key of a tag assigned to the resource. Use this filter to find all resources assigned a tag with a specific key, regardless of the tag value.volume-id- The ID of the volume the snapshot is for.volume-size- The size of the volume, in GiB.
Returns:
4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 4011 def snapshots(options = {}) batches = Enumerator.new do |y| resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.describe_snapshots(options) end resp.each_page do |page| batch = [] page.data.snapshots.each do |s| batch << Snapshot.new( id: s.snapshot_id, data: s, client: @client ) end y.yield(batch) end end Snapshot::Collection.new(batches) end |
#subnet(id) ⇒ Subnet
4033 4034 4035 4036 4037 4038 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 4033 def subnet(id) Subnet.new( id: id, client: @client ) end |
#subnets(options = {}) ⇒ Subnet::Collection
Examples:
Request syntax with placeholder values
Request syntax with placeholder values
subnets = ec2.subnets({
filters: [
{
name: "String",
values: ["String"],
},
],
subnet_ids: ["SubnetId"],
dry_run: false,
})
Parameters:
-
options
(Hash)
(defaults to: {})
—
({})
Options Hash (options):
-
:filters
(Array<Types::Filter>)
—
The filters.
availability-zone- The Availability Zone for the subnet. You can also useavailabilityZoneas the filter name.availability-zone-id- The ID of the Availability Zone for the subnet. You can also useavailabilityZoneIdas the filter name.available-ip-address-count- The number of IPv4 addresses in the subnet that are available.cidr-block- The IPv4 CIDR block of the subnet. The CIDR block you specify must exactly match the subnet's CIDR block for information to be returned for the subnet. You can also usecidrorcidrBlockas the filter names.customer-owned-ipv4-pool- The customer-owned IPv4 address pool associated with the subnet.default-for-az- Indicates whether this is the default subnet for the Availability Zone (true|false). You can also usedefaultForAzas the filter name.enable-dns64- Indicates whether DNS queries made to the Amazon-provided DNS Resolver in this subnet should return synthetic IPv6 addresses for IPv4-only destinations.enable-lni-at-device-index- Indicates the device position for local network interfaces in this subnet. For example,1indicates local network interfaces in this subnet are the secondary network interface (eth1).ipv6-cidr-block-association.ipv6-cidr-block- An IPv6 CIDR block associated with the subnet.ipv6-cidr-block-association.association-id- An association ID for an IPv6 CIDR block associated with the subnet.ipv6-cidr-block-association.state- The state of an IPv6 CIDR block associated with the subnet.ipv6-native- Indicates whether this is an IPv6 only subnet (true|false).map-customer-owned-ip-on-launch- Indicates whether a network interface created in this subnet (including a network interface created by RunInstances) receives a customer-owned IPv4 address.map-public-ip-on-launch- Indicates whether instances launched in this subnet receive a public IPv4 address.outpost-arn- The Amazon Resource Name (ARN) of the Outpost.owner-id- The ID of the Amazon Web Services account that owns the subnet.private-dns-name-options-on-launch.hostname-type- The type of hostname to assign to instances in the subnet at launch. For IPv4-only and dual-stack (IPv4 and IPv6) subnets, an instance DNS name can be based on the instance IPv4 address (ip-name) or the instance ID (resource-name). For IPv6 only subnets, an instance DNS name must be based on the instance ID (resource-name).private-dns-name-options-on-launch.enable-resource-name-dns-a-record- Indicates whether to respond to DNS queries for instance hostnames with DNS A records.
private-dns-name-options-on-launch.enable-resource-name-dns-aaaa-record- Indicates whether to respond to DNS queries for instance hostnames with DNS AAAA records.
state- The state of the subnet (pending|available).subnet-arn- The Amazon Resource Name (ARN) of the subnet.subnet-id- The ID of the subnet.tag- The key/value combination of a tag assigned to the resource. Use the tag key in the filter name and the tag value as the filter value. For example, to find all resources that have a tag with the keyOwnerand the valueTeamA, specifytag:Ownerfor the filter name andTeamAfor the filter value.tag-key- The key of a tag assigned to the resource. Use this filter to find all resources assigned a tag with a specific key, regardless of the tag value.vpc-id- The ID of the VPC for the subnet.
-
:subnet_ids
(Array<String>)
—
The IDs of the subnets.
Default: Describes all your subnets.
-
:dry_run
(Boolean)
—
Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is
DryRunOperation. Otherwise, it isUnauthorizedOperation.
Returns:
4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 4152 def subnets(options = {}) batches = Enumerator.new do |y| resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.describe_subnets(options) end resp.each_page do |page| batch = [] page.data.subnets.each do |s| batch << Subnet.new( id: s.subnet_id, data: s, client: @client ) end y.yield(batch) end end Subnet::Collection.new(batches) end |
#volume(id) ⇒ Volume
4174 4175 4176 4177 4178 4179 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 4174 def volume(id) Volume.new( id: id, client: @client ) end |
#volumes(options = {}) ⇒ Volume::Collection
Examples:
Request syntax with placeholder values
Request syntax with placeholder values
volumes = ec2.volumes({
volume_ids: ["VolumeId"],
dry_run: false,
filters: [
{
name: "String",
values: ["String"],
},
],
})
Parameters:
-
options
(Hash)
(defaults to: {})
—
({})
Options Hash (options):
-
:volume_ids
(Array<String>)
—
The volume IDs. If not specified, then all volumes are included in the response.
-
: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 isUnauthorizedOperation. -
:filters
(Array<Types::Filter>)
—
The filters.
attachment.attach-time- The time stamp when the attachment initiated.attachment.delete-on-termination- Whether the volume is deleted on instance termination.attachment.device- The device name specified in the block device mapping (for example,/dev/sda1).attachment.instance-id- The ID of the instance the volume is attached to.attachment.status- The attachment state (attaching|attached|detaching).availability-zone- The Availability Zone in which the volume was created.availability-zone-id- The ID of the Availability Zone in which the volume was created.create-time- The time stamp when the volume was created.encrypted- Indicates whether the volume is encrypted (true|false)fast-restored- Indicates whether the volume was created from a snapshot that is enabled for fast snapshot restore (true|false).multi-attach-enabled- Indicates whether the volume is enabled for Multi-Attach (true|false)operator.managed- A Boolean that indicates whether this is a managed volume.operator.principal- The principal that manages the volume. Only valid for managed volumes, wheremanagedistrue.size- The size of the volume, in GiB.snapshot-id- The snapshot from which the volume was created.status- The state of the volume (creating|available|in-use|deleting|deleted|error).tag:<key> - The key/value combination of a tag assigned to the resource. Use the tag key in the filter name and the tag value as the filter value. For example, to find all resources that have a tag with the keyOwnerand the valueTeamA, specifytag:Ownerfor the filter name andTeamAfor the filter value.tag-key- The key of a tag assigned to the resource. Use this filter to find all resources assigned a tag with a specific key, regardless of the tag value.volume-id- The volume ID.volume-type- The Amazon EBS volume type (gp2|gp3|io1|io2|st1|sc1|standard)
Returns:
4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 4266 def volumes(options = {}) batches = Enumerator.new do |y| resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.describe_volumes(options) end resp.each_page do |page| batch = [] page.data.volumes.each do |v| batch << Volume.new( id: v.volume_id, data: v, client: @client ) end y.yield(batch) end end Volume::Collection.new(batches) end |
#vpc(id) ⇒ Vpc
4288 4289 4290 4291 4292 4293 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 4288 def vpc(id) Vpc.new( id: id, client: @client ) end |
#vpc_addresses(options = {}) ⇒ VpcAddress::Collection
Examples:
Request syntax with placeholder values
Request syntax with placeholder values
vpc_addresses = ec2.vpc_addresses({
public_ips: ["String"],
dry_run: false,
filters: [
{
name: "String",
values: ["String"],
},
],
allocation_ids: ["AllocationId"],
})
Parameters:
-
options
(Hash)
(defaults to: {})
—
({})
Options Hash (options):
-
:public_ips
(Array<String>)
—
One or more Elastic IP addresses.
Default: Describes all your Elastic IP addresses.
-
: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 isUnauthorizedOperation. -
:filters
(Array<Types::Filter>)
—
One or more filters. Filter names and values are case-sensitive.
allocation-id- The allocation ID for the address.association-id- The association ID for the address.instance-id- The ID of the instance the address is associated with, if any.network-border-group- A unique set of Availability Zones, Local Zones, or Wavelength Zones from where Amazon Web Services advertises IP addresses.network-interface-id- The ID of the network interface that the address is associated with, if any.network-interface-owner-id- The Amazon Web Services account ID of the owner.private-ip-address- The private IP address associated with the Elastic IP address.public-ip- The Elastic IP address, or the carrier IP address.tag:<key> - The key/value combination of a tag assigned to the resource. Use the tag key in the filter name and the tag value as the filter value. For example, to find all resources that have a tag with the keyOwnerand the valueTeamA, specifytag:Ownerfor the filter name andTeamAfor the filter value.tag-key- The key of a tag assigned to the resource. Use this filter to find all resources assigned a tag with a specific key, regardless of the tag value.
-
:allocation_ids
(Array<String>)
—
Information about the allocation IDs.
Returns:
4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 4355 def vpc_addresses(options = {}) batches = Enumerator.new do |y| batch = [] options = Aws::Util.deep_merge(options, filters: [{ name: "domain", values: ["vpc"] }]) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.describe_addresses(options) end resp.data.addresses.each do |a| batch << VpcAddress.new( allocation_id: a.allocation_id, data: a, client: @client ) end y.yield(batch) end VpcAddress::Collection.new(batches) end |
#vpc_peering_connection(id) ⇒ VpcPeeringConnection
4379 4380 4381 4382 4383 4384 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 4379 def vpc_peering_connection(id) VpcPeeringConnection.new( id: id, client: @client ) end |
#vpc_peering_connections(options = {}) ⇒ VpcPeeringConnection::Collection
Examples:
Request syntax with placeholder values
Request syntax with placeholder values
vpc_peering_connections = ec2.vpc_peering_connections({
dry_run: false,
vpc_peering_connection_ids: ["VpcPeeringConnectionId"],
filters: [
{
name: "String",
values: ["String"],
},
],
})
Parameters:
-
options
(Hash)
(defaults to: {})
—
({})
Options Hash (options):
-
:dry_run
(Boolean)
—
Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is
DryRunOperation. Otherwise, it isUnauthorizedOperation. -
:vpc_peering_connection_ids
(Array<String>)
—
The IDs of the VPC peering connections.
Default: Describes all your VPC peering connections.
-
:filters
(Array<Types::Filter>)
—
The filters.
accepter-vpc-info.cidr-block- The IPv4 CIDR block of the accepter VPC.accepter-vpc-info.owner-id- The ID of the Amazon Web Services account that owns the accepter VPC.accepter-vpc-info.vpc-id- The ID of the accepter VPC.expiration-time- The expiration date and time for the VPC peering connection.requester-vpc-info.cidr-block- The IPv4 CIDR block of the requester's VPC.requester-vpc-info.owner-id- The ID of the Amazon Web Services account that owns the requester VPC.requester-vpc-info.vpc-id- The ID of the requester VPC.status-code- The status of the VPC peering connection (pending-acceptance|failed|expired|provisioning|active|deleting|deleted|rejected).status-message- A message that provides more information about the status of the VPC peering connection, if applicable.tag- The key/value combination of a tag assigned to the resource. Use the tag key in the filter name and the tag value as the filter value. For example, to find all resources that have a tag with the keyOwnerand the valueTeamA, specifytag:Ownerfor the filter name andTeamAfor the filter value.tag-key- The key of a tag assigned to the resource. Use this filter to find all resources assigned a tag with a specific key, regardless of the tag value.vpc-peering-connection-id- The ID of the VPC peering connection.
Returns:
4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 4449 def vpc_peering_connections(options = {}) batches = Enumerator.new do |y| resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.describe_vpc_peering_connections(options) end resp.each_page do |page| batch = [] page.data.vpc_peering_connections.each do |v| batch << VpcPeeringConnection.new( id: v.vpc_peering_connection_id, data: v, client: @client ) end y.yield(batch) end end VpcPeeringConnection::Collection.new(batches) end |
#vpcs(options = {}) ⇒ Vpc::Collection
Examples:
Request syntax with placeholder values
Request syntax with placeholder values
vpcs = ec2.vpcs({
filters: [
{
name: "String",
values: ["String"],
},
],
vpc_ids: ["VpcId"],
dry_run: false,
})
Parameters:
-
options
(Hash)
(defaults to: {})
—
({})
Options Hash (options):
-
:filters
(Array<Types::Filter>)
—
The filters.
cidr- The primary IPv4 CIDR block of the VPC. The CIDR block you specify must exactly match the VPC's CIDR block for information to be returned for the VPC. Must contain the slash followed by one or two digits (for example,/28).cidr-block-association.cidr-block- An IPv4 CIDR block associated with the VPC.cidr-block-association.association-id- The association ID for an IPv4 CIDR block associated with the VPC.cidr-block-association.state- The state of an IPv4 CIDR block associated with the VPC.dhcp-options-id- The ID of a set of DHCP options.ipv6-cidr-block-association.ipv6-cidr-block- An IPv6 CIDR block associated with the VPC.ipv6-cidr-block-association.ipv6-pool- The ID of the IPv6 address pool from which the IPv6 CIDR block is allocated.ipv6-cidr-block-association.association-id- The association ID for an IPv6 CIDR block associated with the VPC.ipv6-cidr-block-association.state- The state of an IPv6 CIDR block associated with the VPC.is-default- Indicates whether the VPC is the default VPC.owner-id- The ID of the Amazon Web Services account that owns the VPC.state- The state of the VPC (pending|available).tag- The key/value combination of a tag assigned to the resource. Use the tag key in the filter name and the tag value as the filter value. For example, to find all resources that have a tag with the keyOwnerand the valueTeamA, specifytag:Ownerfor the filter name andTeamAfor the filter value.tag-key- The key of a tag assigned to the resource. Use this filter to find all resources assigned a tag with a specific key, regardless of the tag value.vpc-id- The ID of the VPC.
-
:vpc_ids
(Array<String>)
—
The IDs of the VPCs.
-
: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 isUnauthorizedOperation.
Returns:
4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 4539 def vpcs(options = {}) batches = Enumerator.new do |y| resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.describe_vpcs(options) end resp.each_page do |page| batch = [] page.data.vpcs.each do |v| batch << Vpc.new( id: v.vpc_id, data: v, client: @client ) end y.yield(batch) end end Vpc::Collection.new(batches) end |