Based on “A robust distributed locking algorithm based on Google Cloud Storage” and github.com/marcacohen/gcslock.