Created
November 15, 2019 16:43
-
-
Save djw8605/2cdc5c8477b1cb71197e772d8ed62abf to your computer and use it in GitHub Desktop.
This file contains 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
{ | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"## Amazon EC2 Instance\n", | |
"We will assume an Amazon EC2 instance of type m4.xlarge. It has these characteristics:\n", | |
"\n", | |
"* 4 cores\n", | |
"* 16 GB of RAM (4GB / core)\n", | |
"* $0.2 per Hour\n", | |
"\n", | |
"Clusters:\n", | |
"\n", | |
"\n", | |
"* Red is 107 million hours\n", | |
"* HCC is 130 million hours\n", | |
"\n", | |
"Calcluating cost for 237 Million CPU Hours on Amazon EC2" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"metadata": { | |
"collapsed": true | |
}, | |
"outputs": [], | |
"source": [ | |
"# 130 million hours and 90 million hours for Tier2\n", | |
"num_hours = 130*1000000 + 107 * 1000000" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"metadata": { | |
"collapsed": true | |
}, | |
"outputs": [], | |
"source": [ | |
"# 4 CPU Hours per hour of an instance\n", | |
"num_instances = num_hours / 4" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"metadata": { | |
"collapsed": true | |
}, | |
"outputs": [], | |
"source": [ | |
"# $0.2 per hour\n", | |
"compute_total_cost = num_instances * 0.2" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 4, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"Total cost for 237 Million hours: $11,850,000.00\n" | |
] | |
} | |
], | |
"source": [ | |
"print('Total cost for 237 Million hours: ${:0,.2f}'.format(compute_total_cost))" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"## Calculate Storage\n", | |
"Amazon S3 has tiered pricing. But for simplicity of the calculations, we will only consider the top, and least expensive tier of $0.021 per GB / Month\n", | |
"\n", | |
"Storage:\n", | |
"\n", | |
"* Crane: 1200 TB\n", | |
"* Rhino: 44 TB\n", | |
"* Common: 233 TB\n", | |
"* Red: 8200 TB\n", | |
"* Attic: 322 TB" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 5, | |
"metadata": { | |
"collapsed": true | |
}, | |
"outputs": [], | |
"source": [ | |
"storage_tb = 1200 + 44 + 233 + 8200 + 322" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 6, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"Storage in GBs: 10,238,976\n" | |
] | |
} | |
], | |
"source": [ | |
"# Amazon uses GB per month\n", | |
"storage_gb = storage_tb * 1024 # All of HCC\n", | |
"print('Storage in GBs: {:0,.0f}'.format(storage_gb))" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 7, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"Monthly: $215,018.50\n", | |
"Annual: $2,580,221.95\n" | |
] | |
} | |
], | |
"source": [ | |
"storage_price_per_month = storage_gb * 0.021\n", | |
"print('Monthly: ${:0,.2f}'.format(storage_price_per_month))\n", | |
"print('Annual: ${:0,.2f}'.format(storage_price_per_month*12))" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"collapsed": true | |
}, | |
"source": [ | |
"## Calculate Network\n", | |
"\n", | |
"Assume 13Gbps throughout the year.\n", | |
"\n", | |
"Amazon uses tiered pricing for network charges. We will only consier the top, and least expensive tier of $0.05 per GB." | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 8, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"Gigabytes transferred per second: 1.62GB\n", | |
"Gigabytes transferred per day: 140,400GB\n", | |
"Gigabytes transferred per year: 51,246,000GB\n" | |
] | |
} | |
], | |
"source": [ | |
"# Calculate how many GB's are transferred per second\n", | |
"gb_per_second = 13 / 8\n", | |
"print('Gigabytes transferred per second: {:0,.2f}GB'.format(gb_per_second))\n", | |
"print('Gigabytes transferred per day: {:0,.0f}GB'.format(gb_per_second * (24 * 60 * 60)))\n", | |
"print('Gigabytes transferred per year: {:0,.0f}GB'.format(gb_per_second * (365 * 24 * 60 * 60)))" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 9, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"Price of transfers per year: $2,562,300.00\n" | |
] | |
} | |
], | |
"source": [ | |
"network_price_per_year = (gb_per_second * (365 * 24 * 60 * 60)) * 0.05\n", | |
"print('Price of transfers per year: ${:0,.2f}'.format(network_price_per_year))" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"## Total Cost\n", | |
"\n", | |
"Adding Compute, Storage, and Network" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 10, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"Price: $16,992,521.95\n" | |
] | |
} | |
], | |
"source": [ | |
"total_cost = compute_total_cost + (storage_price_per_month * 12) + network_price_per_year\n", | |
"print('Price: ${:0,.2f}'.format(total_cost))" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": { | |
"collapsed": true | |
}, | |
"outputs": [], | |
"source": [] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.6.7" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment