Skip to main content

AWS-GCP Workload Identity Federation Auth

Minimal Python library for exchanging AWS EKS credentials for GCP credentials using Workload Identity Federation.

Installation

pip install aws-gcp-wif-auth

Usage

Auto-detect Environment (Recommended)

from aws_gcp_wif_auth import get_credentials

# Automatically uses WIF in EKS, ADC locally
credentials = get_credentials(
    project_number="123456789",
    pool_id="my-wif-pool",
    provider_id="my-wif-provider",
    service_account_email="my-sa@project.iam.gserviceaccount.com"
)

Explicit WIF

from aws_gcp_wif_auth import get_wif_credentials

credentials = get_wif_credentials(
    project_number="123456789",
    pool_id="my-wif-pool",
    provider_id="my-wif-provider",
    service_account_email="my-sa@project.iam.gserviceaccount.com",
    aws_region="us-east-1"
)

Local Development (ADC)

from aws_gcp_wif_auth import get_adc_credentials

# Uses: gcloud auth application-default login
credentials = get_adc_credentials()

Authenticated Session

from aws_gcp_wif_auth import get_authed_session

# Get session with auto-refreshing credentials
session = get_authed_session(
    project_number="123456789",
    pool_id="my-wif-pool",
    provider_id="my-wif-provider",
    service_account_email="my-sa@project.iam.gserviceaccount.com"
)

# Make API requests
response = session.get("https://storage.googleapis.com/storage/v1/b")

Environment Detection

from aws_gcp_wif_auth import is_eks_environment

if is_eks_environment():
    print("Running in EKS")
else:
    print("Running locally")

Use with Google Cloud Libraries

from google.cloud import storage
from aws_gcp_wif_auth import get_credentials

credentials = get_credentials(
    project_number="123456789",
    pool_id="my-pool",
    provider_id="my-provider",
    service_account_email="sa@project.iam.gserviceaccount.com"
)

client = storage.Client(credentials=credentials)
buckets = list(client.list_buckets())

API Reference

get_credentials()

Auto-detect environment and return appropriate credentials.

Parameters:

  • project_number: GCP project number (required for WIF)
  • pool_id: Workload Identity Pool ID (required for WIF)
  • provider_id: Workload Identity Provider ID (required for WIF)
  • service_account_email: GCP service account email (required for WIF)
  • aws_region: AWS region (default: "us-east-1")
  • scopes: OAuth scopes list (default: cloud-platform)
  • use_adc: Force ADC instead of auto-detection (default: False)

get_wif_credentials()

Explicitly use Workload Identity Federation.

get_adc_credentials()

Explicitly use Application Default Credentials.

get_authed_session()

Get authenticated session with auto-refreshing credentials.

is_eks_environment()

Check if running in EKS environment.

Requirements

  • Python 3.8+
  • Running in AWS EKS with IAM role for service account (for WIF)
  • GCP Workload Identity Pool configured for AWS (for WIF)
  • gcloud auth application-default login (for local ADC)

License

MIT

Metadata

Release files for eks-gcp-wif 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for eks-gcp-wif 0.1.1
File Size Uploaded Provenance
eks_gcp_wif-0.1.1.tar.gz 4.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for eks-gcp-wif 0.1.1
File Interpreter ABI Platform
eks_gcp_wif-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 9.4 kB

Release files / eks_gcp_wif-0.1.1.tar.gz

Download URL eks_gcp_wif-0.1.1.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
0eabf0d25b2622934c25606eb836da918a820d22a0a07261f56a097202245802
BLAKE2b-256 checksum
How to use checksums
1b29b53159055d93b9c07bba00dc81c158a1c44821977d4fcea2aa135751e46e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.2

Release files / eks_gcp_wif-0.1.1-py3-none-any.whl

Download URL eks_gcp_wif-0.1.1-py3-none-any.whl
Size 5.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ea7ad30d14af1b95d347a7afc90fb9c955f21f760b38b506fb1a9b4c204ab1f9
BLAKE2b-256 checksum
How to use checksums
d50e14aa75cd29ebcd8163a07ef952abb01804901131abf0c353f44c9f911b83
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.2

Security for eks-gcp-wif 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page