Skip to content

Instantly share code, notes, and snippets.

@alukach
Last active April 26, 2023 07:32
Show Gist options
  • Save alukach/1d22bbc6212dc3b850df85db33077129 to your computer and use it in GitHub Desktop.
Save alukach/1d22bbc6212dc3b850df85db33077129 to your computer and use it in GitHub Desktop.
Should I use a NAT in my project?

A quick dump of criteria for deciding whether your project needs a NAT and, if so, what type it should be.

graph TD
    A(Do you need a NAT?) --> B
    B{Do you have services in a Private Subnet that\nneed to access resources outside of the network?}
    
    B -->|No| NotNeeded[You don't need a NAT]
    B -->|Yes| C
    C{Can you move those resources in a Public Subnet?} -->|Yes| PublicSubnet[Move to a Public Subnet instead] --> NotNeeded
    C -->|No| D
    D{Can you get away with only being able\nto communicate with AWS services?}
    D -->|Yes| usePrivateLink[use PrivateLink instead] --> NotNeeded
    D -->|No| E
    E{Are you trying to do this on the cheap\nand don't mind the entirety of your outbound internet\nconnections relying on a single EC2 instance?} --> |Yes| UseNatInstance[Use a NAT Instance\nhttps://www.azavea.com/blog/2015/01/05/selecting-a-nat-instance-size-on-ec2\nhttps://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-network-bandwidth.html]
    E --> |No| F
    F{Is this an egress-heavy application?}
    F --> |Yes| UseNatInstance
    F --> |No| UseNatGateway[Use a NAT Gateway]
Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment