← 返回命令列表

Linux command

aws-vpc 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

List all VPCs

aws ec2 describe-vpcs

Create a VPC

aws ec2 create-vpc --cidr-block [10.0.0.0/16]

List subnets

aws ec2 describe-subnets --filters Name=vpc-id,Values=[vpc-xxxxxxxx]

Create a subnet

aws ec2 create-subnet --vpc-id [vpc-xxxxxxxx] --cidr-block [10.0.1.0/24] --availability-zone [us-east-1a]

Create an internet gateway

aws ec2 create-internet-gateway

Attach internet gateway

aws ec2 attach-internet-gateway --vpc-id [vpc-xxxxxxxx] --internet-gateway-id [igw-xxxxxxxx]

List route tables

aws ec2 describe-route-tables --filters Name=vpc-id,Values=[vpc-xxxxxxxx]

Add a route

aws ec2 create-route --route-table-id [rtb-xxxxxxxx] --destination-cidr-block 0.0.0.0/0 --gateway-id [igw-xxxxxxxx]

说明

aws-vpc refers to VPC (Virtual Private Cloud) commands within the AWS CLI ec2 namespace. VPC provides isolated virtual networks in AWS where you launch resources with complete control over IP addressing, subnets, routing, and security. Key components include VPCs (the network container), subnets (IP address ranges in availability zones), route tables (traffic routing rules), internet gateways (public internet access), NAT gateways (outbound-only internet for private subnets), and security groups (instance firewalls). VPC Peering connects VPCs privately. Transit Gateway connects multiple VPCs and on-premises networks at scale. VPC Endpoints provide private access to AWS services without internet traversal.

参数

describe-vpcs
List VPCs and their details.
create-vpc
Create a new VPC.
delete-vpc
Remove a VPC (must be empty).
describe-subnets
List subnets.
create-subnet
Create a subnet in a VPC.
delete-subnet
Remove a subnet.
describe-internet-gateways
List internet gateways.
create-internet-gateway
Create an internet gateway.
attach-internet-gateway
Attach gateway to VPC.
describe-route-tables
List route tables.
create-route
Add a route to a table.
describe-nat-gateways
List NAT gateways.
create-nat-gateway
Create a NAT gateway.
--vpc-id _id_
VPC identifier.
--cidr-block _cidr_
IP address range in CIDR notation.
--subnet-id _id_
Subnet identifier.
--availability-zone _az_
Availability zone for subnet.
--filters _filters_
Filter results by attributes.

FAQ

What is the aws-vpc command used for?

aws-vpc refers to VPC (Virtual Private Cloud) commands within the AWS CLI ec2 namespace. VPC provides isolated virtual networks in AWS where you launch resources with complete control over IP addressing, subnets, routing, and security. Key components include VPCs (the network container), subnets (IP address ranges in availability zones), route tables (traffic routing rules), internet gateways (public internet access), NAT gateways (outbound-only internet for private subnets), and security groups (instance firewalls). VPC Peering connects VPCs privately. Transit Gateway connects multiple VPCs and on-premises networks at scale. VPC Endpoints provide private access to AWS services without internet traversal.

How do I run a basic aws-vpc example?

Run `aws ec2 describe-vpcs` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does describe-vpcs do in aws-vpc?

List VPCs and their details.