mastercool
mastercool

Reputation: 523

Is this the correct situation for AWS auto scaling group?

I have been following tutorials on AWS auto scaling group but none of them mention all of the reasons one might need to use it. So I’m wondering if my needs fit it or if I need something else.

I want to run X number of parallel tests, each on a different ec2 instance using testNg. Can the Auto Scaling Group be used to dynamically create these instances right before X number of tests run and then delete them when they are done?

Upvotes: 0

Views: 70

Answers (2)

John Rotenstein
John Rotenstein

Reputation: 269091

For your situation, since you know the number of EC2 instances required for testing, it would be more appropriate to:

  • Launch the EC2 instances
  • Initiate the tests
  • Terminate the EC2 instances when they have finished testing

Also, since testing is not a business-critical activity, you can save money by launching the EC2 instances as Spot Instances, which could save up to 90% of costs (more typically 50-70%). They take slightly longer to launch, and the instances might be "taken back" by AWS if the capacity is needed. You can reduce the chance of having instances "taken back" by launching instances in multiple Availability Zones and/or across different instance types.

Upvotes: 1

jarmod
jarmod

Reputation: 78563

I don't know much about testng or any potential AWS integrations that it might have, but I'm not sure that Auto Scaling is the best option here. While it would allow you to launch a group of instances (setting both minimum/maximum capacity to N), you'd have to deal with health checks and other ASG-specific features.

I would probably use EC2 Fleet. In addition to managing a fleet of EC2 instances as a unit, it also has some useful cost options, allowing you to pick amongst on-demand and spot as well as the maximum price that you are willing to pay.

Another potential option is AWS Batch.

If neither of those fit the bill, then you can simply launch N instances using the RunInstances API. Launch each with a userdata script that allows it to get its test script, run the script, and then shutdown/terminate.

Upvotes: 1

Related Questions