- Newest
- Most votes
- Most comments
The behavior you're experiencing with the delay between when a Spot Instance request is visible in the AWS console versus when it's available through the API is indeed by design and is a common occurrence when working with AWS services.
When you create a Spot Instance request using RequestSpotInstances
, the request is immediately recorded in AWS's systems, which is why it appears quickly in the AWS console. However, the API calls, including DescribeSpotInstanceRequests
, may experience a slight delay in reflecting this information due to eventual consistency.
Eventual consistency is a model used by distributed systems like AWS to achieve high availability. It means that changes made in one part of the system may take some time to propagate to all other parts. In this case, the creation of your Spot Instance request needs time to replicate across all of AWS's data centers and become visible to API calls.
This delay, which you've observed to be around 10 seconds, is normal and expected behavior. It's not a flaw but rather a trade-off for the scalability and reliability of the AWS infrastructure.
To handle this in your Golang program, you might want to implement a polling mechanism with appropriate waits and retries when calling DescribeSpotInstanceRequests
. This would allow your program to account for the propagation delay and ensure it captures the Spot Instance request information once it becomes available through the API.
Remember that Spot Instance requests can be in various states, including 'open', 'active', 'failed', 'closed', 'disabled', and 'cancelled'. The 'open' state indicates that the request is waiting to be fulfilled, which is likely what you'll see initially after creating the request.
Sources
DescribeSpotInstanceRequests - Amazon Elastic Compute Cloud
How Spot Instances work - Amazon Elastic Compute Cloud
Relevant content
- asked 3 years ago
- asked 3 years ago
- asked 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 3 years ago
I have a polling implemented already. But this design is stupid. I made the call via API, but the API endpoint is delayed, and the console stays up to date.