我目前的设置包括CloudFront和Elastic Beanstalk。如何配置相应LoadBalancer的安全组,以便只有来自CloudFront的请求才能通过LoadBalancer?
这可以通过使用云前端IP地址设置安全组并将EC2实例限制到该安全组来完成。由于Cloudfront IP一直在变化,this will be updated with a Lambda Function。
Full Directions Are Here,但这里是悬崖笔记:
{“Version”:“2012-10-17”,“Statement”:[{“Effect”:“Allow”,“Action”:[“logs:CreateLogGroup”,“logs:CreateLogStream”,“logs:PutLogEvents”] ,“资源”:“arn:aws:logs :::”},{“效果”:“允许”,“操作”:[“ec2:DescribeSecurityGroups”,“ec2:AuthorizeSecurityGroupIngress”,“ec2:RevokeSecurityGroupIngress”], “资源”:“”}}}
注意:看一下您创建的组,现在他们已经填充了一大堆CloudFront IP条目。
Lambda函数将使您的IP列表保持同步。
您可以在Elastic BeanStalk上放置IAM角色,以仅允许来自CloudFront的传入消息。或者您只能允许从某个端口访问ELB实例,然后将CloudFront过滤到该端口。例如,Port 443
是HTTPS
,通过Port 443
授予CloudFront访问ELB,然后在您的Security-Group上,只允许CloudFront访问它的IP对实例的入站访问。
检查this了
您可以创建仅允许CloudFront并使其自动更新的安全组。您还可以在发行版和Elastic Beanstalk环境之间添加自定义标头(预共享密钥)。