This
chapter explains what components/services and configurations we need to allow
Internet traffic to and from an EC2 instance. VPCs themselves are closed
entities. If we need an Internet connection, we need to use an AWS Internet
Gateway (IGW) service. The IGW is running on a
Blackfoot Edge Device in the AWS domain. It performs Data-Plane VPC
encapsulation and decapsulation, as well as
IP address translation. We also need public, Internet routable IP
addresses. In our example, we allocate an AWS Elastic-IP (EIP) address. Then we
associate it with EC2 Instance. By doing it, we don’t add the EIP to the EC2
instance itself. Instead, we create a static one-to-one NAT entry into the VPC
associated IGW. The subnet Route Table includes only a VPC’s CIDR range local
route. That is why we need to add a routing entry to the Subnet RT, default or
more specific, towards IGW. Note that a subnet within an AWS VPC is not a
Broadcast domain (VPC doesn’t even support Broadcasts). Rather, we can think of
it as a logical place for EC2 instances having uniform connection requirements,
like reachability from the Internet. As a next step, we define the security
policy. Each Subnet has a Network Access Control List (NACL), which is a
stateless Data-Plane filter. The Stateless definition means that to allow
bi-directional traffic flow, we have to permit flow-specific Request/Reply data
separately. For simplicity, we are going to use the Subnet Default NACL. The
Security Group (SG), in turn, is a stateful EC2 instance-specific Data-Plane
filter. The Stateful means that filter permits flow-based ingress and egress
traffic. Our example security policy is based on the SG. We will allow an SSH
connection from the external host 91.152.204.245 to EC2 instance
NWKT-EC-Fron-End. In addition, we allow all ICMP traffic from the EC2 instance
to the same external host. As the last part, this chapter introduces the
Reachability Analyzer service, which we can use for troubleshooting
connections. Figure 3-1 illustrates what we are going to build in this chapter.

Figure 3-1: Setting Up an Internet Connection for Public
Subnet of AWS VPC.