How to block/redirect traffic from outside the United States to my AWS Lightsail Wordpress instance

0

I am trying to stop spam contact form entries from foreign countries outside the United States on my WordPress website and would like some help understanding how to do that via any free options AWS may have or the cheapest way I can do so. I am using Route53 for my DNS and as I mentioned, LightSail for the instance. I have reviewed the AWS documentation on how to add and remove firewall rules and think I would do this in LightSail and tried to use ChatGPT to fill in my knowledge gaps to complete it but unfortunately I am having trouble figuring out the correct firewall rule(s) to make and what CIDR range(s) of IP addresses to use. Ideally I am looking for step by step instructions but any help is appreciated.

2回答
1

Hello.

If you use AWS services, you can set up AWS WAF to block access from outside the United States.
https://repost.aws/knowledge-center/waf-allow-block-country-geolocation

However, AWS WAF requires CloudFront or ALB, so using it with Lightsail requires some ingenuity.
Please note that AWS WAF incurs charges when used.
https://aws.amazon.com/jp/blogs/compute/integrating-aws-waf-with-your-amazon-lightsail-instance/

By the way, Lightsail's firewall seems to have a maximum of 60 rules, so it may be difficult to configure it to allow all US IP addresses.
https://repost.aws/knowledge-center/lightsail-considerations-for-use

13. Number of Lightsail firewall rules: You can add up to 60 firewall rules for a Lightsail instance. Each source IP address is considered a different rule. IPv6 rules are counted towards this quota of 60. The maximum number of source IP addresses that can be added in a rule using the Lightsail console is 30. To add more, you can use the AWS CLI.

profile picture
エキスパート
回答済み 7ヶ月前
0

Hi,

Yes, you'll likely need to use WAF to configure the rules. Here is a blogpost which may give some idea around how one can integrate WAF with a Lightsail instance: https://aws.amazon.com/blogs/compute/integrating-aws-waf-with-your-amazon-lightsail-instance.

AWS
回答済み 7ヶ月前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ