Last active
December 11, 2015 08:08
-
-
Save epicserve/4570960 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
A simple script to compare AWS EC2 Reserved Instances to Linode. All cost totals are per year. | |
AWS Specs: http://aws.amazon.com/ec2/instance-types/ | |
AWS Prices: http://aws.amazon.com/ec2/reserved-instances/#2 (US West) | |
Linode Prices: http://www.linode.com/ | |
Script Output: | |
$ python aws_ri_costs.py | |
AWS AND LINODE SPECS | AWS | Linode | | |
-------------------------------------------------------------------------------- | |
Small | 1.7 GB RAM, 160 GB Storage | 2 GB RAM, 96 GB Storage | | |
Medium | 3.75 GB RAM, 410 GB Storage | 4 GB RAM, 192 GB Storage | | |
Large | 7.5 GB RAM, 850 GB Storage | 8 GB RAM, 384 GB Storage | | |
LIGHT UTILIZATION COSTS | AWS | Linode | | |
------------------------------------------------------- | |
Small instance cost per year | $410.64 | $959.40 | | |
Medium instance cost per year | $821.28 | $1,919.40 | | |
Large instance cost per year | $1,642.56 | $3,839.40 | | |
MEDIUM UTILIZATION COSTS | AWS | Linode | | |
------------------------------------------------------- | |
Small instance cost per year | $370.24 | $959.40 | | |
Medium instance cost per year | $740.48 | $1,919.40 | | |
Large instance cost per year | $1,480.96 | $3,839.40 | | |
HEAVY UTILIZATION COSTS | AWS | Linode | | |
------------------------------------------------------- | |
Small instance cost per year | $335.16 | $959.40 | | |
Medium instance cost per year | $670.32 | $1,919.40 | | |
Large instance cost per year | $1,603.44 | $3,839.40 | | |
""" | |
import locale | |
locale.setlocale(locale.LC_ALL, 'en_US') | |
aws_ri_costs = [ | |
['Light', [ | |
['Small', 69, 0.039, 959.4], | |
['Medium', 138, 0.078, 1919.4], | |
['Large', 276, 0.156, 3839.4] | |
] | |
], | |
['Medium', [ | |
['Small', 160, 0.024, 959.4], | |
['Medium', 320, 0.048, 1919.4], | |
['Large', 640, 0.096, 3839.4] | |
] | |
], | |
['Heavy', [ | |
['Small', 195, 0.016, 959.4], | |
['Medium', 390, 0.032, 1919.4], | |
['Large', 780, 0.094, 3839.4] | |
] | |
], | |
] | |
size_specs = [ | |
['Small', '1.7 GB RAM, 160 GB Storage', '2 GB RAM, 96 GB Storage'], | |
['Medium', '3.75 GB RAM, 410 GB Storage', '4 GB RAM, 192 GB Storage'], | |
['Large', '7.5 GB RAM, 850 GB Storage', '8 GB RAM, 384 GB Storage'] | |
] | |
def fc(number): | |
"""Format currency""" | |
return "$" + locale.format("%.2f", number, grouping=True) | |
print "{:<23}|{:^29}|{:^26}|".format(str("\nAWS and Linode Specs").upper(), "AWS", "Linode") | |
print "-" * 80 | |
for spec in size_specs: | |
print "{:<22}| {:<28}| {:<25}|".format(spec[0], spec[1], spec[2]) | |
for ri in aws_ri_costs: | |
print "{:<30}| AWS | Linode |".format(str("%s Utilization Costs" % ri[0]).upper()) | |
print "-" * 55 | |
for size in ri[1]: | |
print "{:<29} |{:>10} |{:>10} |".format("%s instance cost per year" % size[0], fc(size[1] + (size[2] * 24) * 365), fc(size[3])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment