How to update security group rules and WAF rules with dynamic ip address

0

Hi, need some advice here. We switched our broadband service provider and the subscription plan. The new plan does not provide a fixed ip address. In the past, we used the fixed ip address as the source in our inbound rule of some security groups to allow traffic from our office. But now, the office ip address keeps changing. How can I manage the inbound rules automatically when the ip address changes on the router side?

2 Answers
2
Accepted Answer

You could create a Lambda function to update the security group(s) for you - but how will you know when the IP address changes?

Putting my "how would I hack this together" hat on:

If there is a DNS record which you could look up and it provides the IP address: Trigger the Lambda function every 'x' minutes using an EventBridge rule; if the IP address is different to the one in the security group then update it. Not the most efficient way but it would work.

If you have some compute device on premises I would have it check to see that the external/public IP address is - it is has changed then that device could (with the right permissions) update the security group directly; or it could trigger the Lambda function via API Gateway or a Lambda function URL.

So it comes down to: How do you know when the IP address changes?

profile pictureAWS
EXPERT
answered a month ago
profile picture
EXPERT
reviewed a month ago
1

Hello.

How about using AWS ClientVPN and NAT Gateway to set a fixed IP as introduced in the AWS blog below?
Although costs such as NAT Gateway will be incurred, there is no need to introduce a mechanism to update security group inbound rules to dynamic IP addresses.
https://aws.amazon.com/jp/blogs/networking-and-content-delivery/using-aws-client-vpn-to-scale-your-work-from-home-capacity/

profile picture
EXPERT
answered a month ago
profile picture
EXPERT
reviewed a month ago
  • ClientVPN and NAT are both expensive. Will adopt the solution proposed by Brettski above. Thanks.