Tutorials Search / Shipping & infrastructure / Deploy with AWS Amplify Hosting
📝 Written ● Intermediate Updated 2026-05-13

Deploy with AWS Amplify Hosting

Amplify Hosting is AWS's "connect a git repo, get a deployed site" service. It's a wrapper around S3, CloudFront, ACM, and CodeBuild — same primitives as the manual setup, packaged into a single dashboard. The result is closer to Vercel than to raw S3 + CloudFront, with the AWS bill and the AWS integrations that come with that.

Two things share the "Amplify" name and they're frequently confused. Amplify Hosting is what this tutorial covers: a git-driven web hosting service that builds your site, deploys it to a CloudFront-backed CDN, gives you a free TLS cert, and re-deploys on every push. Amplify Studio (and the Amplify libraries) are a different product — a full backend platform with generated DataStore APIs, auth flows, and React components. They're related (Amplify Hosting can be paired with Amplify Studio), but Amplify Hosting alone works fine with any backend or no backend. We'll stay on the Hosting side.

The honest pitch: Amplify Hosting is what AWS built when it noticed Vercel and Netlify existed. It does the same things — git connection, branch deploys, environment variables, preview URLs, custom domains. The UX is meaningfully behind Vercel's; the build logs are dense; the CLI exists but most flows assume the console. What you get in exchange is that everything lives in your AWS account: same IAM, same billing, same VPC if you need it, same support contract. For teams that have a "must be on AWS" policy, Amplify Hosting is the path of least resistance.

This tutorial walks the connect-a-repo-to-live-URL flow, points out where Amplify's defaults will surprise you, and shows what the second deploy looks like (which is the deploy-loop you'll live in). We'll also cover when to skip Amplify Hosting entirely — there are a few cases where the manual S3 + CloudFront pipeline ends up cleaner.

What you'll learn

Prerequisites: An AWS account, a git repository with a buildable static or SSR site (Next.js, Vite, Astro, Hugo, plain HTML — Amplify auto-detects most), and a custom domain if you want one (optional — Amplify gives you a free *.amplifyapp.com URL).

Step 1: Pick the build framework first

1

Auto-detect works, but knowing the answer in advance helps

Amplify will try to detect your framework on the first connection. For the common ones it works without intervention — Next.js, Nuxt, Vite, Create React App, Hugo, plain HTML. For less-common ones (SvelteKit edge runtime, Remix, Astro with adapters), the auto-detect picks defaults that may or may not match your config.

Before connecting, confirm:

  • Your build command (npm run build, pnpm build, hugo, etc.).
  • The output directory (./dist, ./out, ./public, ./.next).
  • Whether you need server-side rendering (Amplify supports SSR for Next.js and Nuxt; static export is simpler everywhere).

Step 2: Connect the repository

2

GitHub is the smoothest path; the others work

In the AWS console, open Amplify → Create new appHost a web app. Pick your git provider:

  • GitHub: redirects to GitHub for OAuth; you grant the Amplify GitHub App access to specific repos (or all). Most polished flow.
  • Bitbucket / GitLab: similar OAuth; works fine.
  • AWS CodeCommit: AWS's own git hosting — uses IAM, no OAuth needed. Picking CodeCommit only makes sense if you already use it; otherwise GitHub is faster.

After granting access, pick the repo and branch (usually main for production). Click Next.

Step 3: Review or override the build settings

3

The amplify.yml file Amplify writes for you

Amplify shows a YAML file describing the build. For an auto-detected Vite project it looks like:

version: 1
frontend:
  phases:
    preBuild:
      commands:
        - npm ci
    build:
      commands:
        - npm run build
  artifacts:
    baseDirectory: dist
    files:
      - '**/*'
  cache:
    paths:
      - node_modules/**/*

If the detection looks right, accept and move on. If the output directory is wrong (most common error — Amplify guesses dist when yours is build, or vice versa), fix baseDirectory here. You can also commit this as amplify.yml at the repo root to keep the build config in source control.

Environment variables go here, not in the repo. In the same setup screen, expand Advanced settingsEnvironment variables. Add API_KEY, DATABASE_URL, etc. They're available at build time and (for SSR apps) at request time. Never put secrets in amplify.yml.

Step 4: First deploy

4

Five phases; you watch them turn green

Click Save and deploy. Amplify runs the pipeline:

  1. Provision — spinning up a CodeBuild container.
  2. Build — running your build commands.
  3. Deploy — uploading artifacts to the CloudFront-backed CDN.
  4. Verify — sanity check that the deployment is live.
  5. Test — runs end-to-end tests if configured (skipped by default).

Total time: 2–5 minutes for small projects, longer for large dependency installs. When Deploy turns green, Amplify shows the live URL — https://main.d1234abcde.amplifyapp.com. Click it; your site should load. This URL is HTTPS-enabled, cached on CloudFront edges, and ready before you wire up a custom domain.

Step 5: Wire up a custom domain

5

One click if your DNS is at Route 53; manual CNAMEs otherwise

App → Domain managementAdd domain. Enter mybrand.com. Amplify shows you the subdomain mapping:

  • mybrand.com → main branch
  • www.mybrand.com → main branch (with redirect to apex, or vice versa — pick the canonical)

Click Save. Amplify provisions an ACM cert (in us-east-1, handled internally — you don't have to think about it) and requests DNS validation:

  • If DNS is at Route 53 in the same account: Amplify drops the validation records into your hosted zone automatically. Wait 5–15 minutes; the domain shows as Active.
  • If DNS is elsewhere: Amplify shows you the CNAME records to add at your DNS provider. Add them, wait for validation, return to the Amplify console to confirm.

Step 6: Branch deploys and preview URLs

6

One branch = one URL

In the app overview, Connect branch. Pick a feature branch — Amplify creates a separate deployment at https://<branch-name>.d1234abcde.amplifyapp.com. Pushes to that branch trigger preview deploys; the main branch is unaffected.

For PR-based previews: App settingsPreviews → enable. Amplify watches the connected GitHub/GitLab repo for open pull requests and creates ephemeral preview URLs per PR. Useful for review; the URL goes away when the PR closes.

Step 7: The deploy loop after setup

7

git push is the deploy command

That's it. Push to main → Amplify builds → deploys → invalidates the CloudFront cache → you see the new version at mybrand.com within a few minutes. The CLI exists (amplify push for the Amplify Studio side; amplify pull for syncing config) but for hosting alone you'll rarely use it.

Build logs are at App → branch → build number. Failed builds send an email by default; configure Slack / Discord via App settingsNotifications if you want richer alerting.

When Amplify Hosting isn't the right call

You don't already use AWS. Vercel and Netlify have a noticeably better UX, faster build cold-starts (Amplify's CodeBuild containers warm slowly), and friendlier free tiers. The only reason Amplify wins is AWS-account integration — without that, the trade-off doesn't pay.

Your project has unusual build steps that Amplify's CodeBuild image doesn't support well. The CodeBuild Linux image is general-purpose but not exhaustive. If your build needs system-level dependencies, custom apt-get packages, or specific Node versions Amplify hasn't updated to, you'll spend time fighting the image. Manual S3 + CloudFront with your own CI gives you full control over the build environment.

Sub-$1/month static sites. Amplify Hosting starts billing at the first build minute — typically 1¢/build-minute, plus CDN data transfer and serve-request costs. A static site with infrequent deploys is cheaper on raw S3 + CloudFront because you skip the build-minute charge. The line is around 50 deploys/month or so; below that, manual S3 is cheaper.

What's next