DEV Community

Haripriya Veluchamy
Haripriya Veluchamy

Posted on

AWS Amplify: My Journey from Zero to Hero πŸš€

Hey fellow developers! πŸ‘‹ Today I want to share my experience with AWS Amplify and how it transformed my deployment workflow. If you're tired of wrestling with complex deployment processes, stick around – this one's for you! checkout the video tutorial https://youtu.be/xOmeyZlQLaY for full deployment and the git repo
https://github.com/Haripriya2408/job-board

What is AWS Amplify? πŸ€”

AWS Amplify is like your tech-savvy best friend who handles all the complicated stuff while you focus on coding. It's a set of tools and services that makes it super easy to build and deploy full-stack applications. Think of it as your one-stop shop for turning your local project into a live, production-ready application.

Why Choose AWS Amplify? πŸ’‘

  1. Simplified Deployment Process
    Remember the days of manual deployments? Yeah, those are gone! With Amplify, it's basically git push β†’ magic happens β†’ your site is live!

  2. Cost-Effective πŸ’°

    • FREE TIER alert! You get:
    • 1,000 build minutes
    • 5GB stored artifacts
    • 15GB data transfer out
    • Perfect for small to medium projects
  3. Built-in CI/CD πŸ”„
    Amplify automatically sets up a deployment pipeline that would have taken hours to configure manually. #TimeSaver

  4. Framework Agnostic
    Whether you're team React, Vue, Angular, or Next.js (like me!), Amplify's got your back.

Getting Started 🏁

Here's the TL;DR version of setting up Amplify:

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

# Configure Amplify
amplify configure

# Initialize in your project
amplify init
Enter fullscreen mode Exit fullscreen mode

Common Challenges and Solutions πŸ”§

Let me share some real challenges I faced (so you don't have to bang your head against the wall):

1. The Package.json Location Drama πŸ˜…

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

Solution: Make sure your amplify.yml points to the correct directory. If your app is in a subdirectory:

version: 1
frontend:
  phases:
    preBuild:
      commands:
        - cd frontend  # Add this!
        - npm ci
Enter fullscreen mode Exit fullscreen mode

2. Build Output Directory Confusion 🀯

When your build output isn't where Amplify expects it to be.
Solution: Update your amplify.yml:

artifacts:
  baseDirectory: frontend/out  # Adjust this path
  files:
    - '**/*'
Enter fullscreen mode Exit fullscreen mode

3. Environment Variables Mystery πŸ”

Pro Tip: Never hardcode API keys! Use Amplify's environment variables:

  • Go to App Settings β†’ Environment Variables
  • Add your variables
  • Check "Secret" for sensitive info

4. Cache All The Things! ⚑

Speed up your builds with proper caching:

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

Best Practices I've Learned πŸ“

  1. Keep Your Build Clean

    • Remove unnecessary files
    • Optimize images
    • Use .gitignore wisely
  2. Monitor Your Usage

    • Set up AWS billing alerts
    • Clean up old artifacts
    • Use build caching
  3. Security First

    • Use environment variables
    • Enable branch protection
    • Regular security updates

Conclusion πŸŽ‰

AWS Amplify has genuinely made my deployment process a joy rather than a chore. While there were some initial hurdles, the time and effort saved in the long run have been worth it.

Remember: Every developer's journey is different, and what worked for me might need tweaking for your use case. Don't be afraid to experiment and find your optimal setup!

Image description

Keep coding, keep learning, and don't forget to cache those builds! πŸ˜‰

Top comments (0)