Vpc
Reference doc for the `sst.aws.Vpc` component.
The Vpc
component lets you add a VPC to your app. It uses Amazon VPC. This is useful for services like RDS and Fargate that need to be hosted inside
a VPC.
This creates a VPC with 2 Availability Zones by default. It also created The following resources: 5. A security group.
- A public subnet in each AZ.
- A private subnet in each AZ.
- An Internet Gateway, all the traffic from the public subnets are routed through it.
- A NAT Gateway in each AZ. All the traffic from the private subnets are routed to the NAT Gateway in the same AZ.
NAT Gateways are billed per hour and per gigabyte of data processed. By default, this creates a NAT Gateway in each AZ. And this would be roughly $33 per NAT Gateway per month. Make sure to review the pricing.
Create a VPC
Create it with 3 Availability Zones
Constructor
Parameters
-
name
string
-
args?
VpcArgs
-
opts?
ComponentResourceOptions
VpcArgs
az?
Type Input
<
number
>
Default 2
Number of Availability Zones or AZs for the VPC. By default, it creates a VPC with 2 AZs since services like RDS and Fargate need at least 2 AZs.
transform?
Type Object
Transform how this component creates its underlying resources.
transform.elasticIp?
transform.internetGateway?
Type InternetGatewayArgs
|
(
args
:
InternetGatewayArgs
=>
void
)
Transform the EC2 Internet Gateway resource.
transform.natGateway?
Type NatGatewayArgs
|
(
args
:
NatGatewayArgs
=>
void
)
Transform the EC2 NAT Gateway resource.
transform.privateRouteTable?
Type RouteTableArgs
|
(
args
:
RouteTableArgs
=>
void
)
Transform the EC2 route table resource for the private subnet.
transform.privateSubnet?
Type SubnetArgs
|
(
args
:
SubnetArgs
=>
void
)
Transform the EC2 private subnet resource.
transform.publicRouteTable?
Type RouteTableArgs
|
(
args
:
RouteTableArgs
=>
void
)
Transform the EC2 route table resource for the public subnet.
transform.publicSubnet?
Type SubnetArgs
|
(
args
:
SubnetArgs
=>
void
)
Transform the EC2 public subnet resource.
transform.securityGroup?
Type SecurityGroupArgs
|
(
args
:
SecurityGroupArgs
=>
void
)
Transform the EC2 Security Group resource.
transform.vpc?
Properties
id
Type Output
<
string
>
The VPC ID.
nodes
Type Object
The underlying resources this component creates.
nodes.elasticIps
Type Output
<
Eip
[]
>
The Amazon EC2 Elastic IP.
nodes.internetGateway
Type InternetGateway
The Amazon EC2 Internet Gateway.
nodes.natGateways
Type Output
<
NatGateway
[]
>
The Amazon EC2 NAT Gateway.
nodes.privateRouteTables
Type Output
<
RouteTable
[]
>
The Amazon EC2 route table for the private subnet.
nodes.privateSubnets
Type Output
<
Subnet
[]
>
The Amazon EC2 private subnet.
nodes.publicRouteTables
Type Output
<
RouteTable
[]
>
The Amazon EC2 route table for the public subnet.
nodes.publicSubnets
Type Output
<
Subnet
[]
>
The Amazon EC2 public subnet.
nodes.securityGroup
Type SecurityGroup
The Amazon EC2 Security Group.
nodes.vpc
Type Vpc
The Amazon EC2 VPC.
privateSubnets
Type Output
<
Output
<
string
>
[]
>
A list of private subnet IDs in the VPC.
publicSubnets
Type Output
<
Output
<
string
>
[]
>
A list of public subnet IDs in the VPC.
securityGroups
Type Output
<
string
>
[]
A list of VPC security group IDs.