Choose the most optimal EC2 instance type
Best EC2 is a Python package designed to optimize your selection of Amazon EC2 instance types. This powerful tool simplifies the process, allowing you to effortlessly choose the optimal EC2 instance that matches your specific requirements, balancing performance, cost, and computing needs.
Select the cheapest EC2 instance type that matches your requirements
A key advantage of Best EC2 is its ability to bypass the complexity of understanding EC2 instance families, types, and other details. Users simply need to input their specific requirements, such as CPU, memory, GPU, disk space, spot interruption frequency (if applicable), etc. Best EC2 then identifies the cheapest instances that meet these criteria, ensuring that you get the most cost-effective solution that perfectly aligns with your needs.
Basic example of automatic EC2 instance selection based on criteria
from best_ec2 import (
BestEc2,
InstanceTypeRequest,
UsageClass,
Architecture,
ProductDescription,
FinalSpotPriceStrategy,
)
ec2 = BestEc2()
request: InstanceTypeRequest = {
"vcpu": 96,
"memory_gb": 512,
"usage_class": UsageClass.SPOT.value,
"burstable": False,
"has_gpu": True,
"gpus": 8,
"gpu_memory": 256,
"architecture": Architecture.X86_64.value,
"product_description": ProductDescription.LINUX_UNIX.value,
"is_current_generation": True,
"is_instance_storage_supported": True,
"max_interruption_frequency": 5, # The frequency of interruptions is no more than 5 percent.
"region": "eu-central-1",
"availability_zones": [
"eu-central-1a",
"eu-central-1b",
],
"final_spot_price_strategy": FinalSpotPriceStrategy.MIN.value,
}
response = ec2.get_types(request)
print(response)
Response:
[
{
"instance_type":"p4d.24xlarge",
"vcpu":96,
"memory_gb":1152,
"network_performance":"4x 100 Gigabit",
"storage":[
{
"SizeInGB":1000,
"Count":8,
"Type":"ssd"
}
],
"price":8.8272,
"az_price":{
"eu-central-1b":8.8272
},
"gpu_memory_gb":320,
"gpus":8,
"interruption_frequency":{
"min":0,
"max":5,
"rate":"<5%"
}
}
]
Reference for cost-effective EC2 instance selection tool
For more information or to get started with Best EC2, visit our GitLab repository at Best EC2 on GitLab or find the package directly on PyPI at Best EC2 Python Package.