CloudConsole

aws ec2 describe-vpcs

Updated 16 November 2026 · How we write and check guides

Short answer

aws ec2 describe-vpcs lists the VPCs in one region with their IDs, CIDR blocks, default flag, state and tags. Use --filters Name=is-default,Values=true to find the default VPC, and --query to print VpcId, CidrBlock and the Name tag as a table.

Terminal running aws ec2 describe-vpcs \
A worked example from this page. Copy commands from the text below, not from the image.

What the command does

Each entry in Vpcs[] describes one VPC: VpcId, the primary CidrBlock, any extra ranges in CidrBlockAssociationSet and Ipv6CidrBlockAssociationSet, IsDefault, State, InstanceTenancy, DhcpOptionsId, OwnerId and Tags. VPCs shared with you through AWS RAM also appear, with someone else's OwnerId.

Like all EC2 describe calls it is regional. A VPC you created in eu-west-1 is invisible to a CLI profile set to eu-west-2.

Syntax

aws ec2 describe-vpcs \
  [--vpc-ids vpc-0123456789abcdef0 ...] \
  [--filters "Name=<filter>,Values=..."] \
  [--query ...] [--output table]

Worked examples

All VPCs with their Name tag and CIDR:

aws ec2 describe-vpcs \
  --query "Vpcs[].{ID:VpcId,Name:Tags[?Key=='Name']|[0].Value,CIDR:CidrBlock,Default:IsDefault}" \
  --output table

The default VPC's ID, handy in scripts that launch test resources:

aws ec2 describe-vpcs --filters "Name=is-default,Values=true" \
  --query "Vpcs[0].VpcId" --output text

If this prints None, the region has no default VPC (it was deleted, or the account is set up without one) and commands that rely on it need an explicit subnet.

Find a VPC by CIDR when planning peering or a Transit Gateway attachment and you need to avoid overlaps:

aws ec2 describe-vpcs \
  --filters "Name=cidr-block-association.cidr-block,Values=10.20.0.0/16" \
  --query "Vpcs[].VpcId" --output text

Every CIDR in use, including secondary ranges:

aws ec2 describe-vpcs \
  --query "Vpcs[].[VpcId,join(',',CidrBlockAssociationSet[].CidrBlock)]" --output text

Check DNS settings, a common reason private hosted zones and interface endpoints do not resolve:

aws ec2 describe-vpc-attribute --vpc-id vpc-0123456789abcdef0 --attribute enableDnsSupport
aws ec2 describe-vpc-attribute --vpc-id vpc-0123456789abcdef0 --attribute enableDnsHostnames

Useful filters

FilterUse
is-defaulttrue for the default VPC.
cidrExact match on the primary IPv4 CIDR.
cidr-block-association.cidr-blockMatches primary or secondary IPv4 CIDRs.
owner-idSeparate your VPCs from ones shared with you.
statepending or available.
tag:NameFind a VPC by its name.

Gotchas

  • "Which VPC is this?" The console's VPC name is just the Name tag; VPCs without one show null, so key scripts on VpcId.
  • Deleting a VPC fails with DependencyViolation while anything still uses it. List what is left with aws ec2 describe-network-interfaces --filters "Name=vpc-id,Values=vpc-0123456789abcdef0"; Lambda, load balancer and endpoint ENIs are the usual leftovers.
  • VPC quota. Accounts have a per-region VPC quota (five by default at the time of writing). Count with --query "length(Vpcs)" before an automated deploy creates another.
  • Overlapping CIDRs cannot be peered or routed through a Transit Gateway cleanly. Check every region you might connect, not just the current one.
  • Shared VPCs. VPCs shared with you through AWS RAM appear with the owner's OwnerId. You can launch resources into the subnets shared with you, but you cannot modify or delete the VPC itself.

Questions

How do I find the default VPC ID with the CLI?

aws ec2 describe-vpcs --filters "Name=is-default,Values=true" --query "Vpcs[0].VpcId" --output text. None means there is no default VPC in that region.

How do I list VPCs in all regions?

Loop over aws ec2 describe-regions --query "Regions[].RegionName" --output text and run describe-vpcs with --region for each.

How do I describe flow logs for a VPC?

Use aws ec2 describe-flow-logs --filter "Name=resource-id,Values=vpc-0123456789abcdef0". Note that this command's option is --filter, singular.

When this happens away from your desk

Network questions come up mid-incident more often than you would like. CloudConsole, a phone app for AWS, is built to show resources, alarms and logs together on a phone.

About the app → · Download on the App Store

Sources