Skip to content
v2.277.0

ConfigureNatOptions Struct ​

Options passed by the VPC when NAT needs to be configured.

Don't use this directly, the VPC will pass it automatically.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_ec2 as ec2 } from 'aws-cdk-lib';

declare const privateSubnet: ec2.PrivateSubnet;
declare const publicSubnet: ec2.PublicSubnet;
declare const vpc: ec2.Vpc;
const configureNatOptions: ec2.ConfigureNatOptions = {
  natSubnets: [publicSubnet],
  privateSubnets: [privateSubnet],
  vpc: vpc,
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_ec2 as ec2

# private_subnet: ec2.PrivateSubnet
# public_subnet: ec2.PublicSubnet
# vpc: ec2.Vpc

configure_nat_options = ec2.ConfigureNatOptions(
    nat_subnets=[public_subnet],
    private_subnets=[private_subnet],
    vpc=vpc
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.ec2.*;

PrivateSubnet privateSubnet;
PublicSubnet publicSubnet;
Vpc vpc;

ConfigureNatOptions configureNatOptions = ConfigureNatOptions.builder()
        .natSubnets(List.of(publicSubnet))
        .privateSubnets(List.of(privateSubnet))
        .vpc(vpc)
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.EC2;

PrivateSubnet privateSubnet;
PublicSubnet publicSubnet;
Vpc vpc;

var configureNatOptions = new ConfigureNatOptions {
    NatSubnets = new [] { publicSubnet },
    PrivateSubnets = new [] { privateSubnet },
    Vpc = vpc
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

var privateSubnet PrivateSubnet
var publicSubnet PublicSubnet
var vpc Vpc

configureNatOptions := &ConfigureNatOptions{
	NatSubnets: []PublicSubnet{
		publicSubnet,
	},
	PrivateSubnets: []PrivateSubnet{
		privateSubnet,
	},
	Vpc: vpc,
}

Properties ​

natSubnetsPublicSubnet[]nat_subnetstyping.List[PublicSubnet]natSubnetsList<PublicSubnet>NatSubnetsPublicSubnet[]NatSubnets*[]PublicSubnetrequired#
The public subnets where the NAT providers need to be placed.

For Regional NAT Gateways, this should be an empty array as they don't require public subnets.

privateSubnetsPrivateSubnet[]private_subnetstyping.List[PrivateSubnet]privateSubnetsList<PrivateSubnet>PrivateSubnetsPrivateSubnet[]PrivateSubnets*[]PrivateSubnetrequired#
The private subnets that need to route through the NAT providers.

There may be more private subnets than public subnets with NAT providers.

vpcVpcvpcVpcvpcVpcVpcVpcVpcVpcrequired#
The VPC we're configuring NAT for.