I have suddenly started getting no capacity available error while trying to create defined duration based spot instance in us-west-2. Other region works fine for me. I do not see any option to specify a price while trying to create this type of spot instance.
I do not have any other spot instance or any other ec2 instance running for me in this AZ as well.
My hypothesis is that there is no ec2 capacity available in whole us-west-2 region right now to create a spot instance. But I am finding that hard to believe. Is that correct?
Also I went through doc but it doesn't point out that by capacity it means for the whole of the aws us-west-2 region or just for my account
The no Spot capacity available error occurs when there isn't enough spare capacity to fulfill your Spot Instance or Spot Fleet request.
As capacity becomes available, Amazon EC2 fulfills requests in the following order:
Reserved Instances ->
On-Demand Instances ->
Spot Instances
The Spot request continues to automatically make the launch request until capacity becomes available. When capacity becomes available, Amazon EC2 fulfills the Spot request.
Its important to take a note about Lifecyle of spot request ->
Also according to lifecycle of spot request
If one or more request constraints are valid but can't be met yet, or if there is not enough capacity, the request goes into a holding state waiting for the constraints to be met. The request options affect the likelihood of the request being fulfilled. For example, if you specify a maximum price below the current Spot price, your request stays in a holding state until the Spot price goes below your maximum price. If you specify an Availability Zone group, the request stays in a holding state until the Availability Zone constraint is met.
In the event of an outage of one of the Availability Zones, there is a chance that the spare EC2 capacity available for Spot Instance requests in other Availability Zones can be affected
Related
i want to the difference between spot and on demand instances. I know there is a price difference between these two but other than this i want to know the differences. Please help me
Actually there are three allocation types:
on demand - kind of "default" mode. You request an instance, if there is free capacity, you will get the instance. No long term commitment, but once you get an instance, it's yours. It may happen that you will get a message that there is no free capacity for the specific instance type and AZ (so far it happened to me only once with AWS).
reserved - AWS reserves the capacity for you. You have guarantee that you will get the instance type in the selected region or AZ.
spot instance - it's kind of auction / bidding of unused capacity. You ask for an instance, you provide your maximum price and if there is free capacity and your price is at the current price or higher, you will get an instance. The difference is - if the free capacity is exhausted, or the current price is higher than your maximum bid price, your spot instance is terminated . You can get a termination warning event upfront.
The resources for both are the same, spot instances utilise the spare compute capacity within the AWS availability zone (those that are not reserved or launched on-demand).
Depending on the demand for that instance class in the availability zone the spot price will increase or decrease (even surpassing the on-demand price).
When you use a spot instance you are taking a risk that if demand increases you will lose access to the spot instance (you are given a 2 minute warning before termination). For his reason it is common to use a mixture of on-demand/reserved instances and spot instances so that you can withstand instance terminations.
Commonly in EC2 applications you would use an autoscaling group with a configured proportion between on-demand/reserved nodes and spot instances.
For more information take a look at the Requesting Spot Instances for fault-tolerant and flexible applications documentation.
We have created AWS EC2 instance on Asia it Pacific(Mumbai) Zone on Shared Hardware rental type.We are trying to start an instance after shut it down we are getting popup ec2 error starting instances insufficient capacity message on screen.On white papers it is mention like this,Try to launch new ec2 instance but as we have in basic plan it is now allowing to create new instance on another zone.
How to resolve this issue.
According to the documentation, getting an InsufficientInstanceCapacity error when launching or restarting an instance means that Amazon does not have enough capacity to serve your request. There are a few options:
Waiting for a while and trying again
Launching an instance without specifying an availability zone
Changing the instance type
You can read more here.
Below are a few options available
Wait for that instance type to become available.
Launch a different instance type.
Launch an instance in a different availability zone and migrate back at a later time, if necessary. This provides a temporary solution until you can replace it at a later time with one in the desired availability zone. However, you will be charged cross-zone data transfer costs.
Launch an instance in the -Any- availability zone
Purchase a reserved instance (for that instance type) in the desired availability zone. This will also prevent you from receiving this error in the future.
This is usually caused by
AWS not having enough available On-Demand capacity to complete your request.
For troubleshooting steps, see [1].
If the preceding troubleshooting steps don't resolve the problem, then you can move the instance to another VPC or to another subnet and Availability Zone[2].
Tip :
To avoid insufficient capacity errors on critical machines, consider using
On-Demand Capacity Reservations[3].
To use an On-Demand Capacity Reservation, do the following :
1. Create the Capacity Reservation[4] in an Availability Zone.
2. Launch critical instances into your Capacity Reservation[5].
Reference :
[1] https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/troubleshooting-launch.html#troubleshooting-launch-capacity
[2] https://aws.amazon.com/premiumsupport/knowledge-center/move-ec2-instance/
[3] https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-capacity-reservations.html
[4] https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/capacity-reservations-using.html#capacity-reservations-create
[5] https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/capacity-reservations-using.html#capacity-reservations-launch
If you are new to AWS, there's usually a limit for how many instances can you launch or start even if you are currently running none. Try to request for a limit increase for the instance you want to launch in the support center and the insufficient capacity error will disappear
This is from the amazon ec2 FAQ :
Q: How quickly can I scale my capacity both up and down?
Amazon EC2 provides a truly elastic computing environment. Amazon EC2 enables you to increase or decrease capacity within minutes, not hours or days. You can commission one, hundreds or even thousands of server instances simultaneously. When you need more instances, you simply call RunInstances, and Amazon EC2 will typically set up your new instances in a matter of minutes. Of course, because this is all controlled with web service APIs, your application can automatically scale itself up and down depending on its needs.
Now again as per the same FAQ, I am only allowed to launch 20 instances per region. They said, I have to fill in a request form if I need more than 20 instances. So, in effect, I cant spin up more than 20 programmatically ?
What am I missing here ? how can we launch 100 instances let alone thousands. Sorry if this is the wrong place for such a question.
You cannot launch instances beyond the instance limit. You need to make a request to increase the instance limit. This is a safety feature so that:
A wild loop in your SDK/API script does not launch instances continuously
A malicious user does not launch a large number of instances
A hacker gets access to your account and launches a large number of instances
An incorrectly configured autoscaling group launches huge number of instances
If you require more than your instance limit, you need to submit a request to AWS. See: Amazon EC2 Service Limits. AWS will review your request and approve it.
You are missing the fact that limit increase requests are very easy to make and are almost always granted with no questions asked within a day or two.
To request a limit increase:
Open the AWS Support Center page, sign in if necessary, and choose Create Case.
For Regarding, choose Service Limit Increase.
Complete Limit Type, Use Case Description, and Contact method. If this request is urgent, choose Phone as the method of contact instead of Web.
Choose Submit.
AWS faqs provides a clear answer
You are limited to running up to a total of 20 On-Demand instances across the instance family, purchasing 20 Reserved Instances, and requesting Spot Instances per your dynamic Spot limit per region. New AWS accounts may start with limits that are lower than the limits described here. Certain instance types are further limited per region as follows
For Spot instance limits AWS states
The usual Amazon EC2 limits apply to instances launched by a Spot Fleet, such as Spot request price limits, instance limits, and volume limits. In addition, the following limits apply:
The number of active Spot Fleets per region: 1,000
The number of launch specifications per fleet: 50
The size of the user data in a launch specification: 16 KB
The target capacity per Spot Fleet: 3,000
The target capacity across all Spot Fleets in a region: 5,000
A Spot Fleet request can't span regions.
A Spot Fleet request can't span different subnets from the same Availability Zone.
These limits protect you from a hacker attack, stolen API keys, ETC. If you want to increase these limits, you need to send a form to AWS support team: AWS Support Center
I understand that spot instances are terminated if the bid price is exceeded, and that they can't launch if there is no capacity to do so or the instance limit is reached. I've not seen them terminated due to over-subscription before. Used AWS CLI:
aws ec2 request-spot-instances --spot-price "0.8" --instance-count 1 --type "one-time" --launch-specification c:\path\to\spot-instance-spec.json
The r4.4xlarge linux spot launched successfully in (my) eu-west-1b, then terminated and the status in the spot request is:
instance-terminated-capacity-oversubscribed: Your Spot instance was terminated as there is no more unused capacity available in this pool.
Does anyone know what this means specifically? Is a pool just the AZ? Is it down to more expensive spots? Is it due to on-demands being launched?
The AWS documentation now has a definition of Spot instance pool:
Spot Instance pool – A set of unused EC2 instances with the same instance type, operating system, Availability Zone, and network platform.
Source: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-spot-instances.html
Your Spot Instances continue to run as long as your maximum price is
at or above the Spot price, there is available capacity for your
instance type, and you don't terminate the instance. If a change in
the Spot price or available capacity requires Amazon EC2 to terminate
your Spot Instances, the Spot request goes into a terminal state. For
example, if your price equals the Spot price but Spot Instances are
not available, the status code is
instance-terminated-capacity-oversubscribed. A request also goes into
the terminal state if you cancel the Spot request or terminate the
Spot Instances.
Its mentioned here in AWS Doc, and also check for limitation of spot request.For some instance there is a limit beyond that it cant be launched.
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-bid-status.html
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-resource-limits.html
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.