Google Compute Engine features a RESTful API that allows developers to run virtual machines in the cloud. This sample python command-line application demonstrates how to access the Compute Engine API using the Google Python API Client Library. For more information about the library, read the Getting Started: Google Python Client Library documentation.
To run the demo:
- Update the variables in the settings.json file.
- <your-project-id>: your Compute Engine project ID.
- Update the client_secrets.json file with your client id and secret found in the Google APIs Console.
- Run the sample using the command:
python main.py
Demo steps:
- Create an instance with a start up script and metadata.
- Print out the URL where the modified image will be written.
- The start up script executes these steps on the instance:
- Installs Image Magick on the machine.
- Downloads the image from the URL provided in the metadata.
- Adds the text provided in the metadata to the image.
- Copies the edited image to Cloud Storage.
- After recieving input from the user, shut down the instance.
Python dependencies can be installed via pip:
pip install -r requirements.txt