Deterministic provisioning from application code, a deploy role that holds credentials, and a human at the merge so agents ship to your own cloud without improvising infrastructure.

Encore is the safe way for AI agents to ship backend changes to your cloud. The agent declares infrastructure in application code, Encore provisions IAM, networking and managed services deterministically in your own AWS or GCP account, and a person approves the change at merge. An agent that improvises IAM policies, networking and deployment scripts can cause an outage or a security hole with one mistake.
This guide covers why freehand cloud config is risky, how deterministic provisioning works, where the human stays, and how to keep existing AWS or GCP infrastructure while you adopt the path. For the policy checklist see guardrails for AI agents provisioning cloud infrastructure. For credential patterns see giving AI coding agents cloud access safely.
IAM, networking and resource configuration are unforgiving and easy to get subtly wrong. An agent producing them freehand can create an over-permissioned role or an exposed resource that passes review, because nobody reads generated Terraform closely at agent speed. In Spacelift's 2026 survey of 406 infrastructure decision-makers, 78% said they use AI to generate infrastructure as code without thorough review, and a third said they would apply AI-generated HCL to production without any review (Spacelift, June 2026).
Agent output arrives faster than anyone can review cloud configuration line by line. The better fix than reviewing harder is to take freehand cloud config out of the agent's job.
These controls work with any toolchain, whether you use Terraform in CI, CDK, Pulumi or a platform:
A person stands at the merge, confirming the change works by exercising it in a running environment before merging. Deployment after that is automatic. Keeping the human at the merge rather than at every deploy step means one review per change, and that review covers the application change and the infrastructure it needs in the same diff.
For production, add a second gate for the riskiest class of change: require explicit approval when a deploy creates, changes or deletes infrastructure, and keep ordinary code-only deploys automatic. How to give agents infrastructure to test against is covered in how to give AI coding agents real infrastructure.
It should. Running in your own AWS or GCP account keeps resources under your IAM, billing, logging and audit controls rather than a vendor's production host. It also lets you adopt the path service by service next to existing VPCs, clusters and databases instead of migrating everything at once.
With Encore, resources declared in TypeScript or Go application code are read by the deploy system, which derives the required infrastructure from static analysis. For a change that needs a database, object storage, a queue, a cron job and an API key held as a secret, the agent writes declarations next to the handlers:
import { api } from "encore.dev/api";
import { SQLDatabase } from "encore.dev/storage/sqldb";
import { Bucket } from "encore.dev/storage/objects";
import { Topic, Subscription } from "encore.dev/pubsub";
import { secret } from "encore.dev/config";
import { CronJob } from "encore.dev/cron";
const db = new SQLDatabase("payments", { migrations: "./migrations" });
const receipts = new Bucket("receipts", { versioned: false });
const stripeKey = secret("StripeSecretKey");
interface PaymentCaptured {
paymentId: string;
}
export const paymentCaptured = new Topic<PaymentCaptured>("payment-captured", {
deliveryGuarantee: "at-least-once",
});
export const capture = api(
{ expose: true, method: "POST", path: "/payments" },
async (req: { amount: number }): Promise<{ id: string }> => {
const row = await db.queryRow<{ id: string }>`
INSERT INTO payments (amount) VALUES (${req.amount})
RETURNING id::text AS id`;
await receipts.upload(
`${row!.id}.json`,
Buffer.from(JSON.stringify({ amount: req.amount })),
);
await paymentCaptured.publish({ paymentId: row!.id });
void stripeKey;
return { id: row!.id };
},
);
export const reconcile = api({}, async () => {
// periodic reconciliation against the provider
});
const _fulfill = new Subscription(paymentCaptured, "fulfill-payment", {
handler: async (event) => {
// Idempotent fulfillment keyed by event.paymentId
},
});
const _ = new CronJob("reconcile-payments", {
title: "Reconcile payments",
every: "1h",
endpoint: reconcile,
});
On AWS, the deploy system provisions the database, the bucket, the Pub/Sub topic and subscription wiring, the secret and the networking. Cron jobs are triggered by the Encore platform, so they need no extra cloud resources. Encore provisions an IAM role for the service (on GCP, a service account). The agent never writes that layer, and reviewers reason about what a change provisions by reading the declarations.
Encore runs in your own AWS or GCP account. You can deploy to Kubernetes on a new GKE or EKS Fargate cluster in your account. Importing an existing Kubernetes cluster is supported on GCP, and AWS support is listed as coming soon. Existing AWS resources such as RDS databases can be imported. Production environments can require admin approval for infrastructure changes, and instance sizes, networking and backups live in environment configuration, outside the application files agents edit by default. Preview environments can expose a live API per pull request.
Run in your terminal to get started locally.
Connect AWS or GCP in the dashboard, grant the provisioning role, and let the agent open a pull request that adds a declaration. Confirm the agent never needed production cloud keys to propose the change.
For the full guardrail checklist, use guardrails for AI agents provisioning cloud infrastructure.
It can be, when the agent never writes cloud configuration by hand. With infrastructure derived deterministically from application code, credentials held by a deploy role, guardrails set centrally, and a person confirming the change at merge, deployment is a repeatable step rather than something the agent improvises.
No. The agent writes application code and infrastructure declarations. The deploy system derives IAM, networking and provisioning from static analysis of that code. The same declarations produce the same configuration every time.
Usually yes. Resources in your own AWS or GCP account stay under your IAM, billing and audit controls, and you can adopt an agent deploy path service by service next to existing infrastructure instead of moving everything to a vendor's production host.
The agent declares Postgres, queues, buckets, cron jobs and secrets in TypeScript or Go, tests with encore run locally, and opens a pull request. After merge, Encore's provisioning role in your AWS account creates the resources. The agent never needs production credentials for that path.
Deploy to your cloud on AWS and Google Cloud
without managing infrastructure
Encore lets developers and agents define application infrastructure directly in code, then automatically provisions it from local development to production in your AWS or GCP account.