aws-cdk-lib.aws_ec2.NatTrafficDirection

enum NatTrafficDirection

LanguageType name
.NETAmazon.CDK.AWS.EC2.NatTrafficDirection
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsec2#NatTrafficDirection
Javasoftware.amazon.awscdk.services.ec2.NatTrafficDirection
Pythonaws_cdk.aws_ec2.NatTrafficDirection
TypeScript (source)aws-cdk-lib » aws_ec2 » NatTrafficDirection

Direction of traffic to allow all by default.

Example

declare const instanceType: ec2.InstanceType;

const provider = ec2.NatProvider.instance({
  instanceType,
  defaultAllowedTraffic: ec2.NatTrafficDirection.OUTBOUND_ONLY,
});
new ec2.Vpc(this, 'TheVPC', {
  natGatewayProvider: provider,
});
provider.connections.allowFrom(ec2.Peer.ipv4('1.2.3.4/8'), ec2.Port.tcp(80));

Members

NameDescription
OUTBOUND_ONLYAllow all outbound traffic and disallow all inbound traffic.
INBOUND_AND_OUTBOUNDAllow all outbound and inbound traffic.
NONEDisallow all outbound and inbound traffic.

OUTBOUND_ONLY

Allow all outbound traffic and disallow all inbound traffic.


INBOUND_AND_OUTBOUND

Allow all outbound and inbound traffic.


NONE

Disallow all outbound and inbound traffic.