Amazon EC2 Best Instance (amazon-ec2-best-instance) allows you to choose the most optimal and cheap EC2 instance type for your use.
Project description
Amazon EC2 Best Instance (amazon-ec2-best-instance)
Amazon EC2 Best Instance (amazon-ec2-best-instance) allows you to choose the most optimal and cheap EC2 instance type for your use.
Prerequisites
- python3
- pip3
- boto3
- AWS Account
- AWS Credentials
Install
pip install amazon-ec2-best-instance
Options
- vcpu Describes the vCPU configurations for the instance type.
- memory_gb Describes the memory for the instance type in GiB.
- usage_class Indicates whether the instance type is offered for spot or On-Demand.
- burstable Indicates whether the instance type is a burstable performance instance type.
- architecture The architectures supported by the instance type.
- operation_systems The operating system that you will use on the virtual machine.
- is_current_generation Use the latest generation or not.
- is_best_price Indicate if you need to get an instance type with the best price.
Usage
Simple
from amazon_ec2_best_instance import Ec2BestInstance
ec2_best_instance = Ec2BestInstance()
response = ec2_best_instance.get_best_instance_types({
'vcpu': 1,
'memory_gb': 2
})
print(response) # ['m5a.16xlarge', ... ,'r5n.metal']
Advanced
import logging
from amazon_ec2_best_instance import Ec2BestInstance
# Optional.
options = {
# Optional. Default: us-east-1
'region': 'us-east-1',
# Optional. Default: 10
'describe_spot_price_history_concurrency': 20,
# Optional. Default: 10
'describe_on_demand_price_concurrency': 20
}
logging.basicConfig(level=logging.INFO, format='%(asctime)s: %(levelname)s: %(message)s')
# Optional.
logger = logging.getLogger()
ec2_best_instance = Ec2BestInstance(options, logger)
response = ec2_best_instance.get_best_instance_types({
# Required.
'vcpu': 1,
# Required.
'memory_gb': 2,
# Optional. Default: 'on-demand'. Values: 'spot'|'on-demand'
'usage_class': 'spot',
# Optional.
'burstable': False,
# Optional. Default: 'x86_64'. Values: 'i386'|'x86_64'|'arm64'|'x86_64_mac'
'architecture': 'x86_64',
# Optional. Default: ['Linux/UNIX']. Values: 'Linux/UNIX'|'Linux/UNIX (Amazon VPC)'|'Windows'|'Windows (Amazon VPC)'
'operation_systems': ['Linux/UNIX'],
# Optional.
'is_current_generation': True,
# Optional. If this parameter is set to True, the method will return the instance type with the best price.
'is_best_price': True,
})
print(response) # ['c5d.large']
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for amazon-ec2-best-instance-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2113008e7413ae36d33222ce7ec21189b8822d96ba3529bc46d9d54753b9b491 |
|
MD5 | 625c8e50d96c6310952b5ddb834f5211 |
|
BLAKE2b-256 | 603feea7a85f70890bd8a8fd0a236e79413045e2f67e4107dc4e20878fc0b442 |
Close
Hashes for amazon_ec2_best_instance-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b7863da88bb01a71ece3238fe8188200927f5d847d163222c190ea7dba108634 |
|
MD5 | 6dfb5931a822eb1db3433c97d0bc2271 |
|
BLAKE2b-256 | 08013cb39815b55d9ed6abeff50ccfaa0c045ec8953af1bfc1cd41c47b221bdd |