https://pulumi.com logo
Title
a

able-diamond-20131

05/22/2022, 1:02 PM
Hey, as part of my deployment, I need to run some code every time I create / replace a specific ec2 instance. I have not found the api to do so, I was expecting some kind of lifecycle event such as:
let instance = new aws.ec2.Instance( ......);
instance.onReplace((_) => {myCodeHere;})
Is this possible with Pulumi ?
o

orange-policeman-59119

05/22/2022, 5:39 PM
You can use the Pulumi Command provider: https://www.pulumi.com/registry/packages/command/
One of the first examples is doing some remote setup on an EC2 instance. Hope this helps!