How to block the request from a particular country using WAF

0

I have deployed microservice application on ECS in Mumbai region but my customers are from Sri Lanka how can I block the access to the application from other countries except Sri Lanka, when I set Sri Lanka in the WAF rules its blocking all the services as the inter service communications are originated from Mumbai. How to handle this ?

Eg: I am requesting pricing service from SL and pricing service will communicate the location service. Country for pricing service will be Sri Lanka but for the location service it's India as it communicated by pricing service in Mumbai

已提問 2 個月前檢視次數 173 次
2 個答案
2

You can either use WAF Geo Blocking or Cloudfront Geo Blocking if you are using a CDN . In case you dont want to use either of these you can configure your NACLs to block IP address ranges. There is an additional solution using AWS Network Firewall.

(a) If you are taking the Cloudfront approach then please do note CloudFront determines the location of your users by using a third-party database. The accuracy of the mapping between IP addresses and countries varies by Region. Based on recent tests, the overall accuracy is 99.8%. If CloudFront can’t determine a user’s location, CloudFront serves the content that the user has requested. There are no charges for Cloudfronts Geo-Blocking.

(b) If you are using the WAF solution you will need to consider a whitelisting approach as mentioned in the knowledge based article "https://repost.aws/knowledge-center/waf-allow-block-country-geolocation"

(c) In case of NACLs you will need to customize your solution and will need some effort to aggregate different subnet ranges. Please also note the NACL limitations while designing a NACL based solution https://docs.aws.amazon.com/vpc/latest/userguide/amazon-vpc-limits.html#vpc-limits-nacls .

(d) You can consider AWS Network Firewall with Amazon GuardDuty to implement Geo-Blocking as well https://aws.amazon.com/blogs/security/automatically-block-suspicious-traffic-with-aws-network-firewall-and-amazon-guardduty/

The below blogs and articles should be of additional help

https://aws.amazon.com/blogs/security/how-to-use-granular-geographic-match-rules-with-aws-waf/

https://aws.amazon.com/blogs/networking-and-content-delivery/geo-block-content-using-amazon-location-and-edge-services/

https://aws.amazon.com/developer/application-security-performance/articles/geo-blocking/

profile pictureAWS
Avinash
已回答 2 個月前
profile picture
專家
已審閱 2 個月前
0

I hope the below URL will help you.

How do I allow or block requests from a specific country or geolocation using AWS WAF? https://repost.aws/knowledge-center/waf-allow-block-country-geolocation

AWS
專家
hyp
已回答 2 個月前
profile picture
專家
已審閱 2 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南