# Mock Task

EC2 + Nginx

1 launch ec2 instance

![](https://cdn.hashnode.com/uploads/covers/65587a2805dfbdc8a48dccc5/0290e16b-0f7e-4992-a079-335415267381.png align="center")

2 install nginx

![](https://cdn.hashnode.com/uploads/covers/65587a2805dfbdc8a48dccc5/25ea0169-99d7-4da1-937b-52405c451858.png align="center")

3 Host static website

![](https://cdn.hashnode.com/uploads/covers/65587a2805dfbdc8a48dccc5/02d6fab8-58c7-41bc-a514-13e0d8788eb2.png align="center")

4

4 configure security group for http/ssh

![](https://cdn.hashnode.com/uploads/covers/65587a2805dfbdc8a48dccc5/615637c2-d024-40ed-bca5-b6452f057bf0.png align="center")

5 Verify website using public IP

![](https://cdn.hashnode.com/uploads/covers/65587a2805dfbdc8a48dccc5/f8f7352f-a98d-4c16-9fab-ee8b3f69d26e.png align="center")

6 Restart and reload nginx

![](https://cdn.hashnode.com/uploads/covers/65587a2805dfbdc8a48dccc5/117727eb-0ba4-4de2-84c4-9569bd26183a.png align="center")

7 Explain request flow: Browser → EC2 → NGINX.

Ans :- request flow :-

1 user open browser and type public ip with port 80 f=which nginx port 44.220.131.68:80

2 browser send the request to the ec2 server

3 aws security group check that port 80 is enable or not fo this ip 44.220.131.68 of machine if yes then it then user can access the website which is hosted on nginx

8 Difference between Apache and NGINX.

Both Apache HTTP Server and Nginx are web servers — they deliver websites and apps to users.

apache :-

*   older and very popular
    
*   \* easy to configure
    
*   great for share hosting
    

nginx:-

*   design for speed and scalibility
    
*   revers porxy
    
*   load balancer
    

9 Stop/start instance and verify website.

application is not running on this old address because after restart public ip address change

![](https://cdn.hashnode.com/uploads/covers/65587a2805dfbdc8a48dccc5/60a1b76d-2ed0-402f-90ac-ffd7ae835b4a.png align="center")

### Disk Partitioning using FDISK

1 Attach EBS volume to EC2.

![](https://cdn.hashnode.com/uploads/covers/65587a2805dfbdc8a48dccc5/77c1f615-d1b3-424b-b8c7-ef1caa8719f3.png align="center")

2 Verify disk using Linux commands.

![](https://cdn.hashnode.com/uploads/covers/65587a2805dfbdc8a48dccc5/86382e14-c6b0-44bc-b468-515023395a73.png align="center")

3 Create partition using fdisk.

![](https://cdn.hashnode.com/uploads/covers/65587a2805dfbdc8a48dccc5/f6d11b0f-5418-4bc3-8691-99f48fc93972.png align="center")

4 Format partition.

![](https://cdn.hashnode.com/uploads/covers/65587a2805dfbdc8a48dccc5/f96ccb83-5346-4f24-8a9b-ad4e6d91c80f.png align="center")

5 Mount partition.

![](https://cdn.hashnode.com/uploads/covers/65587a2805dfbdc8a48dccc5/3229ea04-887c-484a-9e6e-535f17a843fb.png align="center")

6 Verify storage using df -h.

![](https://cdn.hashnode.com/uploads/covers/65587a2805dfbdc8a48dccc5/47eadeae-4538-46ba-9867-a7cd1724bd92.png align="center")

8 Difference between partitioning and formatting.

partitioning :- Partitioning divides a physical disk or volume into logical sections called partitions.

formatting:- Formatting creates a filesystem on a partition (or directly on a disk).

9 Difference between EBS and Instance Store.

Instance Storage:-

instance storage is in aws is default storage which comes with ec2 instance by default . if aws instance will delete this storage also delete with it.

EBS :- Ebs is a external type of storage it dosen't come with the ec2 server we need to attach it saperately is act as a external storage like we add memory card on our phone and after deleting ec2 it will not delete by default data keep safe after deleting ec2

### Load Balancer + Auto Scaling

1 Launch 2 EC2 instances.

![](https://cdn.hashnode.com/uploads/covers/65587a2805dfbdc8a48dccc5/ee40bb81-ee0f-45a2-a8e8-c67334a3ce21.png align="center")

2 Configure web server on both.

![](https://cdn.hashnode.com/uploads/covers/65587a2805dfbdc8a48dccc5/2a106dfe-c58e-4101-a738-b76a87f81acb.png align="center")

![](https://cdn.hashnode.com/uploads/covers/65587a2805dfbdc8a48dccc5/052644f6-d094-4256-b913-74b3e3267edb.png align="center")

3 Create Target Group.

![](https://cdn.hashnode.com/uploads/covers/65587a2805dfbdc8a48dccc5/98e333c2-31f8-40a8-880b-ab945355b783.png align="center")

4 Configure Application Load Balancer.

![](https://cdn.hashnode.com/uploads/covers/65587a2805dfbdc8a48dccc5/b1ca710a-0310-490e-b719-8cdc02aa4d8a.png align="center")

5 Create AMI and Launch Template.

![](https://cdn.hashnode.com/uploads/covers/65587a2805dfbdc8a48dccc5/315b0fe0-b48a-40ee-831f-c5be67b9c3a4.png align="center")

![](https://cdn.hashnode.com/uploads/covers/65587a2805dfbdc8a48dccc5/25a3b9d9-34a0-4552-b20f-8c30d07706a0.png align="center")

7 Explain High Availability and Fault Tolerance.

Availability :- it means the system up and running most of the time , even if some component fail.

Fault Tolerance :-

the system continues operational with zero interuption.

8 Configure Auto Scaling Group.

![](https://cdn.hashnode.com/uploads/covers/65587a2805dfbdc8a48dccc5/470dd8ce-3f79-4d4d-b361-f2758076e2b7.png align="center")

![](https://cdn.hashnode.com/uploads/covers/65587a2805dfbdc8a48dccc5/ce15eedc-c1e0-405d-a1d7-4b5cfc699839.png align="center")

### S3 Static Website Hosting

1 Create S3 bucket.

![](https://cdn.hashnode.com/uploads/covers/65587a2805dfbdc8a48dccc5/1e51ba3c-6273-407a-bfd9-02a07dcec0a7.png align="center")

2 Enable static website hosting.

![](https://cdn.hashnode.com/uploads/covers/65587a2805dfbdc8a48dccc5/bf8f3495-1d52-4b5e-a8a4-f380bb21a0f8.png align="center")

3 Access website using endpoint URL.

![](https://cdn.hashnode.com/uploads/covers/65587a2805dfbdc8a48dccc5/a35ed89c-05d2-4b66-92ab-a1130fce83d6.png align="center")

4 Explain object storage.

S3 is a simple storage service used to store any type of data inn it we can store simple file m3 or mp4 here.

### VPC

1 Create custom VPC.

![](https://cdn.hashnode.com/uploads/covers/65587a2805dfbdc8a48dccc5/63b70f30-2603-4ce6-9d5e-02013b5490d2.png align="center")

2 Create public and private subnets.

![](https://cdn.hashnode.com/uploads/covers/65587a2805dfbdc8a48dccc5/978234e7-1d57-49a9-b34a-374de57103a9.png align="center")

3 Attach Internet Gateway.

![](https://cdn.hashnode.com/uploads/covers/65587a2805dfbdc8a48dccc5/729454ea-7fc0-4993-a291-b8dd21d55d26.png align="center")

4 Configure route tables.

![](https://cdn.hashnode.com/uploads/covers/65587a2805dfbdc8a48dccc5/2ca93c75-2f90-4cb8-90ac-e17f937982e6.png align="center")

5 Launch EC2 in public subnet.

![](https://cdn.hashnode.com/uploads/covers/65587a2805dfbdc8a48dccc5/d7441494-05b2-43de-a67e-64f883711bb5.png align="center")

6 Configure NAT Gateway.

![](https://cdn.hashnode.com/uploads/covers/65587a2805dfbdc8a48dccc5/05b422b4-6ab6-4120-8d11-07d30e8d96bc.png align="center")

7 Difference between Security Group and NACL.

security group :- a security group act as a virtual firewall fro an ec2 instance

it control inbound and outbound traffic

NACL :- a nacl act as a firewall for an entire subnet

it control traffic entring and leaving subnet

8 Explain CIDR notation.

Cider notation is nothing but a range of ip addresses

### DynamoDB

1 Create DynamoDB table.

![](https://cdn.hashnode.com/uploads/covers/65587a2805dfbdc8a48dccc5/96cf7360-6926-41f2-8a9c-7bb7336f1f95.png align="center")

2 Difference between SQL and NoSQL.

SQl is a relational database language stand for structured querry language

NoSQL is non-relational database stand for non structured querry language

3 Difference between DynamoDB and RDS.

DynamoDB :- is a nosql non relational database

RDS:- is a sql relational database

### RDS

RDS :- RDS is a managed database service where AWS handles backups, patching, scaling, and high availability.

Self-managed DB on EC2 :- self-managed database on EC2 requires the user to install, configure, secure, back up, and maintain the database manually.

### Lambda

![](https://cdn.hashnode.com/uploads/covers/65587a2805dfbdc8a48dccc5/b6c2d297-bc24-4bc2-9a0d-bf9932d54f16.png align="center")

uploading new file on aws email

![](https://cdn.hashnode.com/uploads/covers/65587a2805dfbdc8a48dccc5/7acde924-a0e3-421e-9217-6c85a6da8bd7.png align="center")

### CloudFront

Cache Miss :- A cache miss happens when the object is not available in the edge cache or has expire

Cache Hit :- A cache hit happens when CloudFront already has the requested object in its edge cache.
