Skip to content

Recreating a Default VPC


VPC
For more information on VPC, visit https://aws.amazon.com/vpc/


VPC Description


The Default VPC is the VPC that is included and configured with every account in every region. In a lot of scenarios, the default VPC has been removed, and in some cases there may be a desire to re-create the default VPC in a region. This tutorial will walk through the steps required to recreate a default VPC in a region where there is either no VPC or where the default VPC has been previously deleted.


VPC Pre-Requisites


1.    Active AWS Account:
You will need to have an active AWS account, as this tutorial will cover re-creating a default VPC within an active AWS account.


Creating a Default VPC from the Console


1.    Log into your AWS account:
Open a browser window and visit the AWS Console Page


2.    Locate and navigate to the VPC Service:
From the top left side of the navigational menu bar, click on the Services menu, and then choose VPC by either navigating to the Networking & Content Delivery section of the listed services, or by typing the first few letters of the service name in the search box, and then choosing it from the filtered list.


VPC


3.    Your VPCs:
From the VPC console screen, ignore the Start VPC Wizard button as this wizard will create a custom VPC, not the default VPC. In order to re-create the default VPC, instead click on the Your VPCs* link in the left menu.


Your VPC


4.    Creating a New Default VPC:
Next, from the Your VPCs console, go to Actions and select Create Default VPC from the actions menu.


Create VPC


5.    VPC Create Action:
On the Create Default VPC console page, click on the Create button to finalize the creation wizard, and begin creating the new default VPC. Once the process has completed, Click on the Close button.


Confirm Create VPC


Create VPC Completed


6.    VPC Creation Completed:
Once you have clicked on Close, you will be returned to the Your VPCs page, and should now see your new default VPC.


See your new VPC


Creating a Default VPC from the CLI


Now that we have walked through creating the default VPC in the AWS console, lets walk through a quick example on how to create a new default VPC using the AWS CLI.


1.    Verify that the default VPC does not exist:
First we need to make sure that the default VPC doesn't currently already exist. We can do this by looking at the console under the VPC service, or by issuing a describe-vpcs CLI command.


Verify No Default VPC


Syntax:

aws ec2 describe-vpcs --region {Region}


Example Request:

aws ec2 describe-vpcs --region us-west-1

Example Response:

{
    "Vpcs": []
}


2.    Create a new default VPC from the CLI:
Now that we have verified that we don't have an existing default VPC, lets create one.


Syntax:

aws ec2 create-default-vpc --region {Region}


Example Request:

aws ec2 create-default-vpc --region us-west-1

Example Response:

{
    "Vpc": {
        "CidrBlock": "172.31.0.0/16",
        "DhcpOptionsId": "dopt-1d531c78",
        "State": "pending",
        "VpcId": "vpc-03c34abcde123f45e",
        "InstanceTenancy": "default",
        "Ipv6CidrBlockAssociationSet": [],
        "CidrBlockAssociationSet": [
            {
                "AssociationId": "vpc-cidr-assoc-023004cb29cf109ee",
                "CidrBlock": "172.31.0.0/16",
                "CidrBlockState": {
                    "State": "associated"
                }
            }
        ],
        "IsDefault": true,
        "Tags": []
    }
}


3.    Verify the new default VPC from the CLI:
Last, now that we have re-created the default VPC, lets verify that it was created successfully. Again, we can do this both from the Console as well as from the CLI.


Verify New Default VPC


Syntax:

aws ec2 describe-vpcs --region {Region}


Example Request:

aws ec2 describe-vpcs --region us-west-1

Example Response:

{
    "Vpcs": [
        {
            "CidrBlock": "172.31.0.0/16",
            "DhcpOptionsId": "dopt-1d531c78",
            "State": "available",
            "VpcId": "vpc-03c34abcde123f45e",
            "InstanceTenancy": "default",
            "CidrBlockAssociationSet": [
                {
                    "AssociationId": "vpc-cidr-assoc-023004cb29cf109ee",
                    "CidrBlock": "172.31.0.0/16",
                    "CidrBlockState": {
                        "State": "associated"
                    }
                }
            ],
            "IsDefault": true
        }
    ]
}


VPC Additional Resources


No Additional Resources.


VPC Site/Information References


AWS create-default-vpc Reference Doc


Comments