Choosing the right Amazon EC2 Spot Instances for your workloads
The main issue was narrowing down the enormous list of instance types so they would be suitable to run our workloads.
On a recent project we were looking to take advantage of Amazon EC2 spot instances. The main issue was narrowing down the enormous list of instance types so they would be suitable to run our workloads. There are so many instance types with AWS, and they are growing all the time. To compound the problems, not all instance types are in every region.
Our key requirements were:
- 8 vCPU
- 32 GB RAM
- 58 pods per node (we use the nodes in EKS)
- Available in Sydney (
ap-southeast-2
)
Rather than go through manually all the instances to ensure they meet the above minimum requirements (to which there are 565 instance types 😲) to find the most optimal instances, I thought there must be a better way (read: faster).
Introducing Amazon EC2 Instance Selector
This is a neat little CLI tool that seems like is a great fit for this exact problem.
Installation is simple on a mac:
Here is the command that I ended up using to select the instances. Of note, I am asking for:
- 8 vCPU exactly and 32 GB RAM exactly. This seems to always yield 58 pods/node density when run in EKS. This is desirable for us.
- Current generation instances only
- Available in Sydney
- Must be spot capable
- No GPU instances, we don't have a use for these, and they cost loads
- Deny the
t
series (not suitable for our workloads), deny thei
series (not suitable for our workloads), deny ther
series (not suitable for our workloads) - x86 architecture (perhaps ARM in the future)
- No more than 30 cents an hour
This yields the following table:
Changing the output format to one-line
for easy copy/paste.
m4.2xlarge,m5.2xlarge,m5a.2xlarge,m5ad.2xlarge,m5d.2xlarge,m5zn.2xlarge,m6i.2xlarge
And there you have it, this is how we were able to filter the giant list of AWS instance types to just 7.
I hope this ends up helping someone else in the future.