Prepare and test your skills
Prepare and test your skills
Secure connectivity and API perimeter controls keep internal workloads off the public internet while still allowing programmatic calls to Google APIs. Private Google Access (opens in a new tab) provides private network paths from virtual machines (VMs) without external IP addresses to Google APIs and services. VPC Service Controls (opens in a new tab) builds a logical security perimeter around projects, networks, and Google-managed services to block data movement outside authorized boundaries.
Limiting external access means giving resources only a private internal IP address and allowing internet access solely where it is required. Resources in a Virtual Private Cloud (VPC) network communicate through internal IP addresses when firewall rules permit, so workloads without external addresses remain isolated by default. Organizational policies further restrict which resources can receive external IP addresses, while firewall policies at the organization, folder, and VPC network levels define what traffic is allowed. When private VMs still need outbound internet access, strict egress firewall rules restrict internet-bound traffic to reduce the path available for data exfiltration.
| Egress option | Traffic type | Choose when |
|---|---|---|
| Secure Web Proxy | HTTP(S) downloads | Identity controls are required for outbound web traffic |
| Cloud NAT | General internet traffic | VMs need outbound internet without their own external IP addresses |
Private Google Access is a subnet-level feature that lets VMs with only private internal IP addresses reach Google APIs and services without using the public internet. Traffic from the VM to Google APIs follows the default internet gateway next-hop, but despite the gateway name the traffic path remains within Google's network. Private Service Connect endpoints provide an alternative private path from a VPC network to Google APIs and services. Enabling Private Google Access on each subnet that hosts private-only instances does not slow communication with Google APIs.
Exam tip: VMs with only private IP addresses cannot reach Google APIs by default — enable Private Google Access on the subnet or create Private Service Connect endpoints.
VPC Service Controls is the control that creates service perimeters around VPC resources and Google-managed services to control data movement across the perimeter boundary. A perimeter groups projects and an on-premises network into a single boundary that prevents data access through Google-managed services from outside the perimeter. Service perimeters cannot contain projects from different organizations, but perimeter bridges allow projects and services in different service perimeters to communicate. Combined with strict egress rules, VPC Service Controls mitigates data exfiltration by restricting API access to authorized network perimeters.
API request enforcement is the ordered set of checks that every request to Google Cloud services passes before reaching backend services. A request flows from the caller to the backend only after identity, policy, and perimeter checks succeed:
A left-to-right process flow showing an API request passing Entry, Authentication, Authorization with VPC Service Controls perimeter check, then Backend; requests from outside the perimeter are denied.
Because VPC Service Controls is evaluated before the backend is called, a request from outside the authorized perimeter is denied even when the caller has valid credentials.
Performance optimization and resource management for Google Cloud APIs (opens in a new tab) means using the fastest access path, sending less data over the network, and controlling request rates so applications stay within billing and quota limits. Google Cloud APIs are programmatic interfaces to Google Cloud services that run on subdomains of googleapis.com, such as pubsub.googleapis.com, and accept requests over the public internet and VPC networks. Clients send HTTP and gRPC requests to Cloud API endpoints directly or by using client libraries, and each API attributes billing and quota to a project.
Efficient interfaces and client libraries determine how application code reaches a Cloud API endpoint and how much overhead each call carries. All Cloud APIs provide a simple JSON HTTP interface that can be called directly or through Google API Client Libraries, while most Cloud APIs also provide a gRPC interface called through Google Cloud Client Libraries for better performance and usability. Google Cloud Client Libraries also simplify application code by handling authentication, error handling, retry, and payload validation in the preferred language conventions. Third-party clients, the Google Cloud CLI, Google Cloud console, Firebase SDKs for mobile apps, and Google Cloud MCP servers provide additional paths, but server applications gain the most efficiency from the language-specific client libraries.
| Interface | How it is called | Performance characteristic |
|---|---|---|
| JSON HTTP | Directly or with Google API Client Libraries | Simple interface available on all Cloud APIs |
| gRPC | With Google Cloud Client Libraries | Better performance and usability where available |
All Cloud APIs accept only secure requests using TLS encryption, so traffic flows encrypted from the client to the API endpoint. When an application uses a supported client library, in-transit encryption is handled by the library. When an application uses its own gRPC client, the client must authenticate with Google using TLS, and when it uses its own HTTP client, it must follow the HTTP guidelines. For enterprise workloads that must stay private for security and compliance, Private Service Connect sets up and manages access to Cloud APIs from within VPC networks instead of traversing the public internet.
Exam tip: Choose the gRPC interface with Google Cloud Client Libraries when performance and usability matter most, and choose the JSON HTTP interface when direct calls or broad compatibility matter most.
Reducing latency and data transfer costs starts with placing traffic close to backends and knowing how much data leaves Google Cloud. Selecting a Google Cloud region that is geographically close to the private computing environment where backend components are hosted minimizes communication latency between environments. Applications should also track anticipated outbound data transfer leaving Google Cloud, because egress charges apply to services including Compute Engine, Cloud Storage, Cloud SQL, and Cloud Interconnect, and regional and zonal traffic can add bandwidth charges. For long-term architectures with high outbound volumes, Cloud Interconnect can optimize connectivity performance and might reduce outbound charges for traffic that meets certain conditions.
High-performing API delivery combines Apigee and Cloud CDN with Cloud Load Balancing to host APIs globally, reduce latency, and increase availability for peak traffic seasons. Using Cloud Load Balancing with hybrid connectivity extends cloud load balancing to services hosted on premises, which enables phased workload migrations with minimal or no service disruption. Using Cloud Load Balancing with an API gateway or proxy together provides a more robust solution for managing, securing, and distributing API traffic at scale:
An API gateway or proxy also acts as a unifying facade that shields client apps from backend code changes, implements additional security measures, facilitates audit trails, and bridges legacy and modernized services.
Controlling rate, retries, and dependencies keeps API interaction reliable when request volume spikes or when systems span environments. Cloud Pub/Sub illustrates the pattern: publisher flow control limits the rate of publish requests to avoid errors during transient spikes in message traffic, and retry-request settings handle failed publish attempts. Google Cloud Client Libraries apply the same idea more broadly by handling retry and error handling for Cloud API calls, so transient failures do not require custom code in every application. Vector Search index endpoints add autoscaling that increases node count automatically up to a configured maximum as query load grows.
Dependencies between environments need the same discipline because synchronous calls across environments can slow performance, decrease overall availability, and incur additional outbound data transfer charges. Applications should minimize high dependencies between systems running in different environments, especially synchronous communication, and expose components through secure APIs with fine-grained control. Resource attribution also affects management: resource-based APIs use the project associated with the resources being accessed for billing and quota, while client-based APIs use the project associated with the client accessing the resources. Knowing which project carries quota helps teams monitor usage, isolate workloads, and plan retry behavior without exhausting shared limits.
Application Default Credentials (ADC) (opens in a new tab) is the portable mechanism that lets workload code authenticate to Google Cloud without embedding environment-specific credentials. Google Cloud client libraries that implement ADC check known locations in the current environment for credentials, so the same code can run locally and in production. ADC automatically uses user credentials during local development and short-lived service account credentials when the code runs on Google Cloud.
ADC automates identity discovery because the client library, not the application code, finds the right credential for the environment where the workload runs. The request flow runs from the workload code to the client library to ADC to the configured credential source, and then from the credential source to the Google Cloud API. When the deployment location changes, only the environment configuration changes while the code stays unchanged. ADC cannot be used to authenticate the gcloud CLI or to authenticate a request that uses an API key, which is supported only with specific APIs.
Exam tip: Use ADC for workload code that calls Google Cloud APIs through client libraries, not for gcloud commands or API key requests.
ADC for local development lets a developer run the same code locally that will later run in production. In a local shell, ADC uses a local credential file created by the Google Cloud CLI, while Cloud Shell already provides credentials so no login step is needed.
gcloud init to configure it.gcloud auth application-default login to open a sign-in screen.If an external identity provider is used, first sign in to the gcloud CLI with that federated identity before creating ADC credentials.
ADC on Google Cloud uses the credentials of the service account attached to the compute resource where the code runs, such as a Compute Engine virtual machine (VM) instance. This attached service account is the preferred authentication method for code running on a Google Cloud compute resource because no credential file is managed in code. The workload depends on the attached service account, so the service account's IAM roles determine exactly what the workload can access.
For most services, the service account must be attached when the resource that runs the code is created, and it cannot be added or replaced later. Compute Engine is an exception because it lets you attach a service account to a VM instance at any time. Choosing a dedicated service account with only the roles the workload needs enforces least privilege, and using its short-lived credentials avoids distributing long-lived keys.
| Environment | Credential ADC uses | Key behavior |
|---|---|---|
| Local development | User credentials in local ADC file | Same code authenticates as the developer for building and testing |
| Google Cloud compute resource | Service account attached to the resource | Same code authenticates as the attached service account in production |
Service account impersonation lets a developer act temporarily as a service account without downloading its keys. Impersonation is used when user credentials cannot be used from a local environment or when permissions assigned to a service account need to be tested. The caller must have the iam.serviceAccounts.getAccessToken permission, which is included in the Service Account Token Creator (roles/iam.serviceAccountTokenCreator) IAM role.
For gcloud CLI use, impersonation is configured with gcloud config set auth/impersonate_service_account SERVICE_ACCT_EMAIL. For client-library use, a local ADC file that impersonates a service account is created with gcloud auth application-default login --impersonate-service-account=SERVICE_ACCT_EMAIL. That ADC impersonation file is supported only for the Go, Java, Node.js, and Python client libraries and is not supported for other languages.
Connecting external identities extends ADC with federation for users and workloads that live outside Google Cloud. Workforce Identity Federation connects an existing external identity provider for human users, while Workload Identity Federation connects workloads running outside Google Cloud that need access to Google Cloud resources. Traffic flows from the external provider through federation to Google Cloud, so external identities can access resources without creating extra Google accounts or long-lived service account keys.
Additional safeguards reduce risk around the credentials ADC and other methods rely on:
Private Google Access is a subnet-level feature that lets virtual machines with only private internal IP addresses reach Google APIs and services without using the public internet. Traffic follows the default internet gateway next-hop but remains within Google's network, and Private Service Connect endpoints provide an alternative private path from a Virtual Private Cloud network to Google APIs and services.
Virtual Private Cloud Service Controls creates service perimeters around projects, networks, and Google-managed services to control data movement across the perimeter boundary. Every API request is checked for perimeter membership before it reaches backend services, so a request from outside the authorized perimeter is denied even when the caller has valid credentials.
Use the gRPC interface with Google Cloud Client Libraries when performance and usability matter most, and use the JSON HTTP interface when direct calls or broad compatibility matter most. All Google Cloud APIs provide the JSON HTTP interface while most also provide gRPC, and all accept only secure requests using TLS encryption.
Application Default Credentials lets the same workload code use user credentials in a local credential file during local development and the short-lived credentials of the attached service account when running on a Google Cloud compute resource. ADC cannot be used to authenticate the gcloud CLI or to authenticate a request that uses an API key.
An enterprise development team is building a microservices application that interacts programmatically with Google Cloud APIs, including BigQuery and Cloud Storage. The application codebase is deployed across multiple environments: developer workstations for local testing, Compute Engine instances for staging, and Google Kubernetes Engine (GKE) clusters for production.
The security architecture requires eliminating the risks associated with downloadable, long-lived service account keys and ensuring least privilege access across each deployment tier without code changes.
Which identity and authentication strategy should the team implement?
Last updated