- You tell us which service account will read the data.
- We create a read-only role for you on our side, and it trusts only that service account.
- Your service account asks Google for an ID token and exchanges it with AWS for temporary credentials to that role.
- You use those temporary credentials to read the bucket, with the same commands as the rest of this guide.
Requirements
- Data export enabled on your account. Contact the support team to request it.
- A Google Cloud project where you can create a service account, and the gcloud CLI.
- The AWS CLI or boto3 on the machine that downloads the files. Both read the bucket without any AWS account of your own.
Step 1: Create a dedicated service account
We recommend a service account used only for this export. It keeps the access easy to audit and to revoke.Step 2: Send us the service account’s unique ID
Every service account has a unique ID: a long number that never changes, even if the service account is renamed. This number, and nothing else, decides who can assume your role.Step 3: Receive your access details
Once the role is ready, we send you three values:
The role can only list, download, and restore files in your bucket:
s3:ListBucket, s3:GetObject, and s3:RestoreObject. You don’t need to attach any policy on your side, which is a difference from the AWS setup.
The audience is not a secret. It labels the token as meant for this export. What protects the role is the unique ID: AWS only accepts a token issued to your service account.
Step 4: Get a Google ID token
Your service account requests an ID token from Google with the audience we sent you. How it does that depends on where the download runs.- On Google Cloud compute
- From your own machine
On Compute Engine, Cloud Run, Cloud Functions, or GKE with Workload Identity, run the job as the service account from step 1. The metadata server issues the token, with no key to store:
Step 5: Configure the AWS CLI profile
Point thecloudhumans-export profile at the token file. The AWS CLI and boto3 exchange the token for temporary credentials on their own, and every command in this guide works unchanged.
~/.aws/config
~/.aws/credentials file, and you don’t need any AWS account.
Smoke test
Generate the token, then list the bucket:cloudhumans-export profile.
In a Python job
If you’d rather not write a token file, fetch the token and exchange it in code. On Google Cloud compute,fetch_id_token uses the metadata server; elsewhere, it uses the service account in GOOGLE_APPLICATION_CREDENTIALS.
credentials["Expiration"] tells you when. For a job that runs past it, fetch a new token and call assume_role_with_web_identity again.
Revoking access
The control stays with you. Disable or delete the service account in your Google Cloud project, and it can no longer get tokens, so it can no longer assume the role. Nothing on our end needs to change. To move the access to another service account, send the support team its unique ID. The old service account stops working as soon as we update the role.Troubleshooting
AccessDenied on AssumeRoleWithWebIdentity
AWS checked the token and it doesn’t match the role. Decode the token’s payload and compare it with what you sent us:
audmust be exactly<AUDIENCE>, with no extra slash or space.submust be the unique ID you sent us. A different number means the token came from another identity: usually your own user, when impersonation was left out.
InvalidIdentityToken or ExpiredTokenException
The token is malformed or older than about an hour. Generate a new one (step 4) and run the command again.
AccessDenied on s3:ListBucket or s3:GetObject
The role was assumed, so your identity is correct. Check the bucket name and the region (us-east-1). For files older than 180 days, see InvalidObjectState on download.