One of the most underrated building blocks in AWS: the ENI.
You launch an EC2 instance, choose a subnet, and get a private IP address.
But what connects that instance to your network?
👉The ENI: Elastic Network Interface.
1️⃣What is it, and why is it needed?
A physical computer uses a network card to communicate with other devices. An EC2 instance uses a virtual network card, called an ENI.
The instance provides the computing power: CPU and memory. The ENI provides its connection to a subnet in your VPC.
That is why every EC2 instance has a primary ENI, even when you never create one yourself. It is a required part of the instance’s networking—not an optional internet-access feature.
2️⃣How does it work?
Imagine your EC2 instance has the private IP address 10.0.1.10.
That address is assigned to its ENI. The interface also has a MAC address and associated security groups. An ENI can hold more than one IP address.
When another application connects to 10.0.1.10, the traffic reaches your instance through that interface. The associated security groups control which incoming and outgoing traffic is allowed.
Choosing a subnet tells AWS where the connection belongs. The ENI gives the instance that connection.
3️⃣Who creates the ENI?
AWS creates one automatically: During a normal EC2 launch, AWS creates and attaches the primary ENI using your network settings. You do not need to create it separately.
You can create additional ones: These are secondary ENIs. You can attach them to compatible EC2 instances in the same Availability Zone when your design needs additional network interfaces.
Other AWS services create them for you: Some services create and manage ENIs in your VPC as part of their setup. You generally manage those through the service not by detaching their ENIs yourself.
4️⃣Where else are ENIs used?
RDS uses service-managed ENIs to connect database instances to your VPC.
Lambda creates or reuses managed ENIs when you configure a function to access resources in your VPC, such as a private database.
ECS on Fargate gives each task its own ENI for network communication.
EKS with the Amazon VPC CNI uses ENIs attached to EC2 worker nodes to support pod networking and assign VPC IP addresses to pods.
An ENI alone does not provide internet access. The appropriate routing and security settings still need to be in place.
IPv4 vs IPv6:
- IPv4 uses 32 bits and supports about 4.3 billion addresses.
- IPv6 uses 128 bits and supports 340 undecillion addresses.
- IPv4 commonly relies on NAT because addresses are limited.
- IPv6 was designed to support massive internet growth.
UNDERSTANDING CIDR BLOCK
A CIDR block divides an IP address into two parts: network bits and host bits.
1️⃣Network bits identify the network an IP address belongs to
2️⃣Host bits identify a specific IP address inside that network.
- Network bits → Which network?
- Host bits → Which address inside that network?
3️⃣Example: 192.168.1.0/24
An IPv4 address has 32 bits.
/24 means the first 24 bits are network bits.
How many bits are left for hosts?
32 - 24 = 8 host bits
With 8 host bits:
2⁸ = 256 total IP addresses.
So /24 tells you two things:
- 24 bits identify the network.
- 8 bits are available to identify addresses inside that network.
VPC Peering vs Transit Gateway
Both connect VPCs so applications in separate networks can communicate privately even across AWS accounts.
VPC Peering creates a direct connection between two VPCs.
Your traffic travels from VPC A to VPC B through their peering connection. You configure routes and security rules to permit the communication.
Transit Gateway is a central router that connects multiple networks.
Your VPCs attach to it, and its route tables determine where traffic goes. It can also connect to your on-premises network through VPN or Direct Connect via a Direct Connect gateway.
The key difference is transitive routing.
With peering, connecting A to B and B to C does not let A reach C through B. You need a separate A-to-C peering connection.
With Transit Gateway, A and C can communicate through the central gateway provided the routes and security controls allow it.
Peering connects a pair of networks. Transit Gateway can route between the networks attached to it.
Reminder 👇
⚡️Your load balancer goes in public subnets.
⚡️Your application goes in private subnets.
⚡️Your database goes in isolated subnets.
Don’t overthink it.
AWS networking is still networking.
Routers, subnets, IP addresses, and routing don’t disappear when you move to the cloud.
The implementation changes, not the fundamentals.
Understand the traditional network on the left, and the AWS VPC on the right becomes much easier.
Don’t overthink AWS VPC architecture.
Start with this foundation for a production web application:
1️⃣ Choose two Availability Zones.
Create three subnets in each AZ: one public, one private for applications, and one isolated for databases. That’s six subnets in total.
2️⃣ Put the load balancer in front of your application.
Deploy an internet-facing Application Load Balancer across both public subnets. Run your application instances in the private subnets across both AZs.
3️⃣ Keep the database in the isolated tier.
Use an RDS Multi-AZ DB instance deployment, with the primary in one AZ and a standby in the other. Keep the database subnets without routes outside the VPC.
4️⃣ Attach one Internet Gateway to the VPC.
Configure the public subnets’ route table to send internet-bound IPv4 traffic to it:
0.0.0.0/0 → IGW
5️⃣ Add NAT when your private applications need outbound internet access.
For a zonal NAT Gateway design, place one in each public subnet. Route each application subnet through the NAT Gateway in the same AZ for resilience.
6️⃣ Your application needs S3 or DynamoDB?
Add gateway VPC endpoints and associate them with the application subnet route tables. That traffic doesn’t need to pass through a NAT Gateway.
7️⃣ Multiple VPCs need to communicate?
Use VPC peering for direct VPC-to-VPC connections, or Transit Gateway to connect networks through a central hub.
8️⃣ Add a VPN for admin access.
Use AWS Client VPN so administrators can connect from their laptops and reach your servers through private IP addresses—without exposing SSH or RDP to the internet. Configure authentication, VPN routes, authorization rules, and security groups to allow only the access they need.
Don’t just memorize AWS services.
Once you understand how they connect, you can recreate this diagram in just a few minutes.
Kubernetes Authentication
Who can authenticate to a Kubernetes cluster, and how?
1️⃣Human Users
- Administrators
use client certificates or an identity provider through OIDC.
- Developers
commonly use OIDC, cloud IAM, or client certificates configured in kubeconfig.
- External users
may authenticate through an identity provider integrated with the cluster.
2️⃣Workloads and Kubernetes Components
- Pods
use ServiceAccount tokens automatically mounted or projected into the Pod.
- Kubelet
uses a client certificate to authenticate to the API Server
- Scheduler
uses a client certificate or kubeconfig credentials.
- Controller Manager
uses a client certificate or kubeconfig credentials.
- Kube-proxy
uses a ServiceAccount token or client certificate, depending on the setup.
Kubernetes Architecture Explained
When looking at a Kubernetes architecture diagram, pay close attention to the direction of the arrows. They show which component initiates the communication.
⚡️Control Plane Components:
1️⃣API Server
The entry point to the cluster. All requests pass through it.
2️⃣etcd
Stores the cluster state. Only the API Server communicates directly with etcd.
3️⃣Scheduler
Watches for unscheduled Pods and selects the best worker node for them.
4️⃣Controller Manager
Watches the cluster state and works to maintain the desired state.
⚡️Worker Node Components:
1️⃣Kubelet
Communicates with the API Server and ensures assigned Pods are running.
2️⃣Container Runtime
Pulls images and runs containers.
3️⃣Kube-proxy
Implements Service networking and routes traffic to Pods.
4️⃣CNI Plugin
Provides Pod networking and assigns IP addresses to Pods.
In a kubeadm cluster on AWS, admins connect to the API server, workers communicate with the control plane, and users access applications.
Use separate security groups for control plane and worker nodes to allow only the required traffic. 👇
If you are running a kubeadm Kubernetes cluster on AWS, you need to understand which ports your cluster uses.
Here is the list of ports for your control plane and worker node security groups.
2ND REASON TO CONSIDER MOVING YOUR APP FROM DOCKER TO KUBERNETES: RESTARTING UNHEALTHY CONTAINERS.
⚠️Your application is running in a Docker container.
The server is healthy. The container is running. But the application freezes and stops responding to requests.
Customers cannot use it, yet docker ps still shows the container as running.
You configured --restart=always. Why hasn’t Docker restarted it?
Because the container has not stopped. Its main process is still running, even though the application is stuck.
Docker HEALTHCHECK can detect the problem and mark the container as unhealthy. But standalone Docker does not automatically restart a container just because its health check fails.
✅You need to intervene or have additional automation handle it.
👉What changes with Kubernetes?
You configure a liveness probe: a check that helps detect when your application is stuck and needs restarting.
For example, you configure it to:
- Check the application every 10 seconds.
- Treat three consecutive failed checks as a failure.
- Trigger a restart of the affected container.
The kubelet on that server handles the restart. You do not need to log in, and the entire server does not need to restart.
You can achieve similar recovery with Docker, monitoring, and scripts, but Kubernetes gives you a built-in mechanism instead of making you maintain that recovery automation yourself.















