AWS: cancel spot instance request within a spot instace
I want to run data analysis using AWS that'll probably take a few days. I've setup a system where spot instances will reload the same EBS volume so it can resume the analysis after a termination. So far I've got it working where I can just generate a persistent spot request and have the analysis keep running and continue after spot instance terminations until it is done.
But I also want the spot instance to cancel the persistent spot instance request when the analysis is finished. Is there anyway to get the request ID from within the spot instance?
The spot instance information is not available from the EC2 metadata. However, the instance ID is.
ec2-describe-instances
, or aws ec2 describe-instances
to get the instance information for the instance. spotInstanceRequestId
which is the spot instance request ID you're looking for. 下一篇: AWS:取消现货实例中的现货实例请求