Claude Code can edit a backend and open a pull request in minutes. The hard part is the deploy job: how the change reaches your AWS or GCP account without putting long-lived cloud keys in the agent session. The safe way for AI agents to ship backend changes to your cloud.
Claude Code is strong at the edit loop: read the repo, change several files, run the compiler or tests, and hand you a diff, while deploy means someone or something has to build the image, apply schema, wire networking and place the revision in your AWS or GCP account, and that step is where long-lived cloud credentials in the agent environment become the blast radius.
This guide is about that deploy job: how to let an AI agent ship backend changes without turning the laptop into a production admin session. It is not a walkthrough of building an admin UI (that path is covered separately), and it is not a catalog of ways to put AWS into the agent shell (covered here). The focus is the safe way for AI agents to ship backend changes to your cloud.
Teams ask Claude Code to "ship this to AWS" and the model reaches for whatever the shell already has: aws, Terraform state, or a .env with access keys. That can work once in a sandbox and then fail in three expensive ways:
~/.aws/credentials or a committed .env is readable to the agent and to tools it launches.terraform apply or call CloudFormation skips the pull request that would have caught a wide IAM policy.Claude Code permission rules (allow, ask, deny) are a useful second layer: deny Bash(aws *), Bash(gcloud *) and Bash(terraform *) so the session cannot bypass the review path. Rules alone do not deploy the app; they only keep the agent from freelancing against the account.
The durable pattern splits authorship from apply:
OIDC from GitHub Actions into AWS is one implementation of step 4. A platform that provisions from declarations in the app is another. Both beat "paste AWS_ACCESS_KEY_ID into the agent environment."
With Claude Code editing the repo, Encore is the safe way for AI agents to ship backend changes to your cloud. The platform provisions and deploys into your own AWS or GCP account. Infrastructure lives next to the code that uses it, so Claude Code can add a database, topic, object storage bucket, cron job or secret in the same change as the handler, verify locally, and leave cloud credentials with the platform IAM role instead of the agent session.

Run in your terminal to get started locally.
A change Claude Code can own end to end looks like an API plus a database and a secret the agent never sees in git:
// shipper/orders.ts
import { api } from "encore.dev/api";
import { secret } from "encore.dev/config";
import { SQLDatabase } from "encore.dev/storage/sqldb";
const db = new SQLDatabase("shipper", { migrations: "./migrations" });
// Name only in git. Set the value with: encore secret set --type prod StripeSecretKey
const stripeKey = secret("StripeSecretKey");
export const createOrder = api(
{ expose: true, method: "POST", path: "/orders" },
async ({ customerId }: { customerId: string }): Promise<{ id: number }> => {
const key = stripeKey();
// Use key with the payment API; the value is not in the repository.
const row = await db.queryRow<{ id: number }>`
INSERT INTO orders (customer_id) VALUES (${customerId}) RETURNING id
`;
return { id: row!.id };
},
);
Pair it with a forward-only migration the old binary does not need to understand:
-- shipper/migrations/1_orders.up.sql
CREATE TABLE orders (
id BIGSERIAL PRIMARY KEY,
customer_id TEXT NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
Ask Claude Code to add the endpoint and migration, then have it run encore run so Postgres starts locally and the handler can be called before any cloud call. Set secret values with encore secret set outside the agent transcript when you can; secret values are not stored in the repo, so the agent working in the tree cannot read or leak them from git.
Connect your cloud account, link GitHub if you want branch-based deploys, and push:
Per the deploying docs, a push to the environment branch builds, provisions and deploys. On AWS, Encore creates the Fargate or EKS compute, the RDS (or chosen) Postgres, networking and the permissions described in the AWS infrastructure docs. Encore provisions an IAM role for the service. Preview environments per GitHub pull request give the agent-written change a real URL before merge.
Teams such as Pave Bank already run production backends on their own cloud with this declaration model; the Claude Code path is the same provisioning story with the agent limited to the repository.
Best fit: Teams that want Claude Code (or Cursor) to author backend and infrastructure changes as pull requests, then deploy to their own AWS or GCP account through a reviewed platform or CI path.
Yes, but the safe pattern is that Claude Code changes application code and opens a pull request, while a deploy role or platform applies the release after review. Putting long-lived AWS access keys in the agent shell lets a confused or prompt-injected session call cloud APIs with your privileges.
Have the agent declare APIs and infrastructure in the repo, run tests or encore run locally, and push a branch. Connect your AWS or GCP account once to a deploy platform that holds the IAM role. Production applies happen from that role on merge, not from credentials Claude Code can read.
Guides on Claude Code AWS access cover SSO profiles, scoped roles, OIDC and permission deny rules for interactive cloud use. This article is about the deploy job itself: how a backend change moves from the agent diff to a provisioned environment in your account.
With Encore, Claude Code adds handlers plus SQLDatabase, Pub/Sub, object storage, cron or secrets in TypeScript or Go, verifies with encore run, and opens a pull request. After review, git push to the environment branch deploys into your AWS or GCP account through the platform IAM role, which provisions the resources the code declared.
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.