IP Blocking: Use AWS WAF or NACL?
What should you do if you identified a series of malicious attacks on your application coming from a specific IP address? Will you use AWS WAF to block that IP address or create a rule in your Network Access Control List to deny traffic from that IP?
It is true that AWS WAF can filter web requests based on IP addresses, HTTP headers, HTTP body, or URI strings, to block common attack patterns, such as SQL injection or cross-site scripting. NACL, on the other hand, acts like a firewall for controlling traffic in and out of your subnets.
If the scenario is more about protecting your application from common web exploits (SQL injection or cross-site scripting), then AWS WAF would be a more suitable choice. Otherwise, you should choose NACL if it explicitly requires the need to block all traffic based on a given IP address or range.
In real-world scenarios, a hacker will not just use a single IP address to attack you. These guys will just use one IP address after the other. This is why it is difficult to individually block a malicious IP address or range using NACL. If you have a private web application (which is only used within your corporate network), the better solution would be to use a whitelist approach where you only allow authorized IP address/range to access your VPC. For public web applications, using the AWS WAF would be a better choice.
Additional Reading Materials:
Cheat Sheet on AWS WAF:
Cheat Sheet on Amazon VPC:
?
AWS Cloud Engineer
5 年Use NACL, because you stated the attack is coming from a specific IP address, adding a rule in NACL for that address will do the work.
Engineering Chapter Lead - Integration, Automation and SRE - Digital Transformation and HR Strategy
5 年Thanks for sharing your experience
Technical Writer II
5 年Thanks for the info pre!
DevOps Manager | Kafka |Kubernetes|Agile| GitHub |Service Delivery|Support | CICD | Argos
5 年Amazing...