DEV Community

Haripriya Veluchamy
Haripriya Veluchamy

Posted on • Edited on

AWS Amplify: My Journey from Zero to Hero 🚀

I built a small Next.js job board application and wanted a simple, managed way to deploy it without spending time setting up servers, pipelines, and infrastructure from scratch. I initially assumed the deployment would be straightforward, but once I started using AWS Amplify, I ran into a few build and configuration issues that weren’t obvious at first.

👉 Video walkthrough: https://youtu.be/xOmeyZlQLaY
👉 GitHub repo: https://github.com/Haripriya2408/job-board


What is AWS Amplify?

AWS Amplify is a managed service that helps you build and deploy full stack applications without manually configuring CI/CD pipelines, build servers, or hosting infrastructure. It connects directly to your Git repository and handles builds, deployments, and hosting based on your configuration.

I chose Amplify because I wanted:

  • Minimal infrastructure setup
  • Git-based deployments
  • Built-in CI/CD without custom pipeline configuration

Why I Chose AWS Amplify

Before using Amplify, I considered setting up a custom CI/CD pipeline. But for a personal project, that felt like unnecessary overhead. Amplify offered a quicker way to get from local development → production.

Some things that worked well for me:

  • Automatic deployments on git push
  • Built-in CI/CD pipeline
  • Support for frameworks like Next.js
  • A generous free tier for small projects

Getting Started

Here’s what my initial setup looked like:

# Install Amplify CLI
npm install -g @aws-amplify/cli

# Configure Amplify
amplify configure

# Initialize Amplify in the project
amplify init
Enter fullscreen mode Exit fullscreen mode

This part was straightforward. The real learning started once the first build failed.


Common Challenges I Faced (and How I Fixed Them)

While deploying, I ran into multiple issues that weren’t obvious from the documentation. These are the exact problems I faced and how I resolved them.


1️⃣ Package.json Location Issue 😅

Error:

Could not read package.json: ENOENT: no such file or directory
Enter fullscreen mode Exit fullscreen mode

At first, I assumed Amplify would automatically detect my project structure. However, my application lived inside a frontend/ directory, not at the root.

Fix:
I explicitly changed directories in amplify.yml:

version: 1
frontend:
  phases:
    preBuild:
      commands:
        - cd frontend
        - npm ci
Enter fullscreen mode Exit fullscreen mode

This took me longer than expected because the build logs weren’t very clear initially, and I wrongly assumed Amplify would infer the correct path.


2️⃣ Build Output Directory Confusion 🤯

After fixing the build step, the deployment still failed because Amplify couldn’t find the output directory.

My Next.js build output was inside a subfolder, but Amplify expected it elsewhere.

Fix:

artifacts:
  baseDirectory: frontend/out
  files:
    - '**/*'
Enter fullscreen mode Exit fullscreen mode

Once this was corrected, the deployment finally succeeded.


3️⃣ Environment Variables Handling 🔍

Initially, I tested with hardcoded values, which is not safe.

Better approach:

  • Go to App Settings → Environment Variables
  • Add required variables
  • Mark sensitive values as Secret

This keeps credentials out of the repository and aligns with security best practices.


4️⃣ Improving Build Speed with Caching ⚡

Build times were longer than necessary until I added caching.

cache:
  paths:
    - node_modules/**/*
    - .next/cache/**/*
Enter fullscreen mode Exit fullscreen mode

This significantly reduced build time on subsequent deployments.


Best Practices I Picked Up Along the Way

🔹 Keep Builds Clean

  • Remove unused dependencies
  • Optimize assets
  • Use .gitignore properly

🔹 Monitor Usage

  • Enable AWS billing alerts
  • Clean up unused branches and artifacts
  • Use caching effectively

🔹 Security First

  • Never commit secrets
  • Use environment variables
  • Keep dependencies updated

Final Thoughts

Deploying with AWS Amplify wasn’t completely smooth for me at the beginning, but once I understood how Amplify interpreted the project structure and build phases, it became much easier to manage.


Top comments (0)