New feature: reserved_hourly_combinations #27
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A new feature in the EC2Offer class. The function is called reserved_hourly_combinations. Given a single input
instance_name
, this function will output all valid combinations (region, lease contract length, offering class, purchase option) along with the cost for each combination in a combined output (in the form of an array of objects).Future: I'd love to see this tool become more accessible to more people over time, such as entry-level developers or even those who have very little to no development skills! This repository makes a healthy step towards that goal, and I believe my function gets us even one step closer to that goal by minimizing the number of required parameters to 1 for EC2 hourly pricing, I'd love to get to the point where we can require an easier set of parameters (assuming our users aren't familiar with AWS's vocabulary [such as EC2 instance names]) and use those custom parameters to find an optimal subset of configurations from our full set of configurations, and then return that!
Another new feature to the EC2Offer class is reserved_hourly_combinations_kthclosest. Given the output of reserved_hourly_combinations as its input, this function will output the kth-cheapest option in avg. case linear time (QuickSelect). This can be used in a loop to find the kth cheapest configurations given a set of configurations. When cases where the cheapest configuration doesn't work and more {CPU, memory, network throughput} is required, this function can be used to quickly find the most optimal EC2 instance type, region and more while minimizing cost and time.
Future: While QuickSelect works well in most cases, it does technically have an upper-bound runtime of O(n^2) in the case that we choose a bad pivot every time (e.g. for each partition, the value of our pivot is the largest element in our array). This can be alleviated by using LinearSelect, which uses a median of n/5 medians as our pivot. LinearSelect has a worst-case running time of O(n). QuickSelect has an avg. case running time of O(n) but a worst-case running time of O(n^2).