The Simplest Way to Make Cloud Run and S3 Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Teams use cloud run and s3 together to run stateless containers that read and write AWS objects. Workload identity federation lets Google Cloud services assume AWS roles without static keys. This setup bridges two major clouds with minimal upkeep. Your app runs on Google Cloud and scales down to zero when idle. Meanwhile, your files and backups stay inside Amazon S3 buckets. You avoid moving huge datasets across clouds just to run a small web job. How identity and data flow between cloud run

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

Teams use cloud run and s3 together to run stateless containers that read and write AWS objects. Workload identity federation lets Google Cloud services assume AWS roles without static keys.

This setup bridges two major clouds with minimal upkeep. Your app runs on Google Cloud and scales down to zero when idle. Meanwhile, your files and backups stay inside Amazon S3 buckets. You avoid moving huge datasets across clouds just to run a small web job.

How identity and data flow between cloud run and s3

Every Cloud Run service runs under a specific Google service account. That account can request a signed identity token from Google Cloud. The app sends that token to the AWS token service over the network. AWS checks the token against a trust rule that you set up ahead of time.

Once the check passes, AWS returns temporary credentials for a specific IAM role. The container uses those short-lived credentials to read or write objects in S3. No permanent AWS secret keys ever sit inside your container image or source code. When the token expires, the app asks for a fresh one on its own.

Data then flows over HTTPS between the container and the S3 endpoint. You can encrypt every file in transit and at rest inside the bucket. Each bucket rule checks the assumed AWS role before allowing any read or write action.

Common failure modes and how to scope roles

Many teams start by pasting static AWS keys into container variables. Those keys never expire unless a human rotates them by hand. If a developer prints environment variables to a debug log, anyone can steal the keys. Shared keys also make it impossible to see which container changed a file.

Overbroad permissions create another big risk for multi-cloud teams. Giving a container full access to all buckets means one bug can wipe out production data. Teams also forget to log object-level calls in AWS. Without those logs, you cannot trace who read sensitive files during an incident.

End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

To fix this, give each Cloud Run app its own dedicated Google service account. Map each Google account to one narrow AWS role. Scope the S3 bucket policy to allow only specific actions on one folder path. Turn on object access logs in AWS so every read and write creates a record.

Auditing cross-cloud traffic and handling sensitive data

Multi-cloud setups split your audit trail across two different cloud consoles. You see container startup logs in Google Cloud and bucket logs in AWS. Matching a single user request across both logs takes clear request tags and good clock sync. Teams should pass a trace ID in request headers when calling storage APIs.

You also need a plan for sensitive fields stored inside S3 files. Logs and exports often hold emails, phone numbers, card numbers, or national IDs. If engineers inspect bucket contents during debugging, data masking can rewrite matched fields in results. Combining strict role scoping with clear audit logs keeps cross-cloud storage safe and easy to manage.

Govern statements and responses across databases and APIs

Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.

First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.

Frequently asked questions

Do I need static AWS keys to use S3 from Cloud Run?

No, you should use workload identity federation instead of static keys. Your Google service account trades an identity token for temporary AWS role credentials.

How do I limit which S3 buckets a Cloud Run app can read?

Give the Cloud Run app a unique Google service account and map it to one AWS role. Restrict that AWS role policy to specific bucket names and folder prefixes.

Does traffic between Cloud Run and S3 cost extra money?

Yes, both cloud providers charge network egress fees when data leaves their network. Keep large batch jobs in the same cloud as your primary data when possible.

The query runs. The emails stay hidden.