Tech Blog

Cloud Computing

Set up AWS Web Application Firewall(WAF)

By Sabya Sachi2 min read
← Back to blog

Why WAF?
Apart from already deployed firewalls, WAF provides an extra layer of security. It defends our web applications & APIs from common web attacks/exploits and bots like Internet threats. It also helps a lot in monitoring and controlling unusual bot traffic and common attack patterns.

How it works?-There are mainly 4 parts of this configuration.
1) AWS WAF 2)Create a policy 3) Block Filters 4) Monitor
Below is a flow diagram of the setup for reference.

How to set up?– Firstly we should have an active AWS account to begin with. Then search for WAF & Shield and it will land us on WAF Home.
Select Create a Web ACL> name it>Description – optional>CloudWatch metric name- change the default name if required> Resource type- choose as per requirement> Region- choose the one where we want to deploy.

Add rules and rule groups- Here we will have 2 options. Managed rule groups & own rules and rule groups. We can choose any 1 as per our requirement. For example we are going ahead with 1 managed rule group.
Managed Rule Groups> Cyber Security Cloud Inc. managed rule groups> Cyber Security Cloud Managed Rules for AWS WAF -HighSecurity OWASP Set > Add Rule

Set rule priority-
If we are setting up more than 1 rules, then we can set its execution afinity here by ascending order

Configure metrics- Here we can edit the cloudwatch metric name as per our requirement and set the sampling options.

Review and create web ACL- Click ‘create web ACL’ button to create it. At this point our WAF is created successfully. We can use it for various options like App LB, cloudfront or api gateway etc. For example- lets consider an application load balancer.
Select the created WAF and head over to Associated AWS Resources tab> Click on Add AWS Resources> Click Application Load Balancer> Select the load balancer you want to protect.

Extras & Troubleshooting-
If the added k8s load balancer gets removed automatically from resource list, then add below tag to LB ingress under annotations tag with proper ID. Note that waf-acl-id will be available on the console as shown, under tag “ID”.
alb.ingress.kubernetes.io/waf-acl-id: ea199076-xxx-xxxx-xxxx-xxxxxxxxxxx

Keep reading

You may be interested in

Browse all articles →
How to Configure AWS CLI?
December 30, 20224 min read

How to Configure AWS CLI?

In Cloud platforms such as AWS, GCP, and Azure we have multiple ways to access cloud services and our resources like GUI (Console), CDK, and CLI. In today’s blog, we are going to look at CLI access in AWS. Like all other cloud providers, AWS also provides CLI access to their services for that first […]

By Keerthik ShenoyRead More →
AWS Automation with Python Boto3
December 30, 20223 min read

AWS Automation with Python Boto3

Automation plays a major role in In Cloud and DevOps, we have many tools to automate manual processes like Infrastructure automation with Terraform, for CICD Jenkins, GitLab, AWS, code pipeline, etc. In the same way, we can automate some of the AWS tasks with a simple python script using the oto3 library. Let’s see some […]

By Keerthik ShenoyRead More →
AWS Cost Optimization Techniques
December 15, 20224 min read

AWS Cost Optimization Techniques

AWS is the world’s leading cloud computing platform, providing a wide range of services including computer computing, storage, networking, and platform as a service (PaaS). AWS cost optimization requires identifying areas for cost-saving measures, tracking your usage, and putting advice into practice. Your Amazon costs are largely influenced by the cost of EC2 instances provided […]

By Keerthik ShenoyRead More →