Firewalls
In simple terms, the firewall is a component that is responsible for monitoring and controlling the incoming and outgoing traffic depending on the rules configured.
If we look into a cloud environment, such as AWS, they provide firewall functionality through a security group, which is attached to each EC2 instance and through NACL, which is attached to an entire subnet.
How a firewall works?
The firewall acts as the front end for receiving packets from remote servers. Whenever a request comes, it is first received at the firewall end:

The firewall will check its Rule table to see if a particular IP is allowed to connect to the remote Server on the specified Port.
If the rule is Allow, then the firewall will allow the packet to go inside; however, if it is denied, then the access is blocked.
There are three major sets in which rules are configured:
- Source IP address
- Destination port
- Rule (Allow or Deny)
If we look at the preceding diagram, the IP address starting from 52.24.52.24
is allowed...