Overview
Curated: · Written: · Reviewed:
Cloud-Native Network Security
In one line
Cloud-native network security decides which workloads can reach which, using security groups, network ACLs, private networking and identity-aware access. Reach for it whenever a failing connection or an exposure turns on whether a packet should arrive, and say up front that network placement authenticates nobody.
Key definitions
- Security group (SG): stateful allow-list attached to an ENI or workload. Return traffic for an allowed flow is permitted automatically.
- Network ACL (NACL): stateless rules at the subnet boundary, numbered and evaluated in order, allow and deny. Each direction is checked separately.
- Ephemeral port range: the client-side source ports used for return traffic. AWS documents 1024-65535 for clients; a Linux host's own default is narrower.
- NetworkPolicy: Kubernetes L3/L4 pod policy. It only enforces if the CNI enforces it.
- Private endpoint: a private address for a managed service. It removes public exposure and authorizes nobody.
- Metadata hop limit: set to 1 so containerized workloads cannot reach instance metadata.
How it works
- A packet meets the route table, then the NACL at the subnet edge, then the SG on the ENI, then the host listener.
- An SG tracks connection state. Allow inbound 443 and the reply is permitted without a rule.
- A NACL tracks nothing. The inbound SYN is checked against inbound rules. The SYN-ACK leaves the subnet and is checked against outbound rules, so the ephemeral range must be allowed outbound.
- Pod traffic is overlay traffic that often never crosses a subnet boundary, so SGs and NACLs cannot see it. NetworkPolicy enforced by the CNI does that job.
When to use and when not to
| You need to | Use | Why |
|---|---|---|
| Allow one workload to reach another on a port | Security group | Stateful, per ENI, no return-path rules |
| Deny a source CIDR across a whole subnet | NACL | SGs can only allow |
| Control pod-to-pod traffic | NetworkPolicy on an enforcing CNI | SGs and NACLs do not see overlay traffic |
| Allow egress by hostname | CNI FQDN policy or managed firewall | Standard NetworkPolicy is L3/L4 only |
| Authorize by HTTP method or path | Service mesh L7 policy | L3/L4 rules cannot read the request |
| Remove public exposure of a managed service | Private endpoint with public access disabled | Keeps traffic on provider backbone, authorizes nobody |
A service mesh is overkill for a small system with one trust domain. NetworkPolicy plus identity at the edge is usually enough there.
Traps interviewers probe
- Calling NACLs stateful because they "remember" rules. Rule numbers set evaluation order and track no connections. Fix: allow inbound 443 and add an outbound rule for the client ephemeral range. A missing outbound rule drops the SYN-ACK, and the client sees a timeout with the SYN reaching the server.
- Expecting an SG to deny. SGs are allow-only. Fix: use a NACL deny rule for a subnet-wide block, or a managed firewall for centralized policy.
- Treating a private endpoint as secure by itself. Fix: confirm DNS resolves to the private address from every consumer network, disable public access, and add an endpoint policy or an IAM condition such as aws:SourceVpce.
- Trusting X-Forwarded-For. Anyone who can reach the backend directly can set it. Fix: restrict the backend so it accepts traffic only from the proxy, and only then trust the header.
- Leaving egress open with metadata reachable. Fix: require IMDSv2 with hop limit 1, deny the link-local range in NetworkPolicy, and restrict egress by destination or FQDN. A default-deny egress policy must still allow DNS to CoreDNS, or everything breaks silently.
Interview tips
Opening: Name the layers before the control: route, NACL, SG, host, then identity. Say network controls decide reachability and identity controls decide authorization.
Expected follow-ups:
- Why does this connection fail? Trace it layer by layer; do not guess at the SG.
- How do you secure pod-to-pod traffic? Default-deny NetworkPolicy, selectors, the DNS egress rule, and confirm the CNI enforces it.
- Is a private endpoint enough? No. It removes exposure; endpoint policy and IAM do the authorizing.
- How do you keep IPv4 and IPv6 controls equal? Audit both rule sets and test both paths.
- How do you prove a rule is safe to delete? Flow-log silence is not proof. Pair it with owner confirmation and a reversible disable window.
- An instance was exposed for six hours. What now? Preserve flow logs and rules, reconstruct who could reach it, rotate credentials, and validate closure from every path.
30-second outline:
- Name the path and the layer that decides reachability.
- State that an SG is a stateful allow-list and a NACL is stateless, ordered and checked in both directions.
- Give the control for this requirement: NetworkPolicy, private endpoint, or egress firewall.
- State what it does not decide: authorization still needs identity.
- Name the proof: positive and negative probes, plus flow logs.
Feedback on this overview
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.