Hackforge Academy

Category: react

What is aws and explain s3 and ec2

Published on 06 May 2026

Explanation

AWS (Amazon Web Services) is a cloud computing platform provided by Amazon. It offers services like servers, storage, databases, networking, security, and deployment tools. Developers use AWS to host websites, APIs, applications, databases, and scalable cloud infrastructure.

Code:

/* Common AWS Services */
- EC2 → Virtual Servers
- S3 → Cloud Storage
- RDS → Database Service
- Lambda → Serverless Functions
- CloudFront → CDN
- IAM → Security & Access Control

Explanation

EC2 (Elastic Compute Cloud) is a virtual server service in AWS. It allows developers to create and manage cloud-based servers for hosting applications, websites, backend APIs, and DevOps environments.

Code:

/* EC2 Uses */
- Host React Applications
- Deploy Spring Boot APIs
- Run Docker Containers
- Setup Jenkins Server
- Host Databases
- Run Background Services

Explanation

To create an EC2 instance, select an operating system, instance type, security rules, and launch the virtual machine.

Code:

AWS Console → EC2 → Launch Instance

1. Choose AMI (Ubuntu/Linux)
2. Select Instance Type
3. Configure Security Group
4. Create Key Pair
5. Launch Instance

Explanation

You can connect to an EC2 Linux server using SSH from terminal.

Code:

ssh -i mykey.pem ubuntu@public-ip-address

Explanation

S3 (Simple Storage Service) is an object storage service in AWS used to store files like images, videos, backups, PDFs, static websites, and application assets.

Code:

/* S3 Uses */
- Store Images & Videos
- Backup Files
- Host Static Websites
- Store React Build Files
- File Upload System
- Cloud Storage

Explanation

S3 stores data inside buckets. A bucket is like a folder/container in cloud storage.

Code:

AWS Console → S3 → Create Bucket

Bucket Name Example:
my-react-app-storage

Explanation

You can upload files to S3 manually or programmatically using AWS SDK.

Code:

const AWS = require('aws-sdk');

const s3 = new AWS.S3();

s3.upload({
  Bucket: 'my-bucket',
  Key: 'image.png',
  Body: fileData
}, callback);

Explanation

S3 can host static frontend applications like React websites. Upload the React build folder to S3 and enable static website hosting.

Code:

npm run build

/* Upload build folder contents to 
S3 bucket */

Explanation

Difference between EC2 and S3: EC2 is used for running applications and servers, while S3 is used for storing files and static content.

Code:

/* EC2 vs S3 */
EC2 → Compute Service (Server)
S3 → Storage Service (Files)

Explanation

AWS provides scalability, high availability, security, and pay-as-you-go pricing, making it popular for startups and enterprise applications.

Code:

/* AWS Benefits */
- Scalable
- Secure
- Global Infrastructure
- High Availability
- Cost Effective
- Easy Deployment

🚀 Learn Spring Boot with real-world projects

💡 Build REST APIs step by step

🧠 Improve backend development skills

🎯 Get career-ready practical training

Join Our Free WhatsApp Community

Direct access to niche-specific mentors and peers on WhatsApp.

🐍

Python Community

Discuss Django, FastAPI, AI integration, and automation scripts with 15k+ developers.

Join Python Community
⚛️

React Community

Master Next.js, Framer Motion, and State Management. Share your latest UI components.

Join React Community

Java Community

Deep dives into Spring Boot, Microservices architecture, and high-performance backend ops.

Join Java Community