# Mastering AWS for Developers: Key Services Every MERN Stack Engineer Should Know

When it comes to deploying modern applications, Amazon Web Services (AWS) remains the **go-to cloud platform**. But with **200+ services**, it’s easy to feel overwhelmed. As a MERN (MongoDB, Express, React, Node.js) developer preparing for **real-world projects or interviews**, you don’t need to know *everything* — just the **core AWS services** that directly impact application development and deployment.

In this blog, we’ll explore **5 AWS services every developer should master**, with examples and use cases tailored for SaaS and MERN stack projects.

---

## 1\. **Amazon EC2 (Elastic Compute Cloud)** – Your Virtual Server

**What it is**: EC2 provides resizable virtual machines in the cloud.

**When to use**:

* Running Node.js backend APIs.
    
* Hosting services that require full server control.
    
* Running cron jobs or background workers.
    

**Example**: Deploying an Express.js backend on an EC2 instance with **NGINX + PM2** for process management.

---

## 2\. **Amazon S3 (Simple Storage Service)** – Scalable Object Storage

**What it is**: Secure and highly scalable object storage service.

**When to use**:

* Store user-uploaded files (profile pictures, reports, invoices).
    
* Host static websites (React SPA).
    
* Store backups and logs.
    

**Code Example (Node.js file upload)**:

```plaintext
import { S3Client } from '@aws-sdk/client-s3';
import multerS3 from 'multer-s3';
import { configData } from '../config/config';
import path from 'path';

export const s3Client = new S3Client({
	region: 'ap-south-1',
	credentials: {
		accessKeyId: configData.s3accessKeyId,
		secretAccessKey: configData.s3secretAccessKey,
	},
});

export const s3Storage = multerS3({
	s3: s3Client,
	bucket: `${process.env.S3_BUCKETNAME}`,
	metadata: (req, file, cb) => {
		cb(null, { fieldname: file.fieldname });
	},
	key: (req, file, cb) => {

		if (!file || !file.originalname) {
			return cb(new Error('No file provided.'));
		}

		const allowedExtensions = ['.jpg', '.jpeg', '.png'];
		const ext = path.extname(file.originalname).toLowerCase();

		if (!allowedExtensions.includes(ext)) {
			return cb(new Error('Only .jpg, .jpeg, and .png formats are allowed.'));
		}

		const fileName = `Profile-Images/${Date.now()}_${file.fieldname}_${file.originalname}`;
		cb(null, fileName);
	}

});
```

---

## 3\. **AWS Lambda** – Serverless Functions

**What it is**: Run code without managing servers.

**When to use**:

* Event-driven tasks (file upload triggers, email sending).
    
* Background processing (image compression, PDF generation).
    
* Low-traffic APIs to save cost.
    

**Example**: Triggering a Lambda when a new file is uploaded to S3 → process → save result in MongoDB.

---

## 4\. **Amazon RDS (Relational Database Service) & DynamoDB**

* **RDS**: Managed SQL databases (MySQL, PostgreSQL).
    
* **DynamoDB**: NoSQL key-value store, fully serverless.
    

**When to use**:

* Use **RDS** when you need transactions & complex queries.
    
* Use **DynamoDB** for fast lookups, real-time apps, or event-driven workloads.
    

---

## 5\. **Amazon CloudWatch & IAM** – Monitoring & Security

* **CloudWatch**: Logs, metrics, alarms for apps.
    
* **IAM (Identity & Access Management)**: Secure access with least-privilege policies.
    

**Why it matters**:

* CloudWatch helps debug production issues (API latency, memory leaks).
    
* IAM ensures your app isn’t overexposed (e.g., public S3 buckets = security nightmare).
    

---

## Quick Deployment Example: MERN App on AWS

1. React frontend → Deploy on **S3 + CloudFront**.
    
2. Node.js backend → Run on **EC2** or **Elastic Beanstalk**.
    
3. MongoDB → Use **MongoDB Atlas on AWS** (or DynamoDB if allowed).
    
4. File uploads → Store on **S3**.
    
5. Monitoring → Use **CloudWatch** for logs + alerts.
