---
# System prepended metadata

title: Project II

---

# Project II

### This project will expose you to the following AWS technologies: EC2, RDS, S3, and CloudWatch.

---

## Intro (include recap)

---
### Two apps: 
- #### User Application: 
    ##### Has 3 interfaces: 
    - Add image
    - Get image 
    - Get all image

- #### App manager: 
    ##### Has 2 interfaces: 
    - Configuration
    - Statistics


---

## Amazon Web Services 

### EC2
Amazon Elastic Compute Cloud (Amazon EC2) offers the broadest and deepest compute platform.

### RDS
Amazon Relational Database Service RDS is a managed relational database service that provides you six familiar database engines to choose from, including  Amazon Aurora, MySQL, MariaDB, PostgreSQL, Oracle, and Microsoft SQL Server.


### Advantage over using RDS versus deploying DB on EC2
 - RRDS is a managed service:
• Automated provisioning, OS patching
• Continuous backups and restore to specific timestamp (Point in Time Restore)!
• Monitoring dashboards
• Read replicas for improved read performance
• Multi AZ setup for DR (Disaster Recovery)
• Maintenance windows for upgrades
• Scaling capability (vertical and horizontal)
• Storage backed by EBS (gp2 or io1)
- BUT you can’t SSH into your instances


### S3
Amazon Simple Storage Service (Amazon S3) is an object storage service that offers industry-leading scalability, data availability, security, and performance.


### CloudWatch
Amazon CloudWatch is a monitoring service for Amazon Web Services cloud resources and the applications you run on Amazon Web Services. You can use Amazon CloudWatch to collect and track metrics, collect and monitor log files, set alarms, and automatically react to changes in your Amazon Web Services resources.

### CloudWatch Use cases

#### Monitor Amazon EC2
View metrics for CPU utilization, data transfer, and disk usage activity from Amazon EC2 instances (Basic Monitoring) for no additional charge. For an additional charge, CloudWatch provides Detailed Monitoring for EC2 instances with higher resolution and metric aggregation. No additional software needs to be installed. 

#### Monitor and React to Resource Changes
CloudWatch Events provides a stream of events describing changes to your Amazon Web Services resources. You can easily build workflows that automatically take actions you define, such as stopping an Amazon EC2 instance, sending an Amazon SNS message, or adding a message to the Amazon SQS Queue, when an event of interest occurs.



---


## In general


- ### We store the image in S3 
- ### We get the link from S3 and store in database
- ### We use RDS in AWS for database

### Application of the user contains 3 interfaces  in the instance

### Application of the app manager in another instance and he has the last two interfaces 

### Two apps: 
- #### User Application: 
    ##### Has 3 interfaces: 
    - Add image
    - Get image 
    - Get all image

- #### App manager: 
    ##### Has 2 interfaces: 
    - Configuration
    - Statistics

### Cloud Watch:

#### These apps communicate with each other by cloud watch 

#### The app user store the statistics: miss rate, hit rate, number of requests, items , size store in cloud watch

#### Statistics of the application user are stored in the app manager interface

#### By the cloud watch we can read the statistics in the app manager by charts, We read the real data

#### App manager send the configuration to cloud watch and user app read it from the cloud watch, and there's is an auto-scaling by the size of the cache


 


## Pictures from the practical part

### manager app configration
![](https://i.imgur.com/RXJvTpt.png)

### manager app charts statistics

![](https://i.imgur.com/bWgIbBH.png)




### s3:

![](https://i.imgur.com/rZK6nL6.png)

![](https://i.imgur.com/bM6syKl.png)

![](https://i.imgur.com/GE09sfX.png)

### RDS:
![](https://i.imgur.com/Xmr65AK.png)

![](https://i.imgur.com/gIEpEJw.png)

![](https://i.imgur.com/NwKulvt.png)

# Code : 
## Cache Configuration : 
![](https://i.imgur.com/baajLw3.png)
## Get Configuration : 
![](https://i.imgur.com/qiTMwOW.png)
## Get Image : 
![](https://i.imgur.com/QOKoH3h.png)
![](https://i.imgur.com/gILcA3v.png)
## Get All Images : 
![](https://i.imgur.com/wzhiFp2.png)
## Insert Image :
![](https://i.imgur.com/yt5c3UP.png)
## Upload to S3 : 
![](https://i.imgur.com/7kOiqjr.png)
### AWS cloud watch : 
![](https://i.imgur.com/LqY1vSX.png)
![](https://i.imgur.com/YDb7h7c.png)
## LRU cache : 
![](https://i.imgur.com/MVyZgbg.png)
![](https://i.imgur.com/If5KXlR.png)
![](https://i.imgur.com/NxlQkjK.png)
## Random cashe : 
![](https://i.imgur.com/3ULqRwr.png)





