Create the Virtual Private Cloud

An VPC is a virtual network. For more information, see Amazon VPC.

 

Creating the VPC

To create the VPC, in the AWS CLI, run the following command:

# aws ec2 create-vpc \
--cidr-block <CIDR allocated for new VPC> \
| jq -r '.Vpc.VpcId'

The command will return the new VPC's VPC ID. Record the VPC ID and VPC CIDR to the AWS worksheet.

For example below is an input and output:

# aws ec2 create-vpc \
--cidr-block 10.0.0.0/16 \
| jq -r '.Vpc.VpcId'
vpc-0143197ca9bd9c117

To (optionally) verify assigned tags:

Run the command:

# aws ec2 describe-tags \
--filters "Name=resource-id,Values=<VPC ID>"

For example:

# aws ec2 describe-tags \
--filters "Name=resource-id,Values=vpc-0143197ca9bd9c117"
{
			"Tags":[
			{
			"Key":"Name",
			"ResourceId":"vpc-0143197ca9bd9c117",
			"ResourceType":"vpc",
			"Value":"srgdemo-vpc"
			},
			{
			"Key":"kubernetes.io/cluster/srgdemo-cluster",
			"ResourceId":"vpc-0143197ca9bd9c117",
			"ResourceType":"vpc",
			"Value":"shared"
			}
			]
		}

Enabling DNS and Hostname Resolution

DNS support and hostname resolution should be enabled to make IP addresses more easily human-readable.

Next Step: Create the External IP Address