How to Deploy an App on AWS: A Step-by-Step Guide for Developers
Deploying an application on Amazon Web Services doesn’t have to be overwhelming. Whether you’re launching a simple web app or a robust microservice, AWS offers flexible tools to get your code production-ready in minutes. In this guide, I’ll walk you through a practical deployment workflow using Elastic Beanstalk and EC2 — the two most common paths.
Before you begin, make sure you have an AWS account, the AWS CLI installed, and your application code pushed to a Git repository or bundled as a ZIP/artifact.
1. Choose Your Deployment Service
AWS offers several compute options. For most web apps, Elastic Beanstalk is the fastest route — it automatically handles load balancing, scaling, and health monitoring. For full control, use EC2 with an NGINX or Apache server.
2. Prepare Your Application
- Set environment variables (database URLs, API keys) in a config file or directly in the service dashboard.
- Build your project locally to ensure it compiles (e.g.,
npm run buildormvn package). - Include a Procfile (for EB) or a systemd service file (for EC2) to define how your app starts.
3. Deploy with Elastic Beanstalk (Recommended)
Run eb init to configure your environment, then eb create to launch it. Finally, type eb deploy to push your code. AWS uploads the bundle, provisions the infrastructure, and exposes a public URL instantly.
4. Deploy on EC2 Manually
Launch an Ubuntu instance, SSH in, install Node.js/Python/Java as needed, clone your repo, and run your app with a process manager like PM2. Don’t forget to open the correct port (e.g., 3000 or 8000) in the security group.
5. Post-Deployment Checks
- Verify the health endpoint responds with 200 OK.
- Set up CloudWatch alarms for CPU and memory usage.
- Attach an Elastic IP or configure Route 53 for a custom domain.
Deploying to AWS becomes straightforward once you pick the right service. Start with Elastic Beanstalk for speed, and migrate to EC2 or ECS when you outgrow the defaults. Ship fast, monitor often, and scale when ready.