A Virtual Private Cloud (VPC) is the backbone of nearly every AWS configuration. If it has to do with networking, then a VPC will be involved.
Amazon provides a default VPC when you create your account, but it is likely that you will create your own as you build out your environment.
The examples below will create a new Virtual Private Cloud with an address range of 10.0.0.0/16
.
AWS CLI
aws ec2 create-vpc --cidr-block 10.0.0.0/16
{
"Vpc": {
"OwnerId": "941377140019",
"InstanceTenancy": "default",
"Ipv6CidrBlockAssociationSet": [],
"CidrBlockAssociationSet": [
{
"AssociationId": "vpc-cidr-assoc-0a5bc83743831e186",
"CidrBlock": "10.0.0.0/16",
"CidrBlockState": {
"State": "associated"
}
}
],
"IsDefault": false,
"VpcId": "vpc-0fbacb611b69b8966",
"State": "pending",
"CidrBlock": "10.0.0.0/16",
"DhcpOptionsId": "dopt-0cea263816438a9ab"
}
}
The values in your output will be different. Once the command completes, you should be able to see the VpcId
in the AWS Console.
Terraform
resource "aws_vpc" "basic-aws-vpc" {
cidr_block = "10.0.0.0/16"
enable_dns_hostnames = "true"
tags = {
Name = "Basic VPC"
}
}