Amplify Workflow
AWS LabsOfficialPublished by AWS Labs
- Skill
- Tool integration
- Software development
- Apache-2.0
- Low risk
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
This skill provides a structured workflow for developing full-stack applications with AWS Amplify Gen2. It covers the entire lifecycle, from scaffolding and backend resource definition (Auth, Data, Storage, Functions, AI) to frontend integration across multiple frameworks and final deployment. It emphasizes a code-first TypeScript approach, ensuring developers use validated, version-specific patterns to avoid common configuration errors.
What it does
- Defines backend resources using TypeScript code-first patterns.
- Integrates backend services with web and mobile frontends.
- Configures authentication, data models, storage, and AI features via Bedrock.
- Provides deployment workflows for full-stack applications.
- Ensures correct usage of Amplify Gen2 APIs like defineBackend and defineData.
- Offers security best practices for cloud-native application development.
When to use it
- When starting a new full-stack project using AWS Amplify Gen2.
- When adding or modifying backend features like Auth, Data, or Storage.
- When connecting a frontend framework to an existing Amplify Gen2 backend.
- When deploying an Amplify Gen2 application to AWS.
- When troubleshooting configuration issues in an amplify/ directory.
Advantages
- Prevents common configuration mistakes through validated patterns.
- Supports a wide range of web and mobile frameworks.
- Streamlines backend-to-frontend connectivity.
- Provides clear, modular documentation for specific backend features.
- Enforces security best practices by default.
Usage examples
- “How do I set up a new Amplify Gen2 project with React?”
- The agent will guide you through the scaffolding process, including initializing the project, setting up the amplify/ directory, and configuring the initial backend.
- “Add a new data model with owner-based authorization to my existing Gen2 backend.”
- The agent will provide the TypeScript code for defining the data model in amplify/data/resource.ts using the appropriate authorization rules.
- “How do I integrate my Flutter app with an existing Amplify Gen2 backend?”
- The agent will explain how to use the amplify_outputs.json file and the Amplify Flutter library to connect your mobile frontend to the backend.
- “How can I add an AI conversation route to my data schema?”
- The agent will show you how to define an a.conversation() route in your schema, including model selection and system prompt configuration.
Install
Download the skill as a ZIP:
https://autogineer.com/agent-skills/awslabs/amplify-workflow/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip amplify-workflow.zip -d .agents/skills
Documentation by AWS Labs
AWS Amplify Gen2
Build and deploy full-stack applications using AWS Amplify Gen2's TypeScript code-first approach. This skill covers backend resource creation, frontend integration across 8 frameworks, and deployment workflows.
Prerequisites
Node.js ^18.19.0 || ^20.6.0 || >=22 and npm
AWS credentials configured (
aws sts get-caller-identitysucceeds)For sandbox:
npx ampx --versionreturns a valid versionFor mobile: Platform-specific tooling (Xcode, Android Studio, Flutter SDK)
Defaults & Assumptions
When the user does not specify a framework:
Web: You SHOULD default to React (Vite) and explain the choice.
Mobile: You MUST ask which platform the user wants (Flutter, Swift, Android, or React Native). There is no universal mobile default.
Neither specified: If the user says "build an app" without clarifying web vs. mobile, you MUST ask before proceeding.
Backend only: If only backend changes are requested and no frontend framework is mentioned, skip the frontend integration step entirely.
When the user does not specify tooling or strategy:
Package manager: You SHOULD default to npm unless the user specifies yarn or pnpm.
Language: You SHOULD default to TypeScript. Gen2 backends are TypeScript-only; frontends SHOULD follow the project's existing language.
Next.js: You SHOULD default to App Router unless the user specifies Pages Router.
React Native: Ask the user whether they use Expo or bare React Native CLI.
Auth: You MUST ask which login method the user wants (email/password, social login, SAML, passwordless, etc.). Do not assume a default.
Data authorization: default to
publicApiKey(allow.publicApiKey()) — this is the starter template default. When auth is added, switch to owner-based (allow.owner()) withdefaultAuthorizationMode: 'userPool'.
Quick Start — Route to the Right Reference
Step 0: Read Core Reference (ALWAYS)
You MUST read the core reference for your target platform before
reading any other reference file. These contain Gen2 detection,
Amplify.configure() placement per framework, sandbox commands, required
packages, and directory structure rules — patterns needed for all tasks,
not just new projects.
Web (React, Next.js, Vue, Angular, React Native): You MUST read core-web.md
Mobile (Flutter, Swift, Android): You MUST read core-mobile.md
Backend only (no frontend work): Skip to Step 1.
Step 1: Identify the Task Type
| Task | Go To |
|---|---|
| Create a new project | → scaffolding.md, then Step 2 and/or Step 3 |
| Add or modify a backend feature | → Step 2 (Backend Features) |
| Connect frontend to existing backend | → Step 3 (Frontend Integration) |
| Deploy the application | → deployment.md |
Step 2: Backend Features
You MUST read the corresponding reference for each backend feature:
| Feature | Reference | When to Use |
|---|---|---|
| Authentication | auth-backend.md | Email/password, social login, MFA, SAML/OIDC |
| Data Models | data-backend.md | GraphQL schema, DynamoDB, relationships, auth rules |
| File Storage | storage-backend.md | S3 uploads/downloads, access rules |
| Functions & API | functions-and-api.md | Lambda, custom resolvers, REST/HTTP APIs, calling from client |
| AI Features | ai.md | Conversation, generation, AI tools via Bedrock (backend config + React/Next.js frontend) |
| Geo, PubSub, CDK | advanced-features.md | Backend-only: custom CDK stacks, overrides, custom outputs. Backend + frontend: Geo, PubSub, Face Liveness |
Each backend feature file is self-contained. Load only what you need.
Routing note: These files apply for both adding and modifying features. Route to the same file whether the user says "add auth" or "change auth config" — each reference covers the full define surface.
Step 3: Frontend Integration
After configuring backend resources, connect the frontend. Choose by platform and feature:
Web (React, Next.js, Vue, Angular, React Native):
| Feature | Reference |
|---|---|
| Auth UI & flows | auth-web.md |
| Data CRUD & subscriptions | data-web.md |
| Storage upload/download | storage-web.md |
Mobile (Flutter, Swift, Android):
| Feature | Reference |
|---|---|
| Auth UI & flows | auth-mobile.md |
| Data CRUD & subscriptions | data-mobile.md |
| Storage upload/download | storage-mobile.md |
Note: AI and Functions frontend patterns are included in ai.md and functions-and-api.md respectively — they are not split into separate web/mobile files.
Core Concepts
Amplify Gen2 Architecture
Code-first: All backend resources defined in TypeScript under
amplify/Main config:
amplify/backend.tsimports and combines all resources viadefineBackend()Resource files:
amplify/auth/resource.ts,amplify/data/resource.ts,amplify/storage/resource.ts,amplify/functions/<name>/resource.tsGenerated output:
amplify_outputs.json— consumed by frontendAmplify.configure(). Gitignored — generated bynpx ampx sandbox(local dev) ornpx ampx pipeline-deploy(CI/CD), never committed.
Directory Structure
project-root/
├── amplify/
│ ├── backend.ts # defineBackend({ auth, data, ... })
│ ├── auth/resource.ts # defineAuth({ ... })
│ ├── data/resource.ts # defineData({ schema })
│ ├── storage/resource.ts # defineStorage({ ... })
│ └── functions/
│ └── my-func/
│ ├── resource.ts # defineFunction({ ... })
│ └── handler.ts # export const handler = ...
├── src/ # Frontend code
├── amplify_outputs.json # Generated — DO NOT edit or commit (gitignored)
└── package.jsonKey APIs
| Package | Purpose |
|---|---|
@aws-amplify/backend | defineAuth, defineData, defineStorage, defineFunction, defineBackend |
aws-amplify | Frontend: Amplify.configure(), generateClient(), auth/data/storage APIs |
@aws-amplify/ui-react | Pre-built UI: <Authenticator>, <StorageBrowser> |
@aws-amplify/ui-react-ai | AI UI: <AIConversation>, useAIConversation |
Documentation & Resource Verification
When you need AWS documentation (advanced CDK constructs, service limits, provider-specific auth config):
If AWS documentation tools are available (e.g., via AWS MCP), you SHOULD use them to search and retrieve relevant documentation pages.
If AWS documentation tools are unavailable, you MUST fall back to web search or the
awsCLI for resource verification.
Why conditional: Amplify Gen2 is code-first — the primary workflow is editing TypeScript files and running
npx ampxcommands. AWS MCP tools are useful for post-deployment verification but are not required.
Security Considerations
Use
secret()for all credentials and API keys — never hardcode or use plain environment variables for sensitive valuesReview
allow.guest()exposure carefully — guest access is enabled by default and grants unauthenticated users access to IAM-authorized resourcesScope IAM policies to specific resource ARNs — avoid
resources: ['*']in productionNever log secrets or include them in error messages
Enable CloudTrail and CloudWatch alarms for monitoring Amplify-deployed resources; enable access logging on S3, AppSync, and API Gateway
Configure security headers for web apps — set CSP, HSTS, X-Frame-Options, and X-Content-Type-Options via
customHeadersinamplify.ymlAttach AWS WAF to public-facing AppSync APIs and API Gateway endpoints for defense in depth
Enable throttling and rate limiting on API Gateway and AppSync APIs to prevent abuse
Use IAM roles with ephemeral credentials for CI/CD pipelines and Lambda execution roles — never long-lived access keys
Encrypt CloudWatch Logs groups with KMS (aws:kms) when they may contain PII, tokens, or secrets; enable log retention policies
Enable AppSync schema validation and API Gateway request validators to reject malformed input at the edge
Use ACM-managed TLS certificates for custom domains on Amplify Hosting — configure via
customDomainin deployment config
Links
All documentation links use
reactas the default platform slug. Replace/react/in any URL with your target framework:
| Framework | Slug |
|---|---|
| React | react |
| Next.js | nextjs |
| Vue | vue |
| Angular | angular |
| React Native | react-native |
| Flutter | flutter |
| Swift | swift |
| Android | android |
Files
- ATTRIBUTION.mdAdded by AutoGineer915 B
- LICENSELicence file added by AutoGineer9.9 KiB
- NOTICELicence file added by AutoGineer89 B
- SKILL.md12.7 KiB
- references/advanced-features.md8.4 KiB
- references/ai.md7.5 KiB
- references/auth-backend.md7.4 KiB
- references/auth-mobile.md14.7 KiB
- references/auth-web.md7.3 KiB
- references/core-mobile.md5.0 KiB
- references/core-web.md5.0 KiB
- references/data-backend.md10.1 KiB
- references/data-mobile.md5.0 KiB
- references/data-web.md4.1 KiB
- references/deployment.md9.2 KiB
- references/functions-and-api.md8.1 KiB
- references/scaffolding.md6.0 KiB
- references/storage-backend.md4.4 KiB
- references/storage-mobile.md9.0 KiB
- references/storage-web.md4.4 KiB
references/deployment.md
Deployment
Prerequisites
Before deploying, verify:
npx ampx --versionreturns a valid versionaws sts get-caller-identitysucceedsNode.js ≥ 18.x installed
.gitignoreincludesnode_modules/,.env*,amplify_outputs.json,.amplify/
amplify_outputs.json is gitignored — it is generated at build
time, NOT committed to source control:
Local dev:
npx ampx sandboxgenerates it automaticallyCI/CD:
npx ampx pipeline-deploygenerates it during the build phaseOther frontend apps in a monorepo: Use
npx ampx generate outputs --app-id <backend-app-id>to generate itProject is a Gen2 project — see core-web.md or core-mobile.md for detection logic (Gen2 uses
amplify/backend.ts+defineBackend())
Sandbox Deployment
Deploy a personal development environment:
AWS_REGION=us-east-1 npx ampx sandbox --onceYou MUST use the --once flag in agent and CI environments — without
it, the command starts a file watcher that never exits. If prompted to
bootstrap, run npx ampx sandbox --once again after bootstrapping
completes.
Verify amplify_outputs.json was generated in the project root.
CI/CD Setup
Create the Amplify App
REPO="github.com/<user>/<repo>"
APP_ID=$(aws amplify create-app \
--name my-app \
--repository "$REPO" \
--access-token "$(gh auth token)" \
--query 'app.appId' --output text)You MUST use github.com/user/repo format — not https://.
IAM Service Role
Create a dedicated role for Amplify backend deployments:
ROLE_NAME="AmplifyBackendRole-${APP_ID}"
# 1. Create the role with Amplify trust policy
aws iam create-role --role-name "$ROLE_NAME" --assume-role-policy-document '{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Principal": {"Service": "amplify.amazonaws.com"},
"Action": "sts:AssumeRole"
}]
}'
# 2. Attach the backend deploy policy
aws iam attach-role-policy --role-name "$ROLE_NAME" \
--policy-arn arn:aws:iam::aws:policy/service-role/AmplifyBackendDeployFullAccess
# 3. Attach the role to the app
ROLE_ARN=$(aws iam get-role --role-name "$ROLE_NAME" --query 'Role.Arn' --output text)
aws amplify update-app --app-id "$APP_ID" --iam-service-role-arn "$ROLE_ARN"All three steps are required — missing the role causes
AccessDeniedException during deployment.
Create Branch
aws amplify create-branch --app-id "$APP_ID" --branch-name mainamplify.yml
Create amplify.yml in the project root. Set baseDirectory per
framework:
| Framework | baseDirectory |
|---|---|
| Vite (React/Vue) | dist |
| CRA | build |
| Next.js (export) | out |
| Next.js (SSR) | .next |
| Angular | dist/<project-name>/browser |
Wrong baseDirectory = blank page in production (silent failure).
Always match the framework table above.
version: 1
backend:
phases:
build:
commands:
- npm ci --cache .npm --prefer-offline
- npx ampx pipeline-deploy --branch $AWS_BRANCH --app-id $AWS_APP_ID
frontend:
phases:
build:
commands:
- npm run build
artifacts:
baseDirectory: dist # Change per framework (see table above)
files:
- '**/*'
cache:
paths:
- .npm/**/*
- node_modules/**/*Monorepo Configuration
For monorepos, set appRoot in amplify.yml to the subdirectory
containing the Amplify app:
appRoot: packages/webWARNING: appRoot must have NO leading slash.
appRoot: packages/web (correct) vs appRoot: /packages/web (wrong)
Monorepo rules:
Only ONE app runs
npx ampx pipeline-deploy; other apps usenpx ampx generate outputs --app-id <backend-app-id>to get theiramplify_outputs.json.Run
npm ciat the repo root, NOT insideappRoot.
Trigger Deployment
aws amplify start-job --app-id "$APP_ID" --branch-name main --job-type RELEASESecrets Management
Sandbox: Set secrets via CLI:
npx ampx sandbox secret set MY_API_KEYSecurity: Avoid passing secret values as CLI arguments or via
echo— these appear in shell history and/proc. Instead, usenpx ampx sandbox secret set MY_SECRETwhich prompts for input interactively, or pipe from a secure source:aws ssm get-parameter --name /path/to/secret --with-decryption --query Parameter.Value --output text | npx ampx sandbox secret set MY_SECRET --from-stdin
This stores the secret for your personal sandbox environment.
Branch environments (production): Set secrets via the ampx CLI:
npx ampx secret set MY_API_KEY --branch main --app-id $APP_IDOr via the Amplify console under App settings → Environment variables, or via the AWS CLI:
aws amplify update-app --app-id "$APP_ID" \
--environment-variables MY_API_KEY=<value>Important:
--environment-variablesstores values as plain text. For sensitive values (API keys, tokens), usenpx ampx sandbox secret set(sandbox) ornpx ampx secret set --branch(production) which stores in SSM SecureString.Note: Under the hood, Amplify Gen2
secret()references are backed by AWS Systems Manager Parameter Store (SecureString parameters). Review access policies on the/amplify/parameter path in your account to ensure only authorized roles can read production secrets.
Reference secrets in functions using secret() — see
functions-and-api.md for the pattern.
Multi-Environment
Use branch-based environments — each Git branch deploys independently:
# Create a staging branch
git checkout -b staging
git push origin staging
aws amplify create-branch --app-id "$APP_ID" --branch-name staging
aws amplify start-job --app-id "$APP_ID" --branch-name staging --job-type RELEASEEach branch gets isolated backend resources (Cognito pool, AppSync API, DynamoDB tables). Set branch-specific secrets separately.
Custom Domains
Associate a custom domain with the Amplify app:
aws amplify create-domain-association \
--app-id "$APP_ID" \
--domain-name example.com \
--sub-domain-settings '[
{"prefix": "", "branchName": "main"},
{"prefix": "staging", "branchName": "staging"}
]'Amplify auto-provisions an SSL certificate. You MUST add the provided CNAME records to your DNS for verification. Check status:
aws amplify get-domain-association --app-id "$APP_ID" --domain-name example.comAmplify Hosting
Amplify Hosting provides framework-aware builds with SSR support for
Next.js. The build pipeline auto-detects the framework from
package.json. For SSR apps, Amplify deploys a Lambda@Edge or
CloudFront function — no manual CloudFront configuration needed.
Production URL format: https://<branch>.<app-id>.amplifyapp.com
Deployment Validation
After deployment, check job status with aws amplify list-jobs --app-id "$APP_ID" --branch-name main --query 'jobSummaries[0].status' and verify amplify_outputs.json endpoints match expected values.
Post-Deployment
Rollback: Revert via Git and redeploy:
git revert HEAD --no-edit
git push origin main
# Amplify auto-triggers a new build from the pushFor CI/CD, manually trigger: aws amplify start-job --app-id "$APP_ID" --branch-name main --job-type RELEASE.
Pitfalls
Missing
--onceflag: Without--once, sandbox starts a file watcher that never exits — agent sessions and CI pipelines hang indefinitely. MUST usenpx ampx sandbox --oncein any non-interactive environment.Repo format: You MUST use
github.com/user/repo— thehttps://prefix causescreate-appto fail silently.Missing IAM service role: Skipping role creation causes
AccessDeniedExceptionon every backend deployment.Wrong
baseDirectory: Usingbuildfor a Vite app (which outputs todist) causes a blank page in production — match the framework table above. This is a silent failure with no error message.Monorepo
appRootleading slash:appRoot: packages/webvsappRoot: /packages/web— leading slash breaks path resolution.amplify_outputs.jsonnot committed: This file is gitignored and generated at build time. CI usespipeline-deployto generate it; local dev usessandbox.Not bootstrapping: First sandbox run in a new account/region requires CDK bootstrapping — follow prompts or run
npx ampx sandbox --onceagain after bootstrap.
Links
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Needs an API key, Needs Node.js
Security
What our scanner noticed· Low risk
- Instructions that use the network
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Published by
- AWS Labs
- Publisher
- AWS Labs (Official)
- Source
- awslabs/agent-plugins · plugins/aws-amplify/skills/amplify-workflow · commit fbefb37
- Licence
- Apache License 2.0 (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- NOTICE (added by AutoGineer from NOTICE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
- Also distributed in
- cline/skills
AutoGineer is not affiliated with or endorsed by AWS Labs or AWS Labs.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download amplify-workflow.zip