Production Deployment
Learn how to deploy your Amplify application to production using AWS Amplify Hosting with continuous deployment from your Git repository.
Deployment Overview
Production deployment with Amplify Gen 2 is fully managed through AWS Amplify Hosting. Connect your Git repository, and Amplify automatically builds and deploys your app on every push.
🚀 What Amplify Hosting Provides
- Global CDN for fast content delivery
- Automatic HTTPS/SSL certificates
- Custom domain support
- Branch-based deployments (staging, production)
- Instant rollbacks
- Server-side rendering (SSR) support for Nuxt
Prerequisites
Before deploying to production, ensure:
- Your code is pushed to a Git repository (GitHub, GitLab, Bitbucket, or AWS CodeCommit)
- Your app works correctly in the sandbox environment
- You have an AWS account with appropriate permissions
Step 1: Connect Your Repository
- Go to the AWS Amplify Console
- Click Create new app
- Select Host web app
- Choose your Git provider (GitHub, GitLab, Bitbucket, or CodeCommit)
- Authorize Amplify to access your repositories
- Select your repository and branch (usually
main)
Step 2: Configure Build Settings
Amplify auto-detects your framework and suggests build settings. For a Nuxt 3 application, verify these settings:
version: 1
frontend:
phases:
preBuild:
commands:
- npm ci
build:
commands:
- npm run build
artifacts:
baseDirectory: .amplify-hosting
files:
- '**/*'
cache:
paths:
- node_modules/**/*
- .nuxt/**/*
For server-side rendering, Amplify deploys your Nuxt app to AWS Lambda.
The .amplify-hosting directory is automatically configured
by the Amplify adapter.
Step 3: Configure Environment Variables
In the Amplify Console, add any environment variables your app needs:
- Go to App settings → Environment variables
- Click Manage variables
- Add your variables (e.g.,
NUXT_PUBLIC_API_URL)
For sensitive values (API keys, tokens), use Amplify's secret management:
npx ampx sandbox secret set SECRET_NAME. These are encrypted
and not visible in logs.
Step 4: Deploy
Click Save and deploy. Amplify will:
- Clone your repository
- Install dependencies
- Build your frontend
- Deploy your backend (auth, data, functions)
- Deploy your frontend to the CDN
First deployment typically takes 5-10 minutes. Subsequent deployments are faster due to caching.
Custom Domains
Adding a Custom Domain
- Go to App settings → Domain management
- Click Add domain
- Enter your domain name (e.g.,
myapp.com) - Configure subdomains:
myapp.com→ main branchstaging.myapp.com→ staging branch
DNS Configuration
Amplify provides DNS records to add to your domain registrar:
# CNAME record for subdomains
www.myapp.com → xxxxxxxxxx.cloudfront.net
# For apex domain (myapp.com)
# Use ANAME/ALIAS record if supported, or
# Use Amplify's recommended DNS settings
Branch Deployments
Create separate environments for different branches:
| Branch | Environment | URL |
|---|---|---|
main |
Production | myapp.com |
staging |
Staging | staging.myapp.com |
develop |
Development | dev.myapp.com |
Each branch gets its own backend resources (separate DynamoDB tables, Cognito user pools, etc.), ensuring complete isolation.
Monitoring Deployments
Build Logs
View build logs in the Amplify Console to troubleshoot issues:
- Go to your app in the Amplify Console
- Click on a deployment
- View logs for each build phase (preBuild, build, deploy)
Deployment Notifications
Set up notifications for deployment events:
- Go to App settings → Notifications
- Add email addresses or Slack webhooks
- Choose which events to be notified about
Rollbacks
If a deployment causes issues, roll back instantly:
- Go to your app in the Amplify Console
- Find the last working deployment
- Click Redeploy this version
Rollbacks are instant because Amplify keeps previous versions cached. Your users won't experience any downtime during rollbacks.
Production Checklist
Before going live, verify:
- ☐ All environment variables are set
- ☐ Secrets are configured (not in code)
- ☐ Custom domain is configured with SSL
- ☐ Error pages are configured
- ☐ Authentication flows work correctly
- ☐ Data operations work correctly
- ☐ Monitoring and logging are set up
- ☐ Backup strategy is in place
Summary
- Production deployment uses AWS Amplify Hosting
- Connect your Git repository for automatic deployments
- Each branch can have its own environment
- Custom domains with automatic SSL
- Instant rollbacks for quick recovery
- Build logs and notifications for monitoring