set a price cap for spot instances with EKS - amazon-web-services

I would like to use spot instances in my cluster. I was trying to create a node group with a spot priced launch template when I discovered it's not possible to specify instance market options like maximum price.
https://github.com/hashicorp/terraform-provider-aws/issues/15118
This seems like a pretty major limitation seeing as spot instances can spike up in price to orders of magnitude more than on-demand.
https://devops.stackexchange.com/questions/893/why-is-the-aws-ec2s-spot-price-greater-than-the-on-demand-price
Is there really no way around this? Is no one using spot instances in EKS?

I had a quick look for you in the Python SDK documentation. I didn't find any mention about what you are looking for in the API https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/eks.html#EKS.Client.create_nodegroup I guess the same applies in terms of IaC. I would suggest you reach out to your Technical Account Manager (TAM) or AWS Support and let them know about your needs. They will be able to create a feature request for you.

Related

Google Cloud Platform - Billing, how do I find the name of the instance of a product that is costing money?

I go into billing and filter by project & group by SKU. This gives me the individual services that I'm being charged for (view below). I can see that Compute Engine is costing me £5.59 per month. If I go into Compute Engine I don't have any instances. In this particular example I discovered that had a Serverless VPC Connector running and I think that is using the Service but it is just a guess.
How do I find out what specific product instances that I have enabled are costing me money? How, in this example, would I find out from Billing that it is the Serverless VPC Connector that is costing me money and linked to that Compute Engine instance?
(I've had other situations where I'm being billed for an IP address but not the name of that IP address or what products / instances of products are consuming the IP address).
Interesting...
It looks like indeed looking at https://cloud.google.com/vpc/pricing#serverless-vpc-pricing
serverless VPC connectors could be billed as e2-micro
While in many cases you will see billing report actually try to associate your billing to human understandable service like so (under service and/or SKU columns)
it doesn't seem to be always the case.
One way to try to resolve that I guess would be to follow this path
https://cloud.google.com/blog/topics/cost-management/use-labels-to-gain-visibility-into-gcp-resource-usage-and-spending
Following instructions and once you get your billing exported to big query you could run the following:
select
sku.id,
l.key
from
YOUR_PROJECT.YOUR_BILLING_EXPORT_DATASET.YOUR_BILLING_TABLE
,UNNEST(labels) as l
where
sku.id = '9FE0-8F60-A9FO' # your SKU id in question
and labels should give you a better idea of whats what.
This should give you an overall direction, perhaps there is a way to parse this out without exporting to BQ (first) and querying it (second) as this may also cost you money.
PS.
Labels are always a good idea when you create services/resources explicitly.

AWS Cost Explorer: Cost per instance

Hi we have about hundred instances in AWS but we don't have a clue which uses what.
We'd need to be able to view costs per instance.
We've tried tags etc everything possible in settings but without any luck. Do we need to make linked account to or something to each instance? Or should we just move away from aws? Or is there some external service for this?
You can calculate cost using AWS Cost Calculator: https://calculator.s3.amazonaws.com/index.html

Request EC2 spot block with automated bidding using Boto3

Correct me if I'm wrong, but there seem to be some inconsistencies between creating sport block requests using EC2 console and AWS SDK (Boto3, namely). When requesting a spot block using AWS Management console, the only pricing option is "Use automated bidding".
However when doing the same via Boto3, SpotPrice parameter is marked as required with no indication that it might represent, say, a percentage of on-demand price.
Is there any option to use automated bidding programmatically without hard-coding on-demand prices in the requests?
The console is merely trying to present a simplified process. I think it is simply setting SpotPrice to the on-demand price. That's a much cleaner interface than asking for a different price per selected Instance Type.
You always only pay the current Spot Price. Bidding is always automatic up to your Spot price, which represents the maximum you are willing to pay.
If you want to make an equivalent bid without hard-coding the On-Demand Price, you could use the AWS PriceList API, which is really just some downloadable JSON/CSV files with pricing information. Pricing doesn't change very often, so you could cache that information and occasionally refresh it.
Because you choose Reserved for duration. Automatic bidding is the only way you can do this.
IMHO, you should consider your SPOT requirement before jump into reserved for duration. If your application is spot instance ready , then you should specify a fleet of instance with your desire minimum price. Because AWS Spot always has under utilised spare instance, in fact, this minimise the interruption without even the need of reservation.
Perhaps due to c4.* pricing and cause many people move from c3.* to c4., it seems c3. pricing is all time low (e.g. us-east-1* show a price below $0.02)

Ec2 spot pricing graph stopped working

A long time ago, there was the most useful spot price comparison graph that I have ever used, but it stopped working, as far as I know, because the creator ran out of time to maintain it. The website is still active ec2price.com and the code is on Github. Does anyone know if anyone has replicated this? or any way to do it myself? As I said it was really useful to decide which spot instance to choose.
You can see this information in the EC2 console by browsing to Spot Requests and selecting the Pricing History button.
If you want to select the cheapest ec2 instance type automatically you can create a spot fleet request; select all the instance types you might want to use and an allocation strategy of lowestPrice. Deploy this to a VPC with a subnet in all availability zones in your region to get the lowest price possible.
Besides codes, somebody must pay to maintain server that polling the information.
Check out How Spot Fleet Works. Spot fleet is way better than price monitoring. You can make request base on pricing for a fleet of instance type than limit yourself to specific instance type. You can kick start instances from a large fleet base on maximum instance price or vCPU price.
If you are using a SPOT ready batch application, after submit your bidding for fleet of different instance type and set the maximum per vCPU price, Spotfleet will automatically launch available instance with the best price. So you don't need to compete with limited popular instance(for example, c4.* SPOT instance is scarce for most region).
This is a win-win for both AWS and customer, as AWS able to spread the usage to underutilized instance type. IMHO, There is no point of keep raising the bid for particular type if those instance exhausted, while there is still many idle AWS instances in alternate zone that are not fully utilised for grab.

Alternative for built-in autoscaling groups for spot instances on AWS

I am currently using spot instances managed with auto-scaling groups. However, ASG has a number of shortcomings for use with spot instances. For example, it cannot launch instances of a different instance type if the current type is experiencing a price spike across all availability zones. It can't even re-distribute the number of running instances across zones (if one zone has a price spike, you're down 30% in the number of running instances.)
Are there any software solutions that I could run which would replace built-in AWS Auto-Scaling Groups? I've heard of SpotInst and Batchly, but I do not trust them. Basically, I think their business plan involves being bought out and killed by Amazon, like what happened to ClusterK. The evidence for this is the bizarre pricing policies and other red flags. I need something that I can self-host and depend on.
AWS recently released Auto Scaling for Spot Fleets which seems to fit your use case pretty well. You can define the cluster capacity in terms of vCPU that you need, choose the instance types you'd like to use and their weights and let AWS manage the rest.
They will provision spot instances at their current market price up to a limit you can define per instance type (as before), but integrating Auto Scaling capabilities.
You can find more information here.
https://aws.amazon.com/blogs/aws/new-auto-scaling-for-ec2-spot-fleets/
It's unlikely that you're going to find something that takes into account everything you want. But because everything in Amazon is an API, so you can write that yourself. There are lots of ways to do that.
For example, you could write a small script (bash, ruby, python etc) that shells out the AWS CLI to get the price, then shells out to launch boxes. For bonus points, use the native AWS SDK library instead of shelling out. (That will be slightly easier to handle errors, etc.) For even more bonus points, open source it, and hope that other people to improve on it!
This script can run on your home computer, or on a t1.micro for $5/month. Or you could write it in node.js, and run it on Lambda for pennies per month.
Here at Spotinst, these are exactly the problems we built Elastigroup to solve.
Elastigroup enables running simultaneously on as many instance types and availability zones (within a region) as you’d like. This is coupled with several things to maintain production availability:
Our algorithm makes live choices for the best Spot markets in terms of price and availability.
When an interruption happens, we predict it about 15 minutes in advance and take all the necessary steps to ensure (and insure) the capacity of your group.
In the extreme case that none of the markets have Spot availability, we simply fall back to an on-demand instance.
We have a great relationship with AWS and work closely with both their technical and business teams to provide our joined customers with the best experience possible. As we manage resources inside your own AWS account, I wouldn’t put the relationship between us as a concern, to begin with.