Amazon EC2 Ec2 Subnet API

The Ec2 Subnet API from Amazon EC2 — 3 operation(s) for ec2 subnet.

Business capability
IT Infrastructure Management BC-600.50

Operations 3

POST /?Action=CreateSubnet Create Subnet #
POST /?Action=DeleteSubnet Delete Subnet #
POST /?Action=DescribeSubnets Describe Subnets #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/amazon-ec2:amazon-ec2-subnet-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

amazon-ec2-subnet-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Amazon Elastic Compute Cloud Subnet API
  version: '2016-11-15'
  description: Generated from AWS's published Smithy model for Amazon Elastic Compute Cloud. 3 operation(s).
  contact:
    name: Amazon Web Services
    url: https://aws.amazon.com/contact-us/
  license:
    name: Apache 2.0
    identifier: Apache-2.0
    url: https://github.com/aws/api-models-aws/blob/main/LICENSE
servers:
- url: https://ec2.{region}.amazonaws.com
  variables:
    region:
      default: us-east-1
security:
- sigv4: []
tags:
- name: Subnet
paths:
  /?Action=CreateSubnet:
    post:
      operationId: CreateSubnet
      summary: Create Subnet
      description: Creates a subnet in the specified VPC. For an IPv4 only subnet, specify an IPv4 CIDR block. If the VPC has an IPv6 CIDR block, you can create an IPv6 only subnet or a dual stack subnet instead. For an IPv6 only subnet, specify an IPv6 CIDR block. For a dual stack subnet, specify both an IPv4 CIDR block and an IPv6 CIDR block. A subnet CIDR block must not overlap the CIDR block of an existing subnet in the VPC. After you create a subnet, you can't change its CIDR block. The allowed size for an IPv4 subnet is between a /28 netmask (16 IP addresses) and a /16 netmask (65,536 IP addresses). Amazon Web Services reserves both the first four and the last IPv4 address in each subnet's CIDR block. They're not available for your use. If you've associated an IPv6 CIDR block with your VPC, you can associate an IPv6 CIDR block with a subnet when you create it. If you add more than one subnet to a VPC, they're set up in a star topology with a logical router in the middle. When you stop an instance in a subnet, it retains its private IPv4 address. It's therefore possible to have a subnet with no running instances (they're all stopped), but no remaining IP addresses available. For more information
      responses:
        '200':
          description: Success
          content:
            text/xml:
              schema:
                $ref: '#/components/schemas/CreateSubnetResult'
              example:
                Subnet:
                  VpcId: vpc-a01106c2
                  CidrBlock: 10.0.1.0/24
                  State: pending
                  AvailabilityZone: us-west-2c
                  SubnetId: subnet-9d4a7b6c
                  AvailableIpAddressCount: 251
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              allOf:
              - type: object
                required:
                - Action
                - Version
                properties:
                  Action:
                    type: string
                    const: CreateSubnet
                  Version:
                    type: string
                    const: '2016-11-15'
              - $ref: '#/components/schemas/CreateSubnetRequest'
            example:
              VpcId: vpc-a01106c2
              CidrBlock: 10.0.1.0/24
      tags:
      - Subnet
  /?Action=DeleteSubnet:
    post:
      operationId: DeleteSubnet
      summary: Delete Subnet
      description: Deletes the specified subnet. You must terminate all running instances in the subnet before you can delete the subnet.
      responses:
        '200':
          description: Success
          content:
            text/xml:
              schema:
                type: string
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              allOf:
              - type: object
                required:
                - Action
                - Version
                properties:
                  Action:
                    type: string
                    const: DeleteSubnet
                  Version:
                    type: string
                    const: '2016-11-15'
              - $ref: '#/components/schemas/DeleteSubnetRequest'
            example:
              SubnetId: subnet-9d4a7b6c
      tags:
      - Subnet
  /?Action=DescribeSubnets:
    post:
      operationId: DescribeSubnets
      summary: Describe Subnets
      description: Describes your subnets. The default is to describe all your subnets. Alternatively, you can specify specific subnet IDs or filter the results to include only the subnets that match specific criteria. For more information, see Subnets in the Amazon VPC User Guide.
      responses:
        '200':
          description: Success
          content:
            text/xml:
              schema:
                $ref: '#/components/schemas/DescribeSubnetsResult'
              example:
                Subnets:
                - VpcId: vpc-a01106c2
                  CidrBlock: 10.0.1.0/24
                  MapPublicIpOnLaunch: false
                  DefaultForAz: false
                  State: available
                  AvailabilityZone: us-east-1c
                  SubnetId: subnet-9d4a7b6c
                  AvailableIpAddressCount: 251
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              allOf:
              - type: object
                required:
                - Action
                - Version
                properties:
                  Action:
                    type: string
                    const: DescribeSubnets
                  Version:
                    type: string
                    const: '2016-11-15'
              - $ref: '#/components/schemas/DescribeSubnetsRequest'
            example:
              Filters:
              - Name: vpc-id
                Values:
                - vpc-a01106c2
      tags:
      - Subnet
components:
  schemas:
    Subnet:
      type: object
      properties:
        AvailabilityZoneId:
          type: string
          description: The AZ ID of the subnet.
        EnableLniAtDeviceIndex:
          type: integer
          description: Indicates the device position for local network interfaces in this subnet. For example, 1 indicates local network interfaces in this subnet are the secondary network interface (eth1).
        MapCustomerOwnedIpOnLaunch:
          type: boolean
          description: Indicates whether a network interface created in this subnet (including a network interface created by RunInstances) receives a customer-owned IPv4 address.
        CustomerOwnedIpv4Pool:
          type: string
          description: The customer-owned IPv4 address pool associated with the subnet.
        OwnerId:
          type: string
          description: The ID of the Amazon Web Services account that owns the subnet.
        AssignIpv6AddressOnCreation:
          type: boolean
          description: Indicates whether a network interface created in this subnet (including a network interface created by RunInstances) receives an IPv6 address.
        Ipv6CidrBlockAssociationSet:
          type: array
          items:
            $ref: '#/components/schemas/SubnetIpv6CidrBlockAssociation'
          description: Information about the IPv6 CIDR blocks associated with the subnet.
        Tags:
          type: array
          items:
            $ref: '#/components/schemas/Tag'
          description: Any tags assigned to the subnet.
        SubnetArn:
          type: string
          description: The Amazon Resource Name (ARN) of the subnet.
        OutpostArn:
          type: string
          description: The Amazon Resource Name (ARN) of the Outpost.
        EnableDns64:
          type: boolean
          description: Indicates whether DNS queries made to the Amazon-provided DNS Resolver in this subnet should return synthetic IPv6 addresses for IPv4-only destinations.
        Ipv6Native:
          type: boolean
          description: Indicates whether this is an IPv6 only subnet.
        PrivateDnsNameOptionsOnLaunch:
          $ref: '#/components/schemas/PrivateDnsNameOptionsOnLaunch'
        BlockPublicAccessStates:
          $ref: '#/components/schemas/BlockPublicAccessStates'
        Type:
          type: string
          description: Indicates if this is a subnet used with Amazon Elastic VMware Service (EVS). Possible values are Elastic VMware Service or no value. For more information about Amazon EVS, see Amazon Elastic VMware Service API Reference .
        SubnetId:
          type: string
          description: The ID of the subnet.
        State:
          type: string
          enum:
          - pending
          - available
          - unavailable
          - failed
          - failed-insufficient-capacity
          description: 'The current state of the subnet. failed: The underlying infrastructure to support the subnet failed to provision as expected. failed-insufficient-capacity: The underlying infrastructure to support the subnet failed to provision due to a shortage of EC2 instance capacity.'
        VpcId:
          type: string
          description: The ID of the VPC the subnet is in.
        CidrBlock:
          type: string
          description: The IPv4 CIDR block assigned to the subnet.
        AvailableIpAddressCount:
          type: integer
          description: The number of unused private IPv4 addresses in the subnet. The IPv4 addresses for any stopped instances are considered unavailable.
        AvailabilityZone:
          type: string
          description: The Availability Zone of the subnet.
        DefaultForAz:
          type: boolean
          description: Indicates whether this is the default subnet for the Availability Zone.
        MapPublicIpOnLaunch:
          type: boolean
          description: Indicates whether instances launched in this subnet receive a public IPv4 address. Amazon Web Services charges for all public IPv4 addresses, including public IPv4 addresses associated with running instances and Elastic IP addresses. For more information, see the Public IPv4 Address tab on the Amazon VPC pricing page.
    PrivateDnsNameOptionsOnLaunch:
      type: object
      properties:
        HostnameType:
          type: string
          enum:
          - ip-name
          - resource-name
          description: The type of hostname for EC2 instances. For IPv4 only subnets, an instance DNS name must be based on the instance IPv4 address. For IPv6 only subnets, an instance DNS name must be based on the instance ID. For dual-stack subnets, you can specify whether DNS names use the instance IPv4 address or the instance ID.
        EnableResourceNameDnsARecord:
          type: boolean
          description: Indicates whether to respond to DNS queries for instance hostnames with DNS A records.
        EnableResourceNameDnsAAAARecord:
          type: boolean
          description: Indicates whether to respond to DNS queries for instance hostname with DNS AAAA records.
    DescribeSubnetsResult:
      type: object
      properties:
        NextToken:
          type: string
          description: The token to include in another request to get the next page of items. This value is null when there are no more items to return.
        Subnets:
          type: array
          items:
            $ref: '#/components/schemas/Subnet'
          description: Information about the subnets.
    Tag:
      type: object
      properties:
        Key:
          type: string
          description: 'The key of the tag. Constraints: Tag keys are case-sensitive and accept a maximum of 127 Unicode characters. May not begin with aws:.'
        Value:
          type: string
          description: 'The value of the tag. Constraints: Tag values are case-sensitive and accept a maximum of 256 Unicode characters.'
    BlockPublicAccessStates:
      type: object
      properties:
        InternetGatewayBlockMode:
          type: string
          enum:
          - 'off'
          - block-bidirectional
          - block-ingress
          description: 'The mode of VPC BPA. off: VPC BPA is not enabled and traffic is allowed to and from internet gateways and egress-only internet gateways in this Region. block-bidirectional: Block all traffic to and from internet gateways and egress-only internet gateways in this Region (except for excluded VPCs and subnets). block-ingress: Block all internet traffic to the VPCs in this Region (except for VPCs or subnets which are excluded). Only traffic to and from NAT gateways and egress-only internet gateways is allowed because these gateways only allow outbound connections to be established.'
    DeleteSubnetRequest:
      type: object
      properties:
        SubnetId:
          type: string
          description: The ID of the subnet.
        DryRun:
          type: boolean
          description: Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.
      required:
      - SubnetId
    SubnetIpv6CidrBlockAssociation:
      type: object
      properties:
        AssociationId:
          type: string
          description: The ID of the association.
        Ipv6CidrBlock:
          type: string
          description: The IPv6 CIDR block.
        Ipv6CidrBlockState:
          $ref: '#/components/schemas/SubnetCidrBlockState'
        Ipv6AddressAttribute:
          type: string
          enum:
          - public
          - private
          description: Public IPv6 addresses are those advertised on the internet from Amazon Web Services. Private IP addresses are not and cannot be advertised on the internet from Amazon Web Services.
        IpSource:
          type: string
          enum:
          - amazon
          - byoip
          - none
          description: The source that allocated the IP address space. byoip or amazon indicates public IP address space allocated by Amazon or space that you have allocated with Bring your own IP (BYOIP). none indicates private space.
    DescribeSubnetsRequest:
      type: object
      properties:
        Filters:
          type: array
          items:
            $ref: '#/components/schemas/Filter'
          description: The filters. availability-zone - The Availability Zone for the subnet. You can also use availabilityZone as the filter name. availability-zone-id - The ID of the Availability Zone for the subnet. You can also use availabilityZoneId as 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 use cidr or cidrBlock as the filter names. customer-owned-ipv4-pool - The cust
        SubnetIds:
          type: array
          items:
            type: string
          description: 'The IDs of the subnets. Default: Describes all your subnets.'
        NextToken:
          type: string
          description: The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.
        MaxResults:
          type: integer
          description: The maximum number of items to return for this request. To get the next page of items, make another request with the token returned in the output. For more information, see Pagination.
        DryRun:
          type: boolean
          description: Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.
    CreateSubnetRequest:
      type: object
      properties:
        TagSpecifications:
          type: array
          items:
            $ref: '#/components/schemas/TagSpecification'
          description: The tags to assign to the subnet.
        AvailabilityZone:
          type: string
          description: '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.'
        AvailabilityZoneId:
          type: string
          description: The AZ ID or the Local Zone ID of the subnet.
        CidrBlock:
          type: string
          description: 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 specify 100.68.0.18/18, we modify it to 100.68.0.0/18. This parameter is not supported for an IPv6 only subnet.
        Ipv6CidrBlock:
          type: string
          description: The IPv6 network range for the subnet, in CIDR notation. This parameter is required for an IPv6 only subnet.
        OutpostArn:
          type: string
          description: 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.
        VpcId:
          type: string
          description: The ID of the VPC.
        Ipv6Native:
          type: boolean
          description: Indicates whether to create an IPv6 only subnet.
        Ipv4IpamPoolId:
          type: string
          description: An IPv4 IPAM pool ID for the subnet.
        Ipv4NetmaskLength:
          type: integer
          description: An IPv4 netmask length for the subnet.
        Ipv6IpamPoolId:
          type: string
          description: An IPv6 IPAM pool ID for the subnet.
        Ipv6NetmaskLength:
          type: integer
          description: An IPv6 netmask length for the subnet.
        DryRun:
          type: boolean
          description: Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.
      required:
      - VpcId
    TagSpecification:
      type: object
      properties:
        ResourceType:
          type: string
          enum:
          - 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
          - ipam-internet-registry-association
          - secondary-interface
          - secondary-network
          - secondary-subnet
          - capacity-manager-data-export
          - vpn-concentrator
          - ipam-pool-allocation
          - capacity-reservation-cancellation-quote
          - application-status-check
          - capacity-reservation-modification-quote
          description: The type of resource to tag on creation.
        Tags:
          type: array
          items:
            $ref: '#/components/schemas/Tag'
          description: The tags to apply to the resource.
    CreateSubnetResult:
      type: object
      properties:
        Subnet:
          $ref: '#/components/schemas/Subnet'
    Filter:
      type: object
      properties:
        Name:
          type: string
          description: The name of the filter. Filter names are case-sensitive.
        Values:
          type: array
          items:
            type: string
          description: The filter values. Filter values are case-sensitive. If you specify multiple values for a filter, the values are joined with an OR, and the request returns all results that match any of the specified values.
    SubnetCidrBlockState:
      type: object
      properties:
        State:
          type: string
          enum:
          - associating
          - associated
          - disassociating
          - disassociated
          - failing
          - failed
          description: The state of a CIDR block.
        StatusMessage:
          type: string
          description: A message about the status of the CIDR block, if applicable.
  securitySchemes:
    sigv4:
      type: apiKey
      in: header
      name: Authorization
      description: AWS Signature Version 4. The Authorization header carries an AWS4-HMAC-SHA256 signature over the canonical request, with X-Amz-Date (and X-Amz-Security-Token for temporary credentials). Not a bearer token.
      x-aws-sigv4:
        signingName: ec2
x-provenance:
  method: harvested
  publisher: Amazon Web Services
  source: https://raw.githubusercontent.com/aws/api-models-aws/582e55931c45b944739742a2c1620b6026dd2d13/models/ec2/service/2016-11-15/ec2-2016-11-15.json
  note: converted by smithy-to-openapi.py from AWS's Smithy model (roadmap#1001)