I'm using AWS Cloudformation to create EC2 spot instance (with block duration). In order to do this in cloudformation I'm using a Launch Template where spot configuration is set. Then my cloudformation template create an EC2 resource which use the Launch Template.

It work fine except when AWS refuse to create a spot instance. In that case, the cloudformation stack is still running.

I'm wondering if there is a way to fail the stack when the spot request is refused ?



You should use TimeoutDurationMinutes in your code while requesting for spot instances via cloudformation.

For more details: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancefleetconfig-spotprovisioningspecification.html

  • I'm using it (that what I meant by "block duration") but if the request get accepted, everything works as expected. Otherwise the stack stay in "CREATE IN PROGRESS" state and I don't see the spot request in AWS.
    – Maxime C
    Jul 15 '19 at 6:54
  • This seems to be a common issue with cloudformation. However, please check step-7 in noise.getoto.net/tag/cloudformation/page/2 This should be helpful in fixing your issue.
    – Samit
    Aug 28 '19 at 23:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.