The Simplest Way to Make AWS CloudFormation and Github Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Teams use aws cloudformation and github to build and update cloud stacks from code. You store templates in a code repo and trigger stack updates on every merge. This workflow turns manual cloud changes into a clean, repeatable review loop. Engineers check every change in a pull request before any cloud resource updates. When you merge the code, an action runner sends the template to your cloud account. The cloud service then reads the template and updates your live stack. How aws cloudformati

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 aws cloudformation and github to build and update cloud stacks from code. You store templates in a code repo and trigger stack updates on every merge.

This workflow turns manual cloud changes into a clean, repeatable review loop. Engineers check every change in a pull request before any cloud resource updates. When you merge the code, an action runner sends the template to your cloud account. The cloud service then reads the template and updates your live stack.

How aws cloudformation and github share roles and data

The link between aws cloudformation and github starts with trust between both platforms. In the past, teams stored static cloud keys inside their code repo settings. Static keys create big risks because they do not expire on their own. Modern setups use OpenID Connect to trade short-lived tokens between the two systems.

When a workflow runs, the code platform sends a signed token to the cloud account. Your cloud account checks the token against a trust rule that you set up. The trust rule checks the repo name and the branch name first. If they match, the cloud account gives the runner a temporary role. The runner uses that role to push the template to the stack service.

Then the stack service needs its own role to build the actual resources. You pass a service role to the stack engine during the run. The runner only needs permission to start the stack update and read the status. The stack service uses its own role to create servers, buckets, and networks. This split keeps your runner permissions small and safe.

Common failure modes and how to scope permissions

Many teams fail by giving one broad admin role to every repo runner. If a bad change enters one repo, it can break your whole cloud account. Shared service accounts also make it hard to see who made a change. Your cloud logs will show the same role name for every single team.

Another common trap is letting any branch assume your prod deployment role. If you skip branch checks in your trust rule, a test branch can alter prod. Teams also forget to log the exact commit hash in their stack tags. Without tags, operators must guess which code commit matches a broken cloud stack.

AWS IAM Policies + CloudFormation Guard: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

To fix this, create one specific cloud role for each code repo and branch. Lock the trust rule to only allow merges from your main branch. Scope the stack service role to only the resources that specific app needs. Use stack policy rules to block accidental deletes on databases and storage buckets.

You also need to plan for manual checks when a stack update fails. Even with good automation, engineers still query live cloud resources to fix drift. If engineers share keys for these checks, your audit trail breaks down fast. You should tie every live check and command to a single person.

Managing live checks and manual stack fixes

Code pipelines handle most stack changes, but live incidents still need human action. A stack might get stuck in a rollback state during a bad deploy. When that happens, an engineer must check the live cloud state and fix the drift.

Give engineers narrow permissions for these live tasks instead of permanent admin keys. Log every read and write command so the team can review the fix later. Mask sensitive values like emails, phone numbers, card numbers, and national IDs in query results. Masking rewrites matched fields in results so raw personal data stays safe during checks.

Check database and API queries on the wire

Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.

Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.

Frequently asked questions

Should we store static cloud keys in our repo secrets?

No, you should avoid static keys in your code platform settings. Set up OpenID Connect so your workflows request temporary role tokens for each run.

How do we stop a pull request from changing production stacks?

Give pull request checks a read-only role that only runs change set previews. Lock your write role trust rule to the main branch after merge.

Why use a separate role for the stack service itself?

A separate service role keeps your workflow runner from holding broad cloud permissions. The runner only triggers the stack, while the service role builds the resources.

The query runs. The emails stay hidden.