Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mattes/gce-graceful-shutdown

Gracefully shutdown long-running Google Compute Instances managed by Instance Group Managers.
https://github.com/mattes/gce-graceful-shutdown

google google-cloud google-cloud-compute google-instance-group graceful-shutdown

Last synced: about 1 month ago
JSON representation

Gracefully shutdown long-running Google Compute Instances managed by Instance Group Managers.

Awesome Lists containing this project

README

        

# Google Compute Engine Graceful Shutdown

This tool monitors an Instance Group for changes. The moment the given Instance Template
is no longer part of the monitored Instance Group, `on-shutdown` is run. Afterwards
the Instance is deleted via an API call.

It does not currently trigger if:

* Instance is deleted
* Instance is restarted
* Instance is re-created during autohealing

## Motivation

Google Shutdown Scripts are unreliable and only run for 60-90s max.

## Usage

```
./gce-graceful-shutdown -on-shutdown 'docker stop --time 30 my-container' -timeout 30s
```

| Variable | Description |
|----------------------------------|---------------------------------------------------------------------------------------|
| `-creds` | Path to Google Service Account Credentials. Defaults to Application Credentials. |
| `-on-shutdown` | ***Required*** Command to run when instance is about to be deleted. |
| `-timeout` | Time to wait for -`on-shutdown` to finish. Default `10m`. |
| `-project` | Manually set Google Project. |
| `-region` | Manually set Region. |
| `-zone` | Manually set Zone. |
| `-instance-group` | Manually set Instance Group. |
| `-instance-template` | Manually set Instance Template. |
| `-instance` | Manually set Instance. |