Implementing idempotency for AWS Spot Instance Requests

前端 未结 1 1289
温柔的废话
温柔的废话 2021-02-09 22:44

I\'m using the Java AWS SDK to make EC2 spot instance requests. As opposed to on demand instances, the API for spot requests does not have anything similar to ClientToken and th

相关标签:
1条回答
  • 2021-02-09 23:09

    In that case I don't want to have the request repeated, I just want to see that it got registered and move on.

    If you got a 200 back, then it's registered. It may not show up right away, but it's registered and you can move on in your flow.

    Is implementing idempotency for spot requests possible using just the AWS API and not having state saved in the client application?

    I don't believe so. I have the same sort of issue with Amazon's EMR. The way that I work around it is to have a component who's job it is to observe clusters. When I make a request for an EMR cluster, I get back a cluster id, which I then pass off to some observer. The observer will then call my other components when that cluster changes state. Not being acknowledged by EMR right away is a valid case and is not treated like an exception.

    I have no idea if that's appropriate for you. Perhaps you could try maintaining the SpotInstanceRequestId. In my case, I only keep them in memory, but you could keep them somewhere persistent if need be.

    0 讨论(0)
提交回复
热议问题