How to create a subnet inside a VPC using AWS CLI?

0 votes
Please help me with the command used to create a subnet inside a VPC using AWS CLI?
Feb 21 in AWS by Nabarupa Das
71 views

1 answer to this question.

0 votes

To create a subnet inside a VPC using AWS CLI you can use the following command:-

Pre-requisite:-

  1. AWS CLI configured
  2. VPC ID
The command used is as follows:-
C:\Users\priyj_kumar>aws ec2 create-subnet --vpc-id vpc-0aca683c37231c12f --cidr-block 10.0.1.0/24

The output you will get after executing the command will be as follows:- 

{
    "Subnet": {
        "AvailabilityZone": "us-east-1e",
        "AvailableIpAddressCount": 251,
        "CidrBlock": "10.0.1.0/24",
        "DefaultForAz": false,
        "MapPublicIpOnLaunch": false,
        "State": "pending",
        "SubnetId": "subnet-08f4ee13b627d22bb",
        "VpcId": "vpc-0aca683c37231c12f",
        "AssignIpv6AddressOnCreation": false,
        "Ipv6CidrBlockAssociationSet": []
    }
}

This way you can create a subnet inside a VPC. Hope this helps.

answered Feb 21 by Priyaj
• 57,300 points

Related Questions In AWS

0 votes
1 answer

How to create a DynamoDB using AWS CLI?

You can create a DynamoDB table using ...READ MORE

answered Feb 22 in AWS by Priyaj
• 57,300 points
93 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

How to create a VPC using AWS CLI?

To create an Amazon VPC using AWS ...READ MORE

answered Feb 21 in AWS by Priyaj
• 57,300 points
118 views
0 votes
1 answer

How to create a S3 bucket using AWS CLI?

You can use the following command:- C:\Users\priyj_kumar>aws s3api ...READ MORE

answered Feb 15 in AWS by Priyaj
• 57,300 points
1,081 views