# Going Live: Deploy to AWS (For Free)

This is it. The final lesson. By the end, your Waitlist Wizard will be live on the internet — accessible to anyone with the URL. Everything you've built over the last nine lessons comes together here.

## Deployment Strategy

We'll use **AWS Amplify** — the simplest path to deploy a Next.js application on AWS. Amplify connects to your GitHub repository, builds your app automatically, and hosts it on a global CDN (Content Delivery Network).

<div class="concept-box">
<h4>Concept</h4>
<strong>Deployment</strong> is the process of taking your code from your computer and putting it on a server where anyone in the world can access it. <strong>AWS Amplify</strong> automates this: you push code to GitHub, and Amplify builds and deploys it automatically.
</div>

## Preparing for Deployment

Before we deploy, let's make sure everything is ready:

<div class="try-it">
<h4>Try It</h4>
In Claude Code:<br><br>
<strong>"Review the project for deployment readiness. Check:
1. No hardcoded localhost URLs
2. Environment variables are in .env.local (not committed)
3. The build completes without errors (run npm run build)
4. All sensitive data is in .gitignore
5. Create a .env.example file listing required environment variables without actual values"</strong>
</div>

If `npm run build` shows errors, share them with Claude to fix. The build must pass before we can deploy.

## Push to GitHub

First, we need your code on GitHub so Amplify can access it:

**Step 1: Create a GitHub repository**
1. Go to github.com and click the "+" icon > "New repository"
2. Name it `waitlist-wizard`
3. Keep it **Private** (your code, your choice)
4. Don't add README, .gitignore, or license (we already have these)
5. Click "Create repository"

**Step 2: Push your code**

<div class="try-it">
<h4>Try It</h4>
In Claude Code:<br><br>
<strong>"Help me push this project to GitHub. The repository URL is https://github.com/[your-username]/waitlist-wizard.git. Add the remote, and push the main branch."</strong>
<br><br>
Replace [your-username] with your actual GitHub username.
</div>

Claude will run the git commands:
```
git remote add origin https://github.com/yourusername/waitlist-wizard.git
git branch -M main
git push -u origin main
```

## Deploy with AWS Amplify

Now the exciting part:

**Step 1:** Go to the **AWS Amplify Console** (search for "Amplify" in the AWS console)

**Step 2:** Click **"Create new app"** > **"Host web app"**

**Step 3:** Choose **GitHub** as the source and authorize AWS to access your repositories

**Step 4:** Select your `waitlist-wizard` repository and the `main` branch

**Step 5:** Amplify will auto-detect that it's a Next.js project and configure the build settings. Review them — they should look correct.

**Step 6:** Add your environment variables:
- Click "Advanced settings"
- Add `ADMIN_PASSWORD` with your chosen password

**Step 7:** Click **"Save and deploy"**

Wait 2-3 minutes. AWS Amplify is building your application, bundling it, and distributing it across their global network.

When the build completes, you'll see a URL like: `https://main.d1a2b3c4d5.amplifyapp.com`

<div class="try-it">
<h4>Try It</h4>
Click your Amplify URL. You should see your Waitlist Wizard landing page — live on the internet! Try submitting an email and visiting the /admin page.
</div>

## Connecting DynamoDB (Replacing JSON Storage)

Our JSON file storage worked for development, but it won't work on AWS Amplify (serverless environments don't have persistent file systems). Let's switch to DynamoDB:

<div class="try-it">
<h4>Try It</h4>
In Claude Code:<br><br>
<strong>"Switch the data storage from the local JSON file to AWS DynamoDB:
1. Create a DynamoDB table called 'waitlist-signups' with partition key 'email' (String)
2. Update the /api/signup route to write to DynamoDB instead of the JSON file
3. Update the /api/signups route to read from DynamoDB
4. Use the AWS SDK v3 for JavaScript
5. Use environment variables for the AWS region
6. Include instructions for setting up IAM permissions"</strong>
</div>

After Claude updates the code, you'll need to:

1. **Create the DynamoDB table** in AWS Console:
   - Go to DynamoDB > Create table
   - Table name: `waitlist-signups`
   - Partition key: `email` (String)
   - Leave all other settings as default (on-demand capacity)

2. **Set up IAM permissions** for Amplify to access DynamoDB:
   - Go to IAM > Roles
   - Find the role Amplify created for your app
   - Add the `AmazonDynamoDBFullAccess` policy

3. **Add environment variables** in Amplify:
   - `AWS_REGION`: `us-east-1`

4. **Push and redeploy:**
```
git add .
git commit -m "switch to DynamoDB for production data storage"
git push
```

Amplify will automatically rebuild and deploy. This takes 2-3 minutes.

## Testing Your Live App

Walk through the complete flow:

1. Visit your Amplify URL — see the landing page
2. Submit a test email — it should succeed
3. Visit `/admin` — enter your password
4. See the email in the dashboard — it's stored in DynamoDB!
5. Try the CSV export — it should include the live data

<div class="pro-tip">
<h4>Pro Tip</h4>
You can verify data in DynamoDB directly: go to <strong>DynamoDB > Tables > waitlist-signups > Explore table items</strong>. You'll see every email stored as a database record.
</div>

## What You've Built

Take a moment to appreciate what you've accomplished:

- A **professional landing page** with email collection
- A **backend API** that validates and stores data
- A **cloud database** (DynamoDB) with automatic scaling
- An **admin dashboard** with charts and CSV export
- All running on **AWS**, accessible to anyone with the URL
- Total monthly cost: **$0** (within free tier limits)

## What's Next?

Your vibe coding journey doesn't end here. Some ideas:

- **Custom domain** — Point your own domain (e.g., waitlistwizard.com) using Route 53 and CloudFront
- **Email notifications** — Use AWS SES (Simple Email Service) to send a confirmation email when someone signs up (3,000 free emails/month)
- **AI features** — Use Amazon Bedrock to add AI-powered features to your app
- **Build your OWN idea** — Use the exact same workflow to build whatever app you've been dreaming about

<div class="honest-note">
<h4>Honest Note</h4>
Vibe coding with AI is a genuine superpower, but it has limits. As your projects grow in complexity, you'll run into situations where AI struggles: complex authentication flows, intricate business logic, performance optimization at scale. The foundation you've built in this course — understanding how web apps work, how to direct AI effectively, how to debug problems — will serve you regardless of how much or how little code you write by hand.
</div>

## Final Git Checkpoint

```
git add .
git commit -m "production deployment with DynamoDB"
git push
```

## Key Takeaway

You started this course with zero coding experience. You now have a live application on AWS that you built by having conversations with AI. That's not a toy demo — that's a real skill, and it's the future of software development.

<div class="checkpoint">
<h4>Checkpoint — Course Complete!</h4>
Waitlist Wizard is live on AWS. You've gone from zero coding experience to deploying a full-stack application. The tech stack, the workflow, the debugging skills — they're all yours now. Go build something amazing.
</div>
