简体   繁体   English

通过示例自动扩展负载平衡的 EC2 实例

[英]Auto-scaling load balanced EC2 instances by example

I am reading up on AWS Auto Scaling Groups and trying to understand (from a network-perspective) how the following resources all fit together:我正在阅读AWS Auto Scaling Groups并试图(从网络角度)了解以下资源如何组合在一起:

  • Auto Scaling Group (ASG)自动缩放组 (ASG)
  • Application Load Balancer (ALB)应用程序负载均衡器 (ALB)
  • Individual EC2 instances sitting behind the ALB位于 ALB 后面的单个 EC2 实例
  • ALB Listeners ALB 监听器
  • ALB Target Groups ALB 目标群体
  • Security Group(s) enforcing which IPs/ports are allowed access to the EC2 instances强制哪些 IP/端口被允许访问 EC2 实例的安全组

I understand what each of these does in theory, but in practice, I'm having trouble seeing the forest through the trees with how they all snap together.我理解它们在理论上的作用,但在实践中,我很难通过树木看到森林以及它们是如何结合在一起的。 For example: do I configure the EC2 instances to be members of the Security Group?例如:我是否将 EC2 实例配置为安全组的成员? Or do I do that at the balancer-level?还是我在平衡器级别这样做? If I attach the ALB to the Auto Scaling Group, then why would I need to do any additional configuration with an ALB Target Group?如果我将 ALB 附加到 Auto Scaling 组,那么我为什么需要对 ALB 目标组进行任何其他配置? When it comes to routing, do I route port 80 traffic to the ALB or the Auto Scale Group?在路由方面,我是将端口 80 流量路由到 ALB 还是 Auto Scale Group?

I know these are lots of small questions, so the main question here is: how do all of these snap together to provide a load balanced web server hosted on EC2 instances?我知道这些都是很多小问题,所以这里的主要问题是:如何将所有这些组合在一起以提供托管在 EC2 实例上的负载均衡 Web 服务器? Ultimately I need to configure all of this inside a CloudFormation template, but a diagram or explanation to help me configure everything manually is probably the best place for me to start.最终,我需要在 CloudFormation 模板中配置所有这些,但是帮助我手动配置所有内容的图表或说明可能是我开始的最佳位置。 Thanks for any help!谢谢你的帮助!

do I configure the EC2 instances to be members of the Security Group?如何将 EC2 实例配置为安全组的成员? Or do I do that at the balancer-level?还是我在平衡器级别这样做?

The EC2 instances should be a member of one security group. EC2 实例应该是一个安全组的成员。 The Load Balancer should be a member of another security group.负载均衡器应该是另一个安全组的成员。 The Load Balancer's security group should allow incoming traffic from the Internet.负载均衡器的安全组应该允许来自 Internet 的传入流量。 The EC2 instances should allow incoming traffic from the load balancer. EC2 实例应允许来自负载均衡器的传入流量。

If I attach the ALB to the Auto Scaling Group, then why would I need to do any additional configuration with an ALB Target Group?如果我将 ALB 附加到 Auto Scaling 组,那么我为什么需要对 ALB 目标组进行任何其他配置?

If you are using an auto-scaling group to create the instances, then you don't have to do any manual updates to the target group, the auto-scaling group will handle those updates for you.如果您使用自动伸缩组来创建实例,那么您不必对目标组进行任何手动更新,自动伸缩组将为您处理这些更新。

When it comes to routing, do I route port 80 traffic to the ALB or the Auto Scale Group?在路由方面,我是将端口 80 流量路由到 ALB 还是 Auto Scale Group?

An Auto-scaling group is not a resource that exists in your network. Auto-scaling 组不是您网络中存在的资源。 It is a construct within AWS that just creates/removes EC2 servers for you based on metrics.它是 AWS 中的一个构造,它只是根据指标为您创建/删除 EC2 服务器。 The traffic goes to the load balancer, and the load balancer sends it to the EC2 instances in the target group.流量进入负载均衡器,负载均衡器将其发送到目标组中的 EC2 实例。

I know these are lots of small questions, so the main question here is: how do all of these snap together to provide a load balanced web server hosted on EC2 instances?我知道这些都是很多小问题,所以这里的主要问题是:如何将所有这些组合在一起以提供托管在 EC2 实例上的负载均衡 Web 服务器? Ultimately I need to configure all of this inside a CloudFormation template, but a diagram or explanation to help me configure everything manually is probably the best place for me to start.最终,我需要在 CloudFormation 模板中配置所有这些,但是帮助我手动配置所有内容的图表或说明可能是我开始的最佳位置。

It's a bit much to ask somebody on here to spend their free time creating a diagram for you.要求这里的人花费他们的空闲时间为您创建图表有点过分。 I suggest looking at the AWS reference WordPress implementations which they tend to use for providing reference implementations of auto-scaled web server environments.我建议查看 AWS 参考 WordPress 实施,他们倾向于使用这些实施来提供自动扩展 Web 服务器环境的参考实施。

See the "WordPress scalable and durable" CloudFormation template example here .请在此处查看“WordPress 可扩展且持久的”CloudFormation 模板示例。

See the AWS WordPress Reference Architecture project here , which includes a diagram.请参阅此处的 AWS WordPress 参考架构项目,其中包含一个图表。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Ansible:将正在运行的EC2实例添加到“自动伸缩”组 - Ansible : Add running EC2 instances to Auto-scaling group Lambda 不适用于具有自动缩放功能的 ec2 - Lambda not working for ec2 with auto-scaling 仅使用具有弹性负载平衡和自动扩展功能的AWS EC2进行扩展 - Scaling only with AWS EC2 with Elastic Load Balancing and Auto-Scaling 有什么方法可以在不使用自动缩放选项的情况下复制我们的AWS EC2实例? - Is there any way to replicate our AWS EC2 instances without using Auto-scaling option? 如何在Amazon Auto-scaling组中的多个ec2实例上部署和更新应用程序? - How to deploy and update app on multiply ec2 instances in Amazon Auto-scaling group? 如何将AWS SQS与现货实例EC2工作者和长期运行的工作的自动扩展一起使用? - How to use AWS SQS with auto-scaling of spot instances EC2 workers and long running jobs? EC2 实例的服务器代码是否会在启动后复制到属于 Auto-Scaling 组的其他实例? - Is an EC2 Instance's server code copied to other instances that are part of the Auto-Scaling Groups once they launch? 由 auto-scaling 组中的启动模板创建的 ec2 实例未在目标组中注册 - ec2 instances created by a launch template in auto-scaling group are not being registered with the target group AWS ECS:使用单容器主机自动扩展 EC2 自动扩展组 - AWS ECS: Auto-Scaling an EC2 Auto-Scaling Group with Single-Container Hosts 通过自动缩放功能自动启动EC2实例 - Automatic start of an EC2 instance with auto-scaling
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM