hi How to start stop a ec2 instance using pulumi ...
# getting-started
m
hi How to start stop a ec2 instance using pulumi automation api?
e
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
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
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
Can you help me on how to refresh the state file using the api and not using the pulumi cli
e
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.