https://pulumi.com logo
Title
m

microscopic-doctor-76377

08/14/2022, 1:26 AM
hi How to start stop a ec2 instance using pulumi automation api?
e

echoing-dinner-19531

08/14/2022, 7:50 PM
We don't expose the entire set of operations possible via the aws api in Pulumi. For things like this we'd recommend just using the aws sdk for your language to send the stop/start commands.
m

microscopic-doctor-76377

08/14/2022, 8:12 PM
Ok So can i update the state file of instance status after making stop or start through aws sdk??? Also is it mandatory to update ? Before doing any another operation (like adding volume)once the ec2 is created
e

echoing-dinner-19531

08/14/2022, 8:14 PM
Yes, you can always use
pulumi refresh
to get pulumi to check the vm state and update its view of the instance. You probably want to add things like volumes as part of creating the instance in pulumi.
m

microscopic-doctor-76377

08/14/2022, 8:17 PM
Can you help me on how to refresh the state file using the api and not using the pulumi cli
e

echoing-dinner-19531

08/14/2022, 8:19 PM
There's a refresh method on the stack type. e.g. for TypeScript: https://www.pulumi.com/docs/reference/pkg/nodejs/pulumi/pulumi/automation/#Stack-refresh Just call that, instead of the up method.