0
0
AWScloud~5 mins

Default VPC overview in AWS - Commands & Configuration

Choose your learning style9 modes available
Introduction
A default VPC is a ready-to-use network in AWS that lets you launch resources without setting up a network. It solves the problem of needing to create and configure a network before using AWS services.
When you want to quickly launch an EC2 instance without creating a custom network.
When you are learning AWS and want to experiment with resources in a simple network.
When you need a basic network setup with public internet access for your resources.
When you want to avoid the complexity of configuring subnets, route tables, and gateways.
When you want to use AWS services that require a network but do not want to manage it yourself.
Commands
This command lists the default VPCs in your AWS account. It helps you find the default network ready for use.
Terminal
aws ec2 describe-vpcs --filters Name=isDefault,Values=true
Expected OutputExpected
{ "Vpcs": [ { "VpcId": "vpc-0abcd1234efgh5678", "InstanceTenancy": "default", "IsDefault": true, "State": "available", "CidrBlock": "172.31.0.0/16", "DhcpOptionsId": "dopt-0a1b2c3d4e5f6g7h8" } ] }
--filters - Filters the VPCs to show only the default one.
This command shows the subnets inside the default VPC. Subnets divide the network into smaller parts.
Terminal
aws ec2 describe-subnets --filters Name=vpc-id,Values=vpc-0abcd1234efgh5678
Expected OutputExpected
{ "Subnets": [ { "SubnetId": "subnet-0123abcd", "VpcId": "vpc-0abcd1234efgh5678", "CidrBlock": "172.31.0.0/20", "AvailabilityZone": "us-east-1a", "State": "available" }, { "SubnetId": "subnet-0456efgh", "VpcId": "vpc-0abcd1234efgh5678", "CidrBlock": "172.31.16.0/20", "AvailabilityZone": "us-east-1b", "State": "available" } ] }
--filters - Filters subnets by the default VPC ID.
This command shows the internet gateway attached to the default VPC. It allows resources to access the internet.
Terminal
aws ec2 describe-internet-gateways --filters Name=attachment.vpc-id,Values=vpc-0abcd1234efgh5678
Expected OutputExpected
{ "InternetGateways": [ { "InternetGatewayId": "igw-0a1b2c3d4e5f6g7h8", "Attachments": [ { "VpcId": "vpc-0abcd1234efgh5678", "State": "attached" } ] } ] }
--filters - Filters internet gateways attached to the default VPC.
Key Concept

If you remember nothing else from this pattern, remember: the default VPC is a ready-made network that lets you start using AWS resources immediately without extra setup.

Common Mistakes
Trying to launch resources without checking if the default VPC exists.
Some AWS accounts or regions may not have a default VPC, causing resource launch failures.
Always run 'aws ec2 describe-vpcs --filters Name=isDefault,Values=true' to confirm the default VPC exists before launching resources.
Assuming the default VPC has public internet access without verifying the internet gateway.
If the internet gateway is missing or detached, resources cannot access the internet.
Check the internet gateway attachment with 'aws ec2 describe-internet-gateways --filters Name=attachment.vpc-id,Values=<vpc-id>' to ensure internet access.
Summary
Use 'aws ec2 describe-vpcs' with filters to find the default VPC in your AWS account.
Check subnets in the default VPC to understand its network layout.
Verify the internet gateway is attached to allow internet access for resources.