AWS Made Easy
Search
Close this search box.

Retype AWS EC2 Auto Scaling Groups to save 15%

Get 15% better price performance by retyping your AWS EC2 Auto Scaling Groups

If you run M5 instances in AWS EC2 AutoScaling Groups (ASG), you can reduce your EC2 costs by retyping your instances. M6i instances offer 15% better price performance compared to M5, and they also allow for higher scalability by supporting up to 128 vCPUs per instance. While this is an effective cost optimization, it is not without risk. Follow our steps in this blog to safely retype your EC2 AutoScaling Groups. 

Before you start

Go through the checklist and see if this cost fix applies to your use case. As per best practices, make sure to test the upgrade in a safe environment first. Plan the upgrade using maintenance windows for production instances. This gives you time to perform checks and changes, and revert in case of problems.

Upgrade checklist

  • Instance type family M5:
    We start with M5 since it is one of the most widely used instance types in AWS. Other instance types introduce variables in the decision-making process that make description of the migration process hard. We are all about making it easy.
  • AWS ASG with automatic scaling policies, or at least one Spot instance:
    That is a sure indicator that instances can be launched and stopped without user participation. You could upgrade other instances as well, but you will need to make sure that they can be launched automatically.
  • M6i availability in your AZ:
    You can check this using the following command, just update the AZ values and region to fit your needs:
    aws ec2 describe-instance-type-offerings --location-type "availability-zone" --filters Name=location,Values=us-east-2a --region us-east-2
  • No reserved instances:
    You should not upgrade reserved instances, since reservations are type-bound. If you change the type of reserved instances, you will incur duplicate costs.

Best upgrade strategy for your use case

Is it better to replace M5 with M6i, or is it better to add M6i with a higher priority in your ASG launch configurations? Do you need to update the AWS ASG strategy? Check the following use cases on how to apply the best upgrade strategy for your needs.

3rd party tools or Infrastructure as Code?

Do you run your ASGs using 3rd party tools such as AutoSpotting? Do you use Infrastructure as Code? Before attempting any changes, check the relevant documentation and user forums for guidelines and recommendations.

Single instance type ASG

Copy the launch configuration changing the instance type to the corresponding M6i instance type, then update the ASG to use the new configuration.

If you use Launch Templates, check which version the ASG is pointing to. Then make a copy of the current configuration to a new template and change the instance type to the corresponding M6i instance type. If your AWS ASG uses explicit version numbers, increase the version by 1. If the current template is marked as default, mark the new template as default.

Mixed instance type ASG

In this case we recommend adding the new instance type with a higher priority to your set of launch configurations. This allows for better Spot coverage, as per AWS recommendations: Picking older-generation instance types that are less popular tends to result in lower costs and fewer interruptions.

For each M5.* instance type, copy the whole configuration – including WeightedCapacity and LaunchTemplateSpecification – to a row above, changing the type to the corresponding M6i instance type.

If M5 was top of the list and the ASG uses the capacity-optimized strategy, be sure to enable Prioritize Instance types. This will ensure the M6i is preferred over M5.

Avoid service degradation or disruption

The easiest and cheapest way is to upgrade instances in-place. However, based on the workload and your configuration, this might lead to service degradation or disruption under high load. It is much safer to temporarily increase the desired capacity to add the new instance types.

Detailed upgrade instructions

  1. Open the EC2 dashboard and select the ASG you want to upgrade.
  2. Apply the changes to the Launch Configurations depending on your use case – see instructions above.
  3. Enable scale in protection for the ASG.
  4. Enable scale in protection for the instances you don’t need to update.
  5. Increase the desired capacity by the number of instances to upgrade, plus the number of instances in the warm pool. Increase the maximum capacity if needed.
  6. Wait until the ASG is upgraded. It takes a couple of minutes to adjust the group to the new desired capacity.
  7. Verify your ASG launched at least one m6i instance, and its health status.
  8. Restore desired and maximum capacity.
  9. Wait roughly one minute for the ASG to scale down.
  10. Restore scale in protection settings for both the ASG and the instances.

Conclusion

Once the availability and upgrade compatibility are checked, this is a secure cost fix. It increases the effectiveness of your EC2 ASG and cuts costs when less instances are needed. Performing all these checks will require some time. If you prefer a simple automated solution, try CloudFix, which can apply such fixes for you.

Kevin Duconge

Email
Twitter
Facebook
LinkedIn

Leave a Reply

Your email address will not be published. Required fields are marked *