Alyssa
Alyssa

Reputation: 73

How can I tell an Google App Engine app to stop itself?

At a high level: When deployed, I want my Google App Engine app to run through some code and then stop the program automatically once it's finished, so that I don't have to manually stop the versions or instances using the UI.

I tried using the both the stop and delete instances in the Google Compute Engine API here: https://cloud.google.com/compute/docs/reference/latest/instances/delete

When I do that it gives me a successful response with a status equal to 'PENDING.' But when I look at the logs for the app, rather than stopping it looks like it's just repeating the code that I deployed over and over again, which I interpret as, "Oh it must not be stopping the app/instances then."

Am I doing something wrong? Is there another way to tell a Google App Engine app to stop itself?

Upvotes: 0

Views: 90

Answers (1)

Ben Kraft
Ben Kraft

Reputation: 494

I'm not sure exactly what you're trying to do, but it seems like you want the App Engine Admin API, rather than the Compute Engine API. I think setting servingStatus via app.services.versions.patch is probably what you want, but I'm not sure.

Upvotes: 2

Related Questions