|
| 1 | +--- |
| 2 | +title: Setting Up Your GCP Account |
| 3 | +sidebar_position: 0 |
| 4 | +description: Follow these steps to set up your Google Cloud Platform (GCP) account for deploying applications with Defang. |
| 5 | +--- |
| 6 | + |
| 7 | +# Setting Up Your GCP Account |
| 8 | + |
| 9 | + Follow these steps to set up your Google Cloud Platform (GCP) account for deploying applications with Defang. |
| 10 | + |
| 11 | +--- |
| 12 | + |
| 13 | +### Step 1: Create Your GCP Account |
| 14 | + |
| 15 | +Start by creating a Google Cloud account using the [GCP account creation flow](https://cloud.google.com/). |
| 16 | + |
| 17 | +--- |
| 18 | + |
| 19 | +### Step 2: Create a GCP Project |
| 20 | + |
| 21 | +To deploy apps using Defang, you need a GCP project. Projects help organize related resources such as services, IAM policies, quotas, and billing. |
| 22 | + |
| 23 | +If you already have a project, skip to [Step 3](#step-3-create-your-billing-account). |
| 24 | + |
| 25 | +To create a new project: |
| 26 | + |
| 27 | +1. Visit the [GCP Console](https://console.cloud.google.com/). |
| 28 | +2. Click the project selector button (it may say **"Select a project"** or display a previous project name). |
| 29 | +<figure> |
| 30 | + <img src="/img/setting-up-your-gcp-account/select-project.png" alt="GCP console with the project select button highlighted" style={{ width: 300 }} /> |
| 31 | + <figcaption><strong>Select project button to open the project dialog</strong></figcaption> |
| 32 | +</figure> |
| 33 | + |
| 34 | +3. Follow the prompts to create a new project. |
| 35 | + |
| 36 | +:::info |
| 37 | +Take note of your **Project ID** — you’ll need it later when setting the `GCP_PROJECT_ID` environment variable. |
| 38 | +::: |
| 39 | + |
| 40 | +<figure> |
| 41 | + <img src="/img/setting-up-your-gcp-account/new-project.png" alt="GCP project creation dialog" style={{ width: 300 }} /> |
| 42 | + <figcaption><strong>Create a new project in the dialog</strong></figcaption> |
| 43 | +</figure> |
| 44 | + |
| 45 | +--- |
| 46 | + |
| 47 | +### Step 3: Create Your Billing Account |
| 48 | + |
| 49 | +Billing accounts let Google allocate costs to specific entities or users. You’ll need one to deploy services. |
| 50 | + |
| 51 | +1. In the [GCP Console](https://console.cloud.google.com/), open the navigation menu. |
| 52 | +2. Select **Billing**. |
| 53 | + |
| 54 | +<figure> |
| 55 | + <img src="/img/setting-up-your-gcp-account/billing-menu-option.png" alt="Billing option in GCP menu" style={{ width: 300 }} /> |
| 56 | + <figcaption><strong>Billing menu option</strong></figcaption> |
| 57 | +</figure> |
| 58 | + |
| 59 | +3. In the billing side panel, select **Manage billing accounts**, then click **Create account**. |
| 60 | +4. Follow the steps to create a billing account. A credit card is required. |
| 61 | + |
| 62 | +<figure> |
| 63 | + <img src="/img/setting-up-your-gcp-account/create-billing-account.png" alt="Create billing account page" style={{ width: 300 }} /> |
| 64 | + <figcaption><strong>Billing management page</strong></figcaption> |
| 65 | +</figure> |
| 66 | + |
| 67 | +--- |
| 68 | + |
| 69 | +### Step 4: Link Your Project to the Billing Account |
| 70 | + |
| 71 | +Once your project and billing account are created, link them together: |
| 72 | + |
| 73 | +1. In the GCP Console, select your project from the project selector. |
| 74 | +2. Open the **Billing** section again from the left sidebar. |
| 75 | +3. Click **Link a billing account**. |
| 76 | + |
| 77 | +<figure> |
| 78 | + <img src="/img/setting-up-your-gcp-account/link-billing-account.png" alt="Link billing account dialog" style={{ width: 300 }} /> |
| 79 | + <figcaption><strong>Link billing account dialog</strong></figcaption> |
| 80 | +</figure> |
| 81 | + |
| 82 | +4. Choose the billing account to link. |
| 83 | + |
| 84 | +<figure> |
| 85 | + <img src="/img/setting-up-your-gcp-account/link-billing-select-account-dialog.png" alt="Billing account selection dialog" style={{ width: 300 }} /> |
| 86 | + <figcaption><strong>Select a billing account to link</strong></figcaption> |
| 87 | +</figure> |
| 88 | + |
| 89 | +--- |
| 90 | + |
| 91 | +### Step 5: Set Up Your GCP CLI |
| 92 | + |
| 93 | +To complete your setup, install the **gcloud CLI** by following the [installation guide](https://cloud.google.com/sdk/docs/install). |
| 94 | + |
| 95 | +After installation, authenticate with: |
| 96 | + |
| 97 | +``` |
| 98 | +gcloud auth application-default login |
| 99 | +``` |
| 100 | + |
| 101 | +This will generate your **application default credentials** used during deployment. |
| 102 | + |
| 103 | +--- |
| 104 | + |
| 105 | +Now you're ready to deploy! See the [Deploy to GCP tutorial](/docs/tutorials/deploy-to-gcp.mdx) for next steps. |
0 commit comments