I'm currently building an application that requires quite a lot of compute resources, making me use multiple EC2s. I am trying to reduce costs by using spot instances. What I would like to do is have 2 autoscaling groups, one with spot instances and the other one with on-demand instances.
I'd like to be able to query the meta data of the spot instances to check for eventual interruption notices via a Lambda function to start on-demand instances before the spot instance is interrupted.
My problem is that I could not find a way to query the spot related meta data from outside the ec2 instance that I'm trying to query. Has anyone done something similar before? Have I missed a simple way to achieve my goal?