Skip to content
This repository has been archived by the owner on Dec 31, 2023. It is now read-only.

Latest commit

 

History

History
38 lines (27 loc) · 1.46 KB

README.md

File metadata and controls

38 lines (27 loc) · 1.46 KB

google-cloud-compute library samples

These samples demonstrate usage of the google-cloud-compute library to interact with the Google Compute Engine API.

Running the quickstart script

Before you begin

  1. If you haven't already, set up a Python Development Environment by following the python setup guide and create a project.

  2. Create a service account with the 'Editor' permissions by following these instructions.

  3. Download a JSON key to use to authenticate your script.

  4. Configure your local environment to use the acquired key.

export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service/account/key.json

Install requirements

Create a new virtual environment and install the required libraries.

virtualenv --python python3 name-of-your-virtualenv
source name-of-your-virtualenv/bin/activate
pip install -r requirements.txt

Run the demo

Run the quickstart script, providing it with your project name, a GCP zone and a name for the instance that will be created and destroyed:

# For example, to create machine "test-instance" in europe-central2-a in project "my-test-project":
python quickstart.py my-test-project europe-central2-a test-instance