AWS EC2自动缩放:定义一个永不终止的主实例 [英] AWS EC2 Autoscaling: Defining a master instance, which is never terminated

查看:325
本文介绍了AWS EC2自动缩放:定义一个永不终止的主实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用具有自动缩放和负载平衡功能的EC2来托管我的Web应用程序.为了保证EC2实例之间的一致性,我只希望允许从一个实例访问管理界面,因此所有写操作都在该实例上执行.然后,其他实例会定期下载已更改文件的副本.

I am using EC2 with autoscaling and loadbalancing to host my webapp. To guarantee consistency between the EC2 instances, I only want to allow access to the administration interface from one instance, so all write operations are executed on this instance. The other instaces then periodically download copies of the changed files.

这是我的问题:

我可以在自动缩放组中有一个指定的主"实例,该实例略有不同(运行用于上传写入文件的脚本)吗?当然,无论如何都不应关闭该实例.所有其他从属"实例都是相同的,可以根据需要创建和终止.是否有某种配置选项,或者我可以使用策略来做到这一点?

Can I have a designated "Master" Instance, in my autoscaling group, which is slightly different (runs script for uploading files which were written to)? Of course this Instance should never be shut down, no matter what. All the other "Slave" Instances are indentical an can be created and terminated on demand. Is there some sort of configuration option for this or can I do this with a policy?

推荐答案

我的建议是两件事之一,要么有两个自动缩放组-一个用于只读实例(即非主实例),然后是第二个ASG对于主实例.即使在任何时候只有一个主实例,您仍然可以通过利用ASG能够检测到它何时发生故障并启动一个新实例来替换它的能力,将其包括在自己的自动伸缩组中,从而从中受益.

My suggestion would be one of two things, either have two autoscaling groups - one for the readonly instances (i.e. the non-master), and then a second ASG for the master instance(s). Even if there is only one master instance at any time, you can still benefit by including it in its own autoscaling group by taking advantage of the ability for the ASG to detect when it has failed, and spin up a single new instance to replace it.

或者,将主实例完全保留在自动缩放范围之外,而仅将其作为保留实例运行-让其余的RO实例根据需要进行缩放.

Alternatively, leave the master instance out of the auto-scaling altogether, and just run it as a reserved instances - let the rest of the RO instances scale up and down as necessary.

这篇关于AWS EC2自动缩放:定义一个永不终止的主实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆