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:

  1. Your code is pushed to a Git repository (GitHub, GitLab, Bitbucket, or AWS CodeCommit)
  2. Your app works correctly in the sandbox environment
  3. You have an AWS account with appropriate permissions

Step 1: Connect Your Repository

  1. Go to the AWS Amplify Console
  2. Click Create new app
  3. Select Host web app
  4. Choose your Git provider (GitHub, GitLab, Bitbucket, or CodeCommit)
  5. Authorize Amplify to access your repositories
  6. 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/**/*
💡
Nuxt SSR

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:

  1. Go to App settingsEnvironment variables
  2. Click Manage variables
  3. Add your variables (e.g., NUXT_PUBLIC_API_URL)
⚠️
Secrets vs Environment Variables

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:

  1. Clone your repository
  2. Install dependencies
  3. Build your frontend
  4. Deploy your backend (auth, data, functions)
  5. 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

  1. Go to App settingsDomain management
  2. Click Add domain
  3. Enter your domain name (e.g., myapp.com)
  4. Configure subdomains:
    • myapp.com → main branch
    • staging.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:

  1. Go to your app in the Amplify Console
  2. Click on a deployment
  3. View logs for each build phase (preBuild, build, deploy)

Deployment Notifications

Set up notifications for deployment events:

  1. Go to App settingsNotifications
  2. Add email addresses or Slack webhooks
  3. Choose which events to be notified about

Rollbacks

If a deployment causes issues, roll back instantly:

  1. Go to your app in the Amplify Console
  2. Find the last working deployment
  3. Click Redeploy this version
Zero Downtime

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