I am currently setting up an environment in which we would like to have one server auto scaled and load balanced based on resource usage. I created the load balancer and have the instance running under the load balancer and everything is working fine so far.

I would like to create an auto scaling group that will just the replicate the running machine instead of a creating another instance from a taken image which will be not up to date in the future. Is there a way to do this?


No, there is no way to directly do what you propose. Think about your proposal for a minute - when using an ASG, the whole idea is that your instances are ephemeral. Any of them should be able to be killed at any time without negatively affecting your application. In your proposal, how would the ASG "know" which instance is the most up-to-date at any one time? It can't.

When creating your ASG, you need to specify an AMI which will be used for the group instances. There are generally two patterns which are used to ensure that the ASG AMI is up-to-date.

  1. Create a script that runs on boot which updates your application code on each new ASG instance before putting it into service behind the load balancer.
  2. As part of your code deployment automation, build a new AMI for each release and then modify the ASG configuration to include the new AMI.

If you're able to deploy your application code and necessary configuration quickly, say in under a minute or two, I'd go with option #1. If it takes longer than that, door #2 may be more appropriate.

For either of these cases, though, the single most important thing is that you are using some sort of configuration management to do your server builds. If manual steps are involved, things will get missed and you will end up with incorrectly-configured ASG instances.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.