# Create and run a build in a private pool

This page explains how to create a Cloud Build private pool connected
to the service producer network, and run a build in the private pool.

The service producer network is the network that hosts the private pool.
By default, a private pool is set up to use the service producer network,
which provides a build environment with:

- Configurable machine types
- Configurable disk sizes
- Access to resources in the public internet, such as resources in a repository or a registry

*** ** * ** ***

To follow step-by-step guidance for this task directly in the
Cloud Shell Editor, click **Guide me**:

[Guide me](https://console.cloud.google.com/freetrial?redirectPath=/getting-started?walkthrough_tutorial_id%3Dbuild__quickstart-private-pools)

*** ** * ** ***

## Before you begin

> [!NOTE]
> If you've already installed Google Cloud CLI previously, make sure you have the
> latest available version by running `gcloud components update`.

## Create a private pool

1. In the Google Cloud console, open the **Cloud Build Worker pool** tab:

   [Open the Cloud Build worker pool tab](https://console.cloud.google.com/cloud-build/settings/worker-pool)
2. Click **Create**.

3. In the **Create private pool** panel, enter the following settings:

   1. In the **Name** field, enter
      `my-first-privatepool`.

   2. In the **Region** field, select `us-central1`.

   3. In the **Machine type** field, select `e2-standard-2`.

   4. In the **Available disk size** field, enter `800`.

   5. Leave the **Network project number** field blank.

   6. Leave the **Network** field blank.

   7. Make sure **Assign external IPs** is selected.

Click **Create** to create the private pool.

Allow a short time for the private pool to be created. After the private pool
is created, it is listed on the **Worker pool** tab.
![Screenshot of the private pool page](https://docs.cloud.google.com/build/images/private-pool-qs-image.png)

<br />

## Run a build in a private pool

1. Open a terminal window.

2. Create a new directory named `quickstart-private-pool` and navigate into it:

       mkdir quickstart-private-pool
       cd quickstart-private-pool

3. Create a file named `cloudbuild.yaml` with the following contents:

       steps:
       - name: "bash"
         script: echo "I am running in a private pool!"
       options:
         pool:
           name: "projects/$PROJECT_ID/locations/us-central1/workerPools/my-first-privatepool"

4. Start the build using the build config file:

       gcloud builds submit

When the build is complete, you'll see an output similar to the following:

    I am running in a private pool!
    PUSH
    DONE
    ---     ---

    ID                                    CREATE_TIME                DURATION  SOURCE                                                                                       IMAGES  STATUS
    5df45735-6414-40b7-9e10-e6d2023c8cea  2020-08-31T13:16:18+00:00  10S       gs://private-pool-test_cloudbuild/source/1598879777.206444-    58901ecbd14e431f8cdacc85d5dd0fc3.tgz  -       SUCCESS

## View build details

1. Open the **Build history** page in the Google Cloud console.

   [Open the Cloud Build page](https://console.cloud.google.com/cloud-build)
2. In the **Region** drop-down box, select **us-central1**.

   You will see the build that you ran in the private pool.
![](https://docs.cloud.google.com/build/images/private-pool-build-history-image.png)
3. Click on the build to view the build details, such as build summary and artifacts.

## Clean up


To avoid incurring charges to your Google Cloud account for
the resources used on this page, follow these steps.

1. Open the **Worker pool** page in the Google Cloud console:

   [Open the Cloud Build private pool page](https://console.cloud.google.com/cloud-build/settings/worker-pool)
2. In the row with your private pool, click the trash icon.

3. In the **Delete private pool?** pop-up box, click **Delete**.

The private pool that you created as part of this quickstart is now deleted.
You might need to refresh your screen to delete the private pool from the
**Worker pool** page.

## What's next

- Learn how to [create a private VPC peering connection](https://docs.cloud.google.com/build/docs/private-pools/set-up-private-pool-environment#setup-private-connection).
- Learn more about [private pools](https://docs.cloud.google.com/build/docs/private-pools/private-pools-overview).