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:
|
-
Click VPC > VPCs.
-
Click the VPC in which you want to create a subnet.
The VPC is selected. -
Click Create Subnet .
The CREATE SUBNET dialog box appears. -
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.
-
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.
-
-
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.
-
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:
|
-
In the Nets dashboard, click the ID of the Net in which you want to create a Subnet.
The Subnet panel appears. -
Click
Create Subnet.
The CREATE SUBNET dialog box appears. -
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.
-
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.
-
-
In the Subregion list, select the Subregion in which you want to create the Subnet.
-
Click Create Subnet to validate.
The Subnet is created in the Net.
Creating a Subnet Using OSC CLI
Before you begin:
|
See the CreateSubnet command sample in the documentation of the OUTSCALE API. |
Creating a Subnet Using AWS CLI
Before you begin:
|
To create a subnet, use the create-subnet command following this syntax:
$ 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.
-
{
"Subnet": {
"VpcId": "vpc-12345678",
"CidrBlock": "10.1.0.0/24",
"State": "available",
"AvailabilityZone": "eu-west-2a",
"SubnetId": "subnet-87654321",
"AvailableIpAddressCount": 242
}
}
The subnet is created.
Related Pages
Corresponding API Methods
AWS™ and Amazon Web Services™ are trademarks of Amazon Technologies, Inc or its affiliates in the United States and/or other countries.