What is the best way to attach instance to auto scaling?

This is my first post so hope I will get the answer.

I want to create auto scaling on my existing EC2 instance, so I found this approach so hope someone will tell me is it good ( or suggest me how to make it )

So I open my EC2 dashbord

  • Click on my instance

  • Then action -> Instance Settings -> Attach to Auto Scaling Group

  • After that I write name of my Auto Scaling Group ( it will be 'project' same as my instance name )

  • I press 'Project' and its automaticly create auto scaling group for me

  • Then I press attach

  • After that I go to my autoscaling group page and I see 'Project'

Is that all what I have to do to active it ?

In next 10 days I expect high traffic and I think this is the best solution.


What exactly are you hoping to achieve? Capacity auto-scaling based on traffic is a lot more complex than what you described above.

First of all: You don’t attach an instance to ASG (Auto Scaling Group), instead the ASG creates the instance(s) based on your instructions / image / template. (it is possible to attach the instance to ASG but it isn’t usually done that way)

When the traffic grows the ASG creates more of the same instances, all the same based on the same template or image. When the traffic drops again it terminates some of instances to remove the excessive capacity.

The key point is that you must have a way to automatically configure your instances without any manual intervention when they start. This can be done by creating an image (AMI) from your running instance and use that in the ASG.

Also be prepared that they can come down at any moment again, which means that they must not hold any persistent data (eg database, user-uploaded images, etc). Use a shared database (RDS) and a shared filesystem (EFS) for the persistent data.

You will also need a load-balancer (ALB) that will distribute the traffic between the instances more start up.

And finally you’ll have to configure CloudWatch alarms for the scaling policies, eg add an instance when the average CPU load in the ASG is over 70% and remove instance when it drops below 20%, something like that.

So yeah, auto-scaling is no as trivial as attaching an instance to the group and be done with it.

Hope that helps :)