# NatTrafficDirection

Direction of traffic to allow all by default.

- Source: [`aws-ec2/lib/nat.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-ec2/lib/nat.ts#L26)

## Example

```ts
const natGatewayProvider = ec2.NatProvider.instanceV2({
  instanceType: new ec2.InstanceType('t3.small'),
  defaultAllowedTraffic: ec2.NatTrafficDirection.NONE,
});
const vpc = new ec2.Vpc(this, 'Vpc', { natGatewayProvider });

const securityGroup = new ec2.SecurityGroup(this, 'SecurityGroup', {
  vpc,
  allowAllOutbound: false,
});
securityGroup.addEgressRule(ec2.Peer.anyIpv4(), ec2.Port.tcp(443));
for (const gatewayInstance of natGatewayProvider.gatewayInstances) {
   gatewayInstance.addSecurityGroup(securityGroup);
}
```

## Members

| Member | Description |
| --- | --- |
| `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. |

## Referenced by

- [`NatInstanceProps`](/v2/docs/aws-cdk-lib.aws_ec2.NatInstanceProps).defaultAllowedTraffic
