Agentic AI with Java: Live Cohort
Claude CodeDeploying the Application on Google Cloud

Google Cloud Project and SDK Setup

Create a Google Cloud project, install and initialise the Google Cloud CLI, authenticate, and verify the configuration from VS Code.

The image works locally. Now we prepare Google Cloud: a project to hold everything, and the Google Cloud CLI (gcloud) to control it from the terminal.

Google Cloud terms you will see

TermMeaning
Google accountThe login you use for the console and gcloud
Billing accountWhere charges go. Linked to one or more projects
ProjectA container for everything you create: services, images, settings, permissions
Project IDThe unique, permanent identifier of a project. Commands use this, not the display name
RegionThe data centre location, for example us-central1 or asia-south1 (Mumbai)
API / serviceA Google Cloud product you switch on per project, such as Cloud Run or Cloud Build
IAMIdentity and Access Management: who is allowed to do what in the project

Step 1: Create a project

Open the console

Go to the Google Cloud console and sign in with your Google account.

Create a new project

Click the project picker at the top, then New project. Enter a name, for example telusko-content-tracker. Leave Organization empty if you do not have one, and click Create.

Note the project ID

Google shows a project ID below the name. It must be globally unique, so it may differ slightly from the name. Every gcloud command uses the project ID, not the name. Save it next to the image name from the previous lesson.

Billing

Cloud Run, Cloud Build and Artifact Registry need billing enabled on the project, even if your usage stays within the free tier. Check Billing in the console and set a budget alert so you are notified long before any surprise.

Step 2: Install the Google Cloud CLI

Download the installer for your OS from the official install page:

OSHow
WindowsRun the Google Cloud CLI installer. Keep the option to add gcloud to your PATH
macOSDownload the archive and run the install script, or use Homebrew
LinuxUse the package for your distribution, or the archive

At the end, the installer starts gcloud init. It asks you to log in with your Google account and pick a project. If your new project is not in the list, choose to enter a project ID and type it.

Step 3: Make gcloud available in VS Code

The VS Code terminal may not see the new PATH yet. If gcloud is "not recognized":

  1. Close all VS Code windows (not just the terminal tab)
  2. Reopen VS Code and open a new terminal

Then check:

gcloud --version

Restart Claude Code in that new terminal too, and switch back to Sonnet with /model sonnet if needed.

Step 4: Authenticate

gcloud auth login

A browser window opens. Pick your account and click Allow.

Set the project for all following commands (use your own project ID):

gcloud config set project telusko-content-tracker

Also set application default credentials, which tools and libraries use to call Google APIs:

gcloud auth application-default login

Step 5: Verify

gcloud config list

You should see your account and your project ID. If both are right, the setup is done.

Should Claude Code run these commands?

It can, and for repetitive commands that is useful. But login flows open a browser and need your decisions, so they are easier to run yourself with ! or in a normal terminal. Commands that would put credentials or secrets in the conversation should always be run by you, outside Claude.

Useful gcloud commands

CommandWhat it does
gcloud --versionShow the installed CLI version
gcloud auth listShow which accounts are logged in and which one is active
gcloud config listShow the active account, project and default region
gcloud projects listList the projects your account can access
gcloud config set project <PROJECT_ID>Switch the active project
gcloud config set run/region us-central1Set a default region for Cloud Run, so you can skip --region

Troubleshooting

ProblemFix
gcloud is not recognizedRestart all VS Code windows or your terminal. On Windows, check that the Cloud SDK bin folder is on your PATH
New project does not appear in gcloud initChoose "enter a project ID" and type it, or run gcloud config set project <PROJECT_ID>
PERMISSION_DENIED or billing errors laterMake sure billing is linked to the project and that you are logged in with the account that owns it
Wrong account is usedgcloud auth list, then gcloud config set account <email>

Official references


Written By: Shramik Masti

How is this guide?

Last updated on