# AWS Amplify Gen 3 in practice: Postgres, sign-in and Bedrock AI in one app, and what changed from Gen 2

> Source: <https://builder.aws.com/content/3MvaWd5QFhnBQnb0g1LGW2Pb0uv/aws-amplify-gen-3-in-practice-postgres-sign-in-and-bedrock-ai-in-one-app-and-what-changed-from-gen-2>
> Published: 2026-12-02 22:00:27+00:00

**Key takeaway:** Amplify Gen 3 replaces Gen 2's TypeScript defineAuth/defineData resources and CloudFormation stacks with one amplify.jsonc plus SQL migrations, and its local run command starts PostgreSQL 17, auth and an API gateway in a single container for local development.

# AWS Amplify Gen 3 in practice: Postgres, sign-in and Bedrock AI in one app, and what changed from Gen 2

I built a React reading list with a managed Postgres database, row-level security, sign-in and Amazon Nova summaries, then deployed, rolled back and shipped an untested-until-promoted release with the new aws amplifygen3 CLI. Every step was tried; here is what worked, what the free plan leaves out, and when Gen 2 is still the better fit.

I built a small full-stack app on AWS Amplify Gen 3: a reading list with a Postgres database, email sign-in, row-level security and AI summaries from Amazon Bedrock. The first deploy, with a brand-new database, took 

**43 seconds**. Rolling back took seconds. There was no CloudFormation, CDK or IAM policy to write.
That's the big change from Gen 2. In Gen 2 you described AWS resources in TypeScript ( 

`defineAuth` ,  `defineData` ), and CDK turned them into CloudFormation stacks. In Gen 3 you describe the *app*: a frontend, a few SQL files and one`amplify.jsonc` . Amplify runs the rest: CDN, firewall, compute, Postgres, sign-in and a REST data API.
The app is 

**Link Vault**: signed-in users save links and get a short AI summary of each one. It uses React (Vite), a small Node.js API, Postgres with row-level security, email sign-in and Amazon Nova on Bedrock, and it took one afternoon. Below is every step I took, what worked, what the free plan leaves out, and when Gen 2 is still the better choice.

## 1. What Gen 3 is, in five nouns

| Concept | What it is in Link Vault | 
|---|---|
| **App** | `link-vault`  in us-east-1, with a default domain on`amplify.app`  | 
| **amplify.jsonc** | the only config file: build commands and the  `backend`  block | 
| **Environment** | `preview`  (default deploy target) and`production`  , each with its own URL, variables, IAM role and backend branch | 
| **Deployment** | an immutable snapshot with its own URL; the environment URL points at one of them | 
| **Backend** | at most one per app: PostgreSQL 17, sign-in (managed Better Auth) and a PostgREST-compatible Data API | 

Everything is driven by one CLI that ships inside AWS CLI v2:  

`aws amplifygen3` . There is no separate npm tool to install and no CloudFormation stack to own.

## 2. Start locally: a full backend in Docker

Scaffold any web app, then turn it into a full-stack Gen 3 project:

`local init --type fullstack`  writes  `amplify.jsonc` , creates  `migrations/`  and  `.secrets/` , installs the client SDK, and adds the right entries to  `.gitignore` .

```
// amplify.jsonc — the whole app config{  "name": "link-vault",  "env": { "production": {}, "preview": {} },  "deploy": {    "install": "npm ci",    "build": "npx @aws-amplifygen3/adapter-nodejs build --entrypoint server/index.mjs --route /api --static-dir dist",    "output_directory": ".amplify"  },  "backend": {    "auth": { "appName": "Link Vault", "emailAndPassword": { "enabled": true } }  }}
```

The data model is a plain SQL migration. Access rules are Postgres row-level security, in the same file:

```
-- migrations/20261202171651_create_links.sqlcreate table public.links (  id         bigint generated always as identity primary key,  owner_id   text not null default auth.uid() references auth."user"(id) on delete cascade,  url        text not null check (url ~* '^https?://'),  title      text,  summary    text,  created_at timestamptz not null default now());create index links_owner_id_idx on public.links (owner_id);alter table public.links enable row level security;﻿create policy "links_select_own" on public.links for select  to authenticated using ((select auth.uid()) = owner_id);-- … same for insert / update / delete …grant select, insert, update, delete on public.links to authenticated;
```

Then one command starts everything:

```
aws amplifygen3 local run
```

It pulls a signed local backend image, starts PostgreSQL 17, the auth service and an API gateway in one container, starts Mailpit to catch sign-up emails, applies the migrations, and launches the Vite dev server with  

`AMPLIFY_BACKEND_URL`  and  `AMPLIFY_BACKEND_PUBLISHABLE_KEY`  already set. The backend also trusts the dev server's origin automatically, so there's no CORS setup.
There is a local console too, on port 54323:

### The browser code

One client handles both sign-in and data. After sign-in it sends the user's JWT with every query, so the RLS policies apply to that user:

``` js
// src/backend.tsimport { createClient } from '@aws-amplifygen3/backend-client-js'﻿let client: ReturnType<typeof createClient<any>> | undefinedexport function backend() {  if (!client) client = createClient(import.meta.env.AMPLIFY_BACKEND_URL, import.meta.env.AMPLIFY_BACKEND_PUBLISHABLE_KEY)  return client}﻿// usageawait backend().auth.signUp.email({ email, password, name })await backend().from('links').insert({ url }).select().single()await backend().from('links').select('id, url, title, summary').order('created_at', { ascending: false })
```

The two variables reach the browser through Vite's  

`define`  in  `vite.config.ts` . The publishable key is safe in the browser: it only grants the  `anon`  role, and RLS still applies.
|  |  | 
|---|---|
|  |  | 
|  |  | 

### Proving RLS works

A small script signs up two throwaway users, inserts a row as the first, and reads as the second and as an anonymous visitor:

`own: 1, other: 0, anon: 0` : the owner sees their row, nobody else does. Same result locally and in the cloud.

## 3. AI summaries with no API keys

The API is a regular Hono app. Amplify's Node.js adapter serves it under  

`/api/*`  and everything else from  `dist/` . The interesting part is the identity: the server acts **as the signed-in user** by forwarding their JWT, so RLS decides whether the link is theirs. There's no admin key on the server.

``` js
// server/app.mjs (simplified excerpt)app.post('/api/summarize', async (c) => {  const jwt = c.req.header('authorization')?.replace(/^Bearer\s+/i, '')  if (!jwt) return c.json({ error: 'Sign in first.' }, 401)  const { id } = await c.req.json()﻿  // Act as the signed-in user: row level security decides whether this link is theirs.  const db = createClient(process.env.AMPLIFY_BACKEND_URL, process.env.AMPLIFY_BACKEND_PUBLISHABLE_KEY, {    webTokenProvider: () => jwt,  })  const { data: link } = await db.from('links').select('id, url').eq('id', id).maybeSingle()  if (!link) return c.json({ error: 'Link not found.' }, 404)﻿  const page = await fetchPageText(link.url)          // http(s) only, private IPs refused  const result = streamText({    model: bedrock(process.env.BEDROCK_MODEL_ID),     // injected by the integration    instructions: 'Summarize web pages for a reading list in 2-3 sentences.',    prompt: page.text,    onFinish: ({ text }) => db.from('links').update({ summary: text }).eq('id', link.id),  })  return result.toTextStreamResponse()})
```

Bedrock access is an 

**integration**, connected with one command and pinned to one model:

Amplify injects  

`BEDROCK_MODEL_ID`  and  `BEDROCK_REGION` , and adds a least-privilege statement for that one model to each deployment's session policy. The app's server code can call Nova Lite and the backend, and nothing else. There are no access keys in code, variables or  `.env`  files.
I used**Amazon Nova Lite** ( `us.amazon.nova-lite-v1:0` ). Anthropic models on Bedrock need an AWS Marketplace subscription on first use, which the app's scoped role doesn't get. The AWS credits I used also didn't cover third-party models.

## 4. Deploy: 43 seconds, backend first

```
aws amplifygen3 create --name link-vault   # app + IAM roles + preview/productionaws amplifygen3 deploy                     # to preview
```

What happens in those 43 seconds:

1. **Backend first.** Creates the database branch (first deploy only), applies pending migrations (each file in its own transaction), and sends the`backend.auth`  settings.

1. **Build in the cloud.**`npm ci`  and the adapter build run on a Node.js 24 image. Nothing builds on your laptop, and`node_modules`  is never uploaded.

1. **Immutable deployment** with its own permanent URL. Environment variables and the session policy are baked into it.

1. **Promote** : the environment URL now serves it. The CLI then checks that both the backend`/health`  and the site answer 200.

Everything you'd want to know about a deployment is one command away, including what was injected:

And the deployed app, same code, now on  

`*.amplify.app` :
|  |  | 
|---|---|
|  |  | 

## 5. Ship a schema change, then roll back

v2 adds a "Mark read" button, backed by a second migration:

```
-- migrations/20261202172928_add_read_at_to_links.sqlalter table public.links add column read_at timestamptz;
```

Rolling back takes seconds, because nothing is rebuilt. It only moves the environment's pointer to an earlier deployment:

**The catch:** the database is

*not*rolled back. v1's code was serving again, but the

`read_at`  column stayed. Migrations only move forward; to undo a schema change you write a new migration. Write migrations that the previous version of your code can live with (adding a nullable column is fine; dropping one isn't).
On  

`production`  (and custom environments) a paid plan can replace the instant switch with a canary or linear rollout ( `aws amplifygen3 env edit --rollout canary-10pct-5m --env production` ). On the free Basic plan you can still separate *deploying*from*releasing*. Section 6 shows how.

## 6. v3: AI tags, deployed dark and released by hand

v3 asks the model for up to three topic tags after each summary and adds a tag filter. It needs one more migration:

```
-- migrations/20261202180558_add_tags_to_links.sqlalter table public.links add column tags text[] not null default '{}';create index links_tags_idx on public.links using gin (tags);
```

On the server, the tags are a second, non-streaming call to the same Nova model, run after the summary stream finishes:

```
async function suggestTags(title, summary) {  const { text } = await generateText({    model: bedrock(modelId()),    instructions: 'Return 1 to 3 short lowercase topic tags for the page, comma-separated, nothing else.',    prompt: `Title: ${title ?? ''}\nSummary: ${summary}`,    maxOutputTokens: 30,  })  return [...new Set(text.toLowerCase().split(/[,\n]/).map((t) => t.trim()).filter(Boolean))].slice(0, 3)}
```

No new permissions or settings were needed. The  

`ai`  integration already allows this model, so the deployment's session policy covers the second call too.
### Deploy without releasing

By default, each successful deploy to  

`preview`  becomes the active deployment. Turn that off, and a deploy only creates a new immutable deployment with its own URL:

The migration ran (the database is shared by the environment, so it must be safe for v2's code as well, and an added column with a default is). But  

`preview-wctl--link-vault.amplify.app`  kept serving v2, while v3 was reachable only at  `https://<deployment-id>--link-vault.amplify.app` . That gives you time to test v3 against real data before anyone sees it.

When it's good, promote it. Like a rollback, this only moves a pointer, so it takes seconds and rebuilds nothing:

That testing step paid off. My first v3 deployments built and passed every health check, yet their Bedrock calls returned  

`403 Forbidden` , while v1 and v2, running at the same time on the same environment role, still summarized fine. The user-facing error ("The AI model did not answer") said nothing useful. What found it was  `aws amplifygen3 logs get --env preview --deployment-id <id>`  together with logging the provider error's  `statusCode`  and  `responseBody` . A deployment created after I turned auto-promote back on worked. I can't say whether that setting was the cause. The lessons that hold either way:
- **Log the provider's error body** , not just`error.message`  . "Forbidden" alone tells you nothing.

- **A green deploy is not a working feature.** Check the paths that call AWS services before you promote.

## 7. Secure by default — what you get without asking

- **HTTPS everywhere** , with certificates Amplify manages, for the site and the backend host.

- **Managed firewall** ("Secured by default"): AWS WAF managed rule groups on every app, in front of the frontend*and* the backend.

- **Least privilege for server code** : in the default`scoped`  mode, each deployment's session policy allows only its integrations (here: one Bedrock model) and its own backend.

- **RLS on by default** : a new table without policies returns`[]`  to everyone.

- **Database logs** to CloudWatch, on by default. Access logs and firewall logs are opt-in (`logs-config edit`  ).

- **Access control** (paid plans) can put an environment behind IAM Identity Center or any OIDC provider, so a`preview`  is visible only to your team. This is separate from app sign-in, which every visitor still goes through. According to the docs, scope`non-active`  is the neat one for production: the live site stays public, while the URLs of old and not-yet-promoted deployments need a team sign-in. I couldn't try it on the Basic plan.

## 8. Gen 2 vs Gen 3

|  | Gen 2 | Gen 3 | 
|---|---|---|
| You write | TypeScript  `define*`  resources, CDK | `amplify.jsonc`  + SQL migrations | 
| Data | DynamoDB via AppSync GraphQL | PostgreSQL 17 via REST (PostgREST-compatible), or any Postgres client | 
| Access rules | `allow.owner()`  in the schema | Postgres row-level security | 
| Auth | Cognito | Managed Better Auth (email, social, or your Cognito pool) | 
| Local dev | `ampx sandbox`  : a real stack in AWS per developer | Docker stack on your laptop, offline, with Mailpit and a console | 
| Deploys | Amplify Hosting builds | Immutable deployments with their own URLs, instant promote/rollback, canary/linear rollouts (paid plans) | 
| Per-branch backends | Yes (stacks) | Yes (database branches: schema copied, data not) | 
| AWS services | Anything via CDK | Integrations: Bedrock, S3, Aurora DSQL, custom | 
| Security defaults | Configure yourself | Managed WAF, scoped session policy, RLS on | 
| AI agents | — | Agent skill,  `--output json`  , risky steps need your yes | 

### Where Gen 2 is still the right choice

Gen 3 has no storage commands of its own (you connect an existing S3 bucket), no cron jobs or standalone functions, no realtime subscriptions or WebSockets, no mobile SDKs, and no CDK escape hatch. Every app also needs a web frontend. If your app is mobile-first, depends on AppSync subscriptions, or you've built a lot on CDK, stay on Gen 2. There's no automatic migration: the CLIs and data models are different.

## 9. Things I ran into

- **Regions.** Gen 3 isn't offered in eu-central-1 (Frankfurt) yet. Probing on 2 Dec 2026 found it in us-east-1/2, us-west-2, eu-west-1/2, eu-north-1 and ap-northeast-1. If your organization allow-lists regions with an SCP,`amplifygen3:*`  is blocked like any other service.

- **Free plan: two environments.**`env create --name staging`  fails with "maximum number of environments" on the Basic plan.

- **What the free Basic plan leaves out.** Gradual rollouts ("does not support gradual deployment") and access control ("does not support access control") both need a paid plan. Amplify accepted the identity provider config, then failed at`access-control enable`  . Even on a paid plan, rollouts work only on`production`  and custom environments, not`preview`  .

- **IAM Identity Center must be in the app's Region.** My organization's instance is in eu-central-1, so`access-control edit --type team`  for an app in us-east-1 failed with "Could not resolve the identity store". OIDC (Cognito, Okta, Entra ID and others) has no such limit.

- **SSO and local Bedrock calls.** The JS SDK couldn't refresh an SSO token that the CLI could.`eval "$(aws configure export-credentials --profile <p> --format env)"`  before`local run`  fixed it.

- **Cold starts.** The backend sleeps after 5 minutes idle and wakes on the next request. On the free plan, a backend unused for 7 days is paused until`aws amplifygen3 backend resume`  .

- **A web rollback doesn't roll back the database** (see section 5).

- **Debug from the deployment's own logs.**`logs get --deployment-id <id>`  reads one deployment's logs, which is how I found v3's Bedrock 403 (section 6).

## 10. Try it

```
npm create vite@latest my-app -- --template react-ts && cd my-app && npm installaws amplifygen3 local init --type fullstackaws amplifygen3 local migration create --description "create notes"   # write your table + RLSaws amplifygen3 local run                                               # Dockeraws amplifygen3 deploy                                                  # preview URL in ~1 minuteaws amplifygen3 app delete --app my-app --yes                           # clean up
```

If you use an AI coding agent:  

`aws agent-toolkit add-skill --skill-name aws-amplify`  teaches it the Gen 3 commands. Most of this app was built by an agent that way.
**Enjoyed reading this content? Let the author know!**

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations
