The Simplest Way to Make Cloudformation and GCP Secret Manager Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Teams use cloudformation and gcp secret manager to share keys across two clouds. This setup lets AWS stacks read secrets stored in Google Cloud during a build. Multi-cloud teams often keep all keys in one vault to reduce drift. When you deploy AWS resources, those stacks still need database passwords or API keys. Linking the two tools removes the need to copy secrets by hand. How cloudformation and gcp secret manager share data AWS stacks cannot read Google Cloud vaults right out of the box.

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 cloudformation and gcp secret manager to share keys across two clouds. This setup lets AWS stacks read secrets stored in Google Cloud during a build.

Multi-cloud teams often keep all keys in one vault to reduce drift. When you deploy AWS resources, those stacks still need database passwords or API keys. Linking the two tools removes the need to copy secrets by hand.

How cloudformation and gcp secret manager share data

AWS stacks cannot read Google Cloud vaults right out of the box. You must build a bridge between AWS identity roles and Google Cloud permissions. Custom resources in your AWS stack templates handle this job well.

When a stack runs, it triggers a small serverless function in AWS. This function uses workload identity federation to log in to Google Cloud. It trades its AWS role token for a short Google Cloud token. No one has to store a long-term key file in AWS.

Next, the function asks the Google vault for the needed secret value. Google checks the role permissions and sends the secret back over HTTPS. The function then hands that value to the AWS stack resource. Once the resource starts, the temporary token expires on its own.

Common failure modes and how to scope roles

Many teams make the mistake of using one shared service account. They give this single account read rights to every secret in the vault. If one stack gets compromised, an attacker can read all company keys.

Static JSON key files create another big risk for cloud teams. Engineers often paste these keys into stack parameters to save time. Those keys never expire unless someone rotates them by hand. They also show up in plain text inside stack history logs.

GCP Secret Manager + CloudFormation Guard: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Unlogged secret reads also cause trouble during security audits. If ten stacks use the same identity, logs cannot show which stack read a key. You lose track of who touched sensitive data and when they did it.

To fix this, give each AWS stack its own narrow role. Map each AWS role to a specific secret in Google Cloud. Never grant broad project-level read rights to a deployment role. Turn on data read logs in Google Cloud so you see every request.

Managing secret rotation across both clouds

Secrets change over time, and your stacks must keep up with them. When a key rotates in Google Cloud, AWS resources do not know right away. An app might fail to log in if it holds an old password.

You can solve this by tying secret updates to stack updates. When a team writes a new secret version, an event can trigger a stack run. The custom resource runs again and pulls the fresh key version. Your AWS app gets the new key without human steps.

Also, make sure your stack templates never print secret values to output logs. Set the no-echo rule on every secret parameter you pass around. This simple step keeps raw passwords out of the AWS console view.

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

Why not copy secrets into AWS Secrets Manager instead?

Copying keys to two vaults creates sync problems and doubles your storage bills. When a key rotates in one place, scripts must update the other. Reading from one source of truth keeps rotation simple and clean.

How do we avoid storing Google JSON keys in AWS?

Use workload identity federation between your AWS account and your Google project. This feature lets an AWS role trade its native token for a Google token. You never have to create or download a static JSON key file.

Can stack outputs leak values from Google Cloud?

Yes, stack outputs and change sets can show plain text values if you are not careful. Always mark secret values as hidden in your custom resource response. Never pass raw keys into standard stack output fields.

The query runs. The emails stay hidden.