Hello, Is it possible to dynamically start / stop...
# aws
b
Hello, Is it possible to dynamically start / stop an existing ec2 instance? Pulumi up would start the instance, destroy would stop it, without destroying it? I don’t see how to do it with the api.
b
EC2 instances come up started by default. If you wanted to then stop it, you can do that but you'll need to use automation API and the AWS SDK as there isn't a property on the instance resource that says "start the instance, run any user data etc and then stop it"
b
ok thank you. No plan on providing this feature?
b
Not as far as I know, using the base Pulumi software. As I said, you could do something using automation API to stop the instance once the provisioning has been completed.
m
b
Great point. I always forget about tying things like this up with event bridge. Good spot
Having said that, what triggers the "running" event? Is it when the instance has started or when everything has finished (including all the cloud-init stuff)? From experience, running doesn't mean that userData has finished being run, for example
But I guess you could do "running + 5 minutes" or something like that