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
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
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
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:
- '**/*'
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/**/*
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
.gitignoreproperly
๐น 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)