What Happens When You Give an AI Agent Your AWS Credentials – Encore Blog

This title could be clearer and more informative.Try out Clickbait Shieldfor free (5 uses left this month).

Teams are increasingly using AI agents to write backend code, but infrastructure provisioning remains a challenge. Giving agents access to Terraform exposes the full AWS API surface, creating security risks like misconfigured IAM policies, public databases, and open security groups. Policy tools like OPA, tfsec, and Checkov help but operate as blocklists against an unconstrained space. An alternative approach — infrastructure from code — lets agents declare typed infrastructure primitives (databases, pub/sub topics, cron jobs) in application code, while the platform handles actual cloud provisioning within pre-configured guardrails. This bounds the blast radius to the type system rather than the full cloud API, reduces review burden, and eliminates the need to give agents direct AWS credentials. A comparison table weighs three approaches: human-written Terraform, agent-written Terraform with policy checks, and infrastructure from code.

12m read timeFrom encore.dev
Post cover image
Table of contents
Keeping agents away from infrastructureGiving agents Terraform accessPolicy checks as guardrailsBounding the interface instead of policing the outputWhat reviewing agent-generated infrastructure looks likeThe access question reframedWhere this is heading
29 Impressions