NatTrafficDirection

class aws_cdk.aws_ec2.NatTrafficDirection(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

Direction of traffic to allow all by default.

ExampleMetadata:

infused

Example:

nat_gateway_provider = ec2.NatProvider.instance_v2(
    instance_type=ec2.InstanceType("t3.small"),
    default_allowed_traffic=ec2.NatTrafficDirection.NONE
)
vpc = ec2.Vpc(self, "Vpc", nat_gateway_provider=nat_gateway_provider)

security_group = ec2.SecurityGroup(self, "SecurityGroup",
    vpc=vpc,
    allow_all_outbound=False
)
security_group.add_egress_rule(ec2.Peer.any_ipv4(), ec2.Port.tcp(443))
for gateway_instance in nat_gateway_provider.gateway_instances:
    gateway_instance.add_security_group(security_group)

Attributes

INBOUND_AND_OUTBOUND

Allow all outbound and inbound traffic.

NONE

Disallow all outbound and inbound traffic.

OUTBOUND_ONLY

Allow all outbound traffic and disallow all inbound traffic.