This guide explains how to configure an AWS Lambda function running in a private subnet to securely access Google Cloud Storage (GCS) using Workload Identity Federation (WIF). The solution ensures keyless authentication — no long-lived GCP service account keys are stored or managed.
Workload Identity Federation (WIF) allows AWS workloads (e.g., Lambda, EC2, EKS) to exchange their native AWS identity for short-lived Google Cloud credentials via the Google Security Token Service.
-
-
Lambda assumes an AWS IAM role.
-
AWS STS issues a token for that role.
-
Google STS validates the AWS token via WIF provider.
-
A short-lived GCP access token is issued.
-
Lambda uses this token to access GCS buckets and Pub/Sub topics.
-
🔑 No long-lived service account keys.
🔒 Stronger security posture.
⚡ Simplified operations (no key rotation).
-
-
Use Workload Identity Federation for secure cross-cloud authentication.
-
Always package GCP client libraries as a Lambda Layer.
-
Keep Lambda in a private subnet for enhanced security.
-
Manage access via IAM role bindings in GCP.
-
