Google Cloud Setup
------------------

.. currentmodule:: coiled

In this guide you will configure Coiled to run Dask computations entirely within
your own Google Cloud account using the ``coiled setup gcp`` command-line tool.

Before you start
~~~~~~~~~~~~~~~~

This guide relies on using the ``gcloud`` CLI. If you do not already have the ``gcloud`` CLI installed, you can follow `these instructions <https://cloud.google.com/sdk/docs/install>`_ from the Google Cloud documentation.

Setting up Coiled
~~~~~~~~~~~~~~~~~

You can use the ``coiled setup gcp`` CLI tool to connect Coiled to your Google Cloud account::

    coiled setup gcp

With your permission, this command will create the IAM roles and service accounts Coiled needs so you can create clusters in your Google Cloud project. You will be prompted with an explanation at each step, so you can choose to say "yes" (or "no") at any point (see :doc:`gcp_configure` for more details).

Here's a demonstration of the process:

.. raw:: html
   
   <script src="https://asciinema.org/a/563682.js" id="asciicast-563682" async data-autoplay=1 data-loop=1></script>

If you would like to use the default options for network configuration and container registry, where Coiled creates a VPC in your account and uses Google Artifact Registry for storing your Python environments you can run:

.. code-block:: bash
    
       coiled setup gcp
    
Otherwise, you can configure Coiled to use a custom network configuration (e.g. your pre-existing VPC) or a different container registry for your Python environment (e.g. Docker Hub):

.. code-block:: bash

    coiled setup gcp --manual-final-setup

After which you will be provided with the required access key and prompted to complete configuration in the Coiled web app at https://cloud.coiled.io/settings/setup/update-backend-options. Select ``GCP``, then select ``Custom network configuration`` to upload your credentials.

.. click:: coiled.cli.setup.gcp:gcp_setup
   :prog: coiled setup gcp