It’s worth understanding how the VPC parts work around your EC2 instance as well. Your EC2 instance will live in a subnet which is part of a VPC. Your VPC can have an internet gateway attached to it. Your subnet can then have a route configured to your internet gateway. This makes the subnet ‘public’ allowing which allows public IPs to be associated with your EC2 instance. It’s important to note that the public IPs are not assigned directly to your EC2 instance, but to the internet gateway, which then maps that traffic to the internal IP of your EC2 instance within the subnet. This is why you won’t ever see your public IP configured on a nic in the OS of your EC2 instance. WAF either runs on cloudfront, or on an application load balancer, so the more detailed side of the right side of your network flow is
Cloudfront (+WAF) > VPC( Internet Gateway > Public Subnet > EC2 instance)
Or VPC( Internet Gateway > Public Subnet > Application Load Balancer (+ WAF) > EC2)
Usually with load balancer you put EC2 in a private subnet (no route to internet gateway) so it’s isolated from the internet
Wow. Thanks for this piece of info. Now that makes much better sense. Do you recommend me any Material, videos, courses online to get familiar with aws and more imp networking in general