The Simplest Way to Make AWS Secrets Manager and Vertex AI Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Teams pair aws secrets manager and vertex ai to keep keys safe during model runs. This setup lets Google Cloud jobs pull stored keys from AWS on demand. Many teams store their core database keys and API tokens inside AWS. Yet their data teams build and run machine learning models on Google Cloud. Linking both clouds lets apps read secrets at runtime without hardcoding keys in notebooks. You keep one home for secrets while giving models the exact keys they need. How aws secrets manager and ver

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 pair aws secrets manager and vertex ai to keep keys safe during model runs. This setup lets Google Cloud jobs pull stored keys from AWS on demand.

Many teams store their core database keys and API tokens inside AWS. Yet their data teams build and run machine learning models on Google Cloud. Linking both clouds lets apps read secrets at runtime without hardcoding keys in notebooks. You keep one home for secrets while giving models the exact keys they need.

How aws secrets manager and vertex ai share identity and data

Moving secrets across clouds starts with workload identity federation between Google and AWS. A Vertex AI job runs under a chosen Google Cloud service account. That service account holds a signed token that proves its identity to outside systems. AWS checks this token through its identity provider trust rules.

When the check passes, AWS hands back a short-term role token to the job. The job uses that temporary AWS role to call Secrets Manager over HTTPS. Secrets Manager checks the role policy and returns the needed database password or token. The model script holds the key in memory only while the task runs.

Once the job ends, both the memory and the short-term AWS token clear out. No static AWS keys ever sit inside container images or notebook files. Every secret read shows up in AWS CloudTrail with the linked service account name. You get a clear trail of which job read which secret and when.

Common failure modes when linking cloud secrets and models

The biggest mistake teams make is sharing one Google service account across many notebooks. When every notebook shares one identity, every user gets the same AWS secret permissions. A test script can then read production database keys that belong to another team. If a user prints that secret in a notebook output, it stays in storage.

Another common risk comes from broad wildcard rules inside AWS role policies. Teams often let a federated role read an entire folder of secrets at once. If a model prompt gets tricked, the job might pull keys it never needed. Broad network paths also let jobs send raw data to outside endpoints without checks.

AWS Secrets Manager + AI Agent Security: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

You can fix this by giving each Vertex AI pipeline its own service account. Map each Google account to one strict AWS role that reads one secret only. Turn on secret rotation in AWS so stolen keys expire on a set schedule. Also, use private network routing and mask emails or card numbers in query results.

Scoping permissions and audit logs across both clouds

Good cross-cloud rules start by tagging secrets by owner, project, and stage in AWS. Your AWS policy can require those tags to match the calling role tags. This stops a staging model run from ever reading a production secret in AWS. Keep token lifetimes short so an active session ends right after startup.

Next, combine your logs from AWS CloudTrail and Google Cloud Audit Logs. Match the token exchange event in Google with the secret read event in AWS. Alert your security team when an unknown service account tries to read a secret. Clear logs and tight roles keep cross-cloud machine learning safe and easy to run.

Add runtime guardrails and masking beside your databases and APIs

Login rules, role grants, and CI checks govern who connects to your stack. Yet any allowed script, engineer, or AI agent still runs commands with the full scope of its role. For workloads on Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes, SSH, or internal HTTP services, hoop.dev sits beside the service as an open-source proxy, a sidecar for your database or API.

Before a query runs, hoop.dev guardrails check the statement against your rules. An AI Analyzer you configure can score intent or hold risky calls for human review. Next, hoop.dev data masking rewrites sensitive fields in responses, and each verdict is logged per listener. Explore the MIT-licensed project on GitHub.

Frequently asked questions

Do I need static AWS keys inside Vertex AI notebooks?

No, you should never put static AWS keys in notebooks or container files. Use workload identity federation so Google service accounts trade tokens for short-term AWS roles.

How do I stop one model job from reading all secrets?

Give each Vertex AI job a separate Google service account and a separate AWS role. Limit each AWS role policy to the exact secret resource names that job needs.

What happens when AWS rotates a database secret during a job?

Running jobs keep working until they open a new database session. Build your app code to fetch the fresh secret from AWS if a login fails.

The query runs. The emails stay hidden.