Creating a Subnet in a VPC

You can create one or more subnets in a VPC to be able to launch resources into it. Subnets are placed on Availability Zones (AZs) of the Region of your VPC.

Once your subnet is created, it is recommended to create a security group and a route table dedicated to it. For more information, see Creating a Security Group and Creating a Route Table.

Creating a Subnet Using Cockpit v1

Before you begin:

  1. Create a VPC. For more information, see Creating a VPC.

  2. (optional) To disable the network enhancement allowing instances of a same subnet to communicate with one another without security group rules required, add a tag to your VPC with osc.fcu.enable_lan_security_groups as key. For more information about how to add a tag, see Adding or Removing Tags. For more information about this network enhancement, see About VPCs > Subnet Routing and Security.

    • This tag must be added to your VPC before creating subnets into it.

    • The value of this tag is not taken into account, you can therefore specify any value for this tag.

  1. Click VPC > VPCs.

  2. Click the VPC in which you want to create a subnet.
    The VPC is selected.

  3. Click Create Subnet .
    The CREATE SUBNET dialog box appears.

  4. In the Name field, type a name for the subnet.

    This action adds a Name tag of 255 characters maximum. You can use any character, including accented letters.

  5. In the CIDR field, type the range of IPs for the subnet, in CIDR notation.

    • The subnet CIDR block must be part of the VPC CIDR block.

    • If you create several subnets in a VPC, their CIDR blocks must not overlap.

  6. In the Availability Zone list, select the Availability Zone in which you want to create the subnet.

    By default, the Availability Zone A is selected.

  7. Click Create to validate.
    The subnet is created in the VPC and appears on the VPCs page.

Creating a Subnet Using Cockpit v2-beta

Before you begin:

  1. Create a Net. For more information, see Creating a VPC.

  2. (optional) To disable the network enhancement allowing virtual machines (VMs) of a same Subnet to communicate with one another without security group rules required, add a tag to your Net with osc.fcu.enable_lan_security_groups as key. For more information about how to add a tag, see Adding or Removing Tags. For more information about this network enhancement, see About VPCs > Subnet Routing and Security.

    • This tag must be added to your Net before creating Subnets into it.

    • The value of this tag is not taken into account, you can therefore specify any value for this tag.

  1. In the Nets dashboard, click the ID of the Net in which you want to create a Subnet.
    The Subnet panel appears.

  2. Click IconAddFull Create Subnet.
    The CREATE SUBNET dialog box appears.

  3. In the Name field, type a name for the Subnet.

    This action adds a Name tag of 255 characters maximum. You can use any character, including accented letters.

  4. In the IP range field, type the range of IPs for the Subnet, in CIDR notation.

    • The Subnet CIDR block must be part of the Net CIDR block.

    • If you create several Subnets in a Net, their CIDR blocks must not overlap.

  5. In the Subregion list, select the Subregion in which you want to create the Subnet.

  6. Click Create Subnet to validate.
    The Subnet is created in the Net.

Creating a Subnet Using AWS CLI

Before you begin:

  1. Create a VPC. For more information, see Creating a VPC.

  2. (optional) To disable the network enhancement allowing instances of a same subnet to communicate with one another without security group rules required, add a tag to your VPC with osc.fcu.enable_lan_security_groups as key. For more information about how to add a tag, see Adding or Removing Tags. For more information about this network enhancement, see About VPCs > Subnet Routing and Security.

    • This tag must be added to your VPC before creating subnets into it.

    • The value of this tag is not taken into account, you can therefore specify any value for this tag.

To create a subnet, use the create-subnet command following this syntax:

Request sample
$ aws ec2 create-subnet \
    --profile YOUR_PROFILE \
    --vpc-id vpc-12345678 \
    --cidr-block 10.1.0.0/24 \
    --availability-zone eu-west-2a \
    --endpoint https://fcu.eu-west-2.outscale.com

This command contains the following attributes that you need to specify:

  • (optional) profile: The named profile you want to use, created when configuring AWS CLI. For more information, see Installing and Configuring AWS CLI.

  • vpc-id: The ID of the VPC in which you want to create the subnet.

  • cidr-block: The range of IPs for the subnet, in CIDR notation.

    • The subnet CIDR block must be part of the VPC CIDR.

    • If you create several subnets in a VPC, their CIDR blocks must not overlap.

  • (optional) availability-zone: The AZ in which you want to create the subnet.

    If you do not specify any AZ, the AZ A is used by default.

  • endpoint: The endpoint corresponding to the Region you want to send the request to.

The create-subnet command returns the following elements:

  • Subnet: Information about the newly created subnet. This element contains the following information:

    • VpcId: The VPC in which the subnet is.

    • CidrBlock: The range of IPs for the subnet, in CIDR notation.

    • State: The state of the subnet. For more information, see About VPCs.

    • AvailabilityZone: The AZ in which the subnet is.

    • SubnetId: The ID of the subnet.

    • AvailableIpAddressCount: The number of unused IPs in the subnet.

Result sample
 {
    "Subnet": {
        "VpcId": "vpc-12345678",
        "CidrBlock": "10.1.0.0/24",
        "State": "pending",
        "AvailabilityZone": "eu-west-2a",
        "SubnetId": "subnet-87654321",
        "AvailableIpAddressCount": 242
    }
}

The subnet is created.

Related Pages

Corresponding API Method

AWS™ and Amazon Web Services™ are trademarks of Amazon Technologies, Inc or its affiliates in the United States and/or other countries.