nlr25
nlr25

Reputation: 1635

Autoscaling with EC2 and your webapp

I am trying to set up autoscaling on AWS but have a few clarifying questions I could not find in the developer's guide.

I have set up a launch config and autoscaling policy with minimum instances = 2. I am assuming my 2 EC2 instances are blank (only OS installed). I need my web application installed in the instance. What is the best way to accomplish this?

My thinking:

 Create an EC2 instance with my web app and then attach an autoscale policy to it

Is there a better way?

Upvotes: 1

Views: 109

Answers (1)

Dmitry Mukhin
Dmitry Mukhin

Reputation: 6937

Autoscaling launch configurations work with AMIs. So you have to create an AMI from your EC2 instance and set this AMI (not empty OS) for launch configuration.

So one of possible ways:

  1. create an instance
  2. deploy working app to this instance
  3. create AMI from the instance (with or without restart)
  4. create launch configuration using fresh AMI
  5. create autoscaling group and set its launch configuration to created one.

Every time group is scaled up, fresh instance created from AMI is added to group.

To update your app running in autoscaling group you have two options:

  1. update original instance, create fresh AMI, create new launch config, update scaling group
  2. build auto provisioning into your app that will self update when fresh instance is created

Upvotes: 1

Related Questions