

We have named that condition “trusted-ips”

Here is how to do that (assuming you already have a CloudFront distribution and Application Load Balancer setup). You can replace this lambda with the recently launched WAF (web application firewall) for ALB (application load balancers) . This may limit you in other ways, as you can add only 5 security groups to a resource. This seems fine, but if you want to allow both HTTP and HTTPS, you’ll have to split the 64 rules over two groups. There are now 32 IP ranges used by CloudFront, and you can add only 50 rules in a security group. If you’ve been using a Lambda function to update security groups that grant CloudFront access to your resources, you may have seen problems starting to appear the last few days.
