Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add contents for the Cloud Computing course #189

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions cloud_computing/cloud_computing_intro/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
---
name: Introduction to Cloud Computing
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would generally shorten this introduction section. Benefits/drawbacks of cloud are well known at this point, and having a couple of paragraphs should be enough.

id: intro_to_cloud_computing
dependsOn: [
]
files: [
]
summary: |
This course covers the basics of cloud computing, including key concepts, service models, and major providers.
It also highlights the primary benefits of cloud computing, while addressing common challenges faced in its adoption.
---


## Cloud Computing: A High-Level Overview

Cloud computing refers to the delivery of computing services —including servers, storage, databases, networking, software, analytics, and intelligence— over the Internet ("the cloud") to offer faster innovation, flexible resources, and economies of scale. It enables organizations to access resources without the need to own or manage physical infrastructure, allowing them to innovate rapidly, adapt to changing workloads, and grow efficiently while minimizing costs. By leveraging the cloud, organizations can focus more on delivering value and less on managing IT infrastructure, enhancing their ability to compete in an increasingly digital world.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

insert space on either side of hyphen


## Key Features of Cloud Computing

Cloud computing offers a range of key features that set it apart from traditional IT infrastructure. These features enhance flexibility, ease of access, and operational efficiency, making cloud solutions well-suited for businesses with diverse needs and varying scales.

1. **On-Demand Self-Service:** Users can easily provision resources such as virtual servers or storage without requiring human intervention from the provider.
2. **Access Anytime, Anywhere:** Cloud services are accessible over the Internet from anywhere using standard tools like web browsers and APIs.
3. **Shared Resources:** Cloud providers pool resources to serve multiple users, dynamically allocating computing power and storage as needed.
4. **Scalability:** Resources can be scaled up or down automatically based on demand, providing agility for fluctuating workloads.
5. **Pay-as-You-Go:** Users only pay for the resources they consume, making cloud infrastructure cost efficient and avoiding the expense of over provisioning.


## Cloud Service Models

Cloud computing is delivered through three primary models, each offering different levels of control and responsibility:

1. **Software as a Service (SaaS):** SaaS provides fully managed software applications over the Internet, eliminating the need for installation or maintenance. Examples include Gmail and Microsoft Office 365.

2. **Platform as a Service (PaaS):** PaaS offers a platform for developers to build, deploy, and manage applications without managing the underlying infrastructure. Examples include AWS Elastic Beanstalk, Microsoft Azure App Service, and Google App Engine.

3. **Infrastructure as a Service (IaaS):** IaaS Provides virtualized computing resources like virtual machines and storage, giving users full control over operating systems and applications. Examples include AWS EC2, Microsoft Azure Virtual Machines, and Google Compute Engine.


## Leading Cloud Providers

Several cloud providers offer a wide range of services to meet the diverse needs of organizations:

1. **Amazon Web Services (AWS):** The largest and most comprehensive cloud provider, offering a wide range of services, including computing, storage, databases, and machine learning. AWS provides global infrastructure with high availability and performance.

2. **Microsoft Azure:** A cloud platform integrated with Microsoft’s ecosystem of products, Azure provides services for building, managing, and scaling applications, as well as seamless integration with Windows, Office 365, and Azure Active Directory.

3. **Google Cloud Platform (GCP):** Known for its strengths in data analytics, AI, and machine learning, GCP offers reliable cloud services through Google's global network. GCP is ideal for organizations looking to leverage cutting-edge technologies.

## Benefits of Cloud Computing

Cloud computing provides many significant advantages that allow organizations to stay agile, reduce costs, and scale their operations efficiently. These benefits make cloud technology a compelling choice for businesses of all sizes.

1. **Cost Savings:** Organizations no longer need to invest in and maintain physical infrastructure, reducing both capital expenditure (CapEx) and operational expenditure (OpEx), while benefiting from a flexible pay-as-you-go model.
2. **Scalability and Flexibility:** Cloud services can scale seamlessly to accommodate growing workloads, providing businesses with the agility to meet changing demands.
3. **Global Accessibility:** With cloud services available from anywhere, businesses can access resources across geographic locations.
4. **High Reliability:** Cloud providers use redundant infrastructure with built-in fault tolerance that automatically takes over in case of failure, ensuring smooth operation and minimizing downtime. This guarantees reliable performance and continuous availability of services.
5. **Faster Innovation:** The cloud empowers businesses to test new ideas and roll out services more quickly by providing immediate access to resources.


## Challenges of Cloud Computing

While cloud computing offers numerous benefits, there are also challenges that organizations must consider. These challenges can impact decision-making and require careful planning to mitigate risks.

1. **Vendor Lock-In:** Once integrated with a cloud provider’s services, it can be challenging to switch providers due to proprietary technologies and costs.
2. **Security and Privacy Concerns:** Storing data off-premises introduces security risks, and businesses must ensure that robust data protection policies are in place.
3. **Downtime and Outages:** Despite high availability, cloud services can still face outages or disruptions, which could affect business operations.
4. **Limited Control:** While cloud services offer flexibility, users have less control over the infrastructure, and customization options may be limited.

## Conclusion and Next Steps

Cloud computing is transforming industries by providing scalable, cost-effective, and globally accessible resources. While the cloud offers significant benefits, such as reduced costs and faster innovation, businesses must also be mindful of challenges like vendor lock-in and security concerns. By understanding both the advantages and potential drawbacks, organizations can make informed decisions and fully harness the power of cloud technology.

Next, we will dive into hands-on exercises where you'll apply these concepts and gain practical experience with real-world cloud solutions.


18 changes: 18 additions & 0 deletions cloud_computing/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
id: cloud_computing
name: Cloud Computing
dependsOn: [
introductory_courses.python
]
courses: [
cloud_computing_intro,
migrating_app_to_cloud
]
summary: |

An introduction to cloud computing, exploring foundational concepts and the offerings of major providers, with a focus on practical applications for compute, storage, and databases. Additionally, a hands-on course focused on migrating an on-premises application to the cloud, outlining the essential steps and considerations.

---

An introduction to cloud computing, exploring foundational concepts and the offerings of major providers, with a focus on practical applications for compute, storage, and databases. Additionally, a hands-on course focused on migrating an on-premises application to the cloud, outlining the essential steps and considerations.

139 changes: 139 additions & 0 deletions cloud_computing/migrating_app_to_cloud/app_local_storage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
---
name: Running the Image Processing Application Locally
dependsOn: []
tags: []
learningOutcomes:
---

This image processing application is designed to store and process images using local storage, with a SQLite database specifically for metadata management. It provides an excellent introduction to handling file uploads, processing images, and organizing metadata effectively.

### Prerequisites

Before getting started with the image processing application, ensure that the following software is installed on your system:

1. **Git:** Required to clone the repository via command line from GitHub (optional if downloading the repository from the GitHub web interface as a ZIP file). [Download Git](https://git-scm.com/downloads)
2. **Python:** The application is built and tested with Python 3.11; therefore, it is recommended to use this version. However, it should also be compatible with the latest versions of Python. [Download Python](https://www.python.org/downloads/)
3. **Pip:** Required to install the Python dependencies. Pip typically comes bundled with Python, but make sure it's installed and up to date (`pip --version`). [Pip Installation Guide](https://pip.pypa.io/en/stable/installation/)
4. **Docker:** If you prefer to run the application inside a Docker container. [Download Docker](https://www.docker.com/products/docker-desktop/)
5. **IDE:** You can use any IDE to edit and navigate the code, but **Visual Studio Code** is recommended for its flexibility and extensive range of helpful extensions (e.g., Docker) that enhance development and troubleshooting. [Download Visual Studio Code](https://code.visualstudio.com/)


### Cloning the Application from GitHub

To get started with the image processing application, follow these steps to clone the repository and set it up locally:

1. Clone the repository from GitHub:
```bash
git clone https://github.com/Oxford-Research-Cloud-Competency-Centre/image-processing-app.git
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a license to the repo?

```

2. Navigate to the project directory:
```bash
cd image-processing-app
```

After cloning the repository, open the project in your preferred IDE. Take some time to explore the project structure and get familiar with each component. The next section will provide an overview of the application, and afterward, we'll dive into the details of running it, covering each part of the setup and execution process.


### Application Overview

The application consists of three main components:

1. **`app.py`** - Manages the Flask web interface, providing endpoints for file uploads and image downloads, while handling image processing and metadata storage.
2. **`image_processor.py`** - Processes images by converting them to grayscale and resizing them.
3. **`database.py`** - Manages the SQLite database, storing metadata for original and processed images.

These components work together to create a cohesive image processing system.


### Core Components of the Image Processing Application

We will now discuss these components in detail, outlining their roles, and how they work together to form the complete image processing application.

#### 1. **`app.py`: Flask Application**

The central component, `app.py`, handles the core functionality of the web interface, routing, and interactions with both the image processing module and the database. It manages the following:

- **File Uploads**: Users upload images through the web interface, and these images are saved in the `images/uploads` directory. The images are stored directly on the system running the application, ensuring that the raw files are accessible for processing.
- **Image Processing**: The component calls the `process_image()` function from `image_processor.py` to process images.
- **Directory Management**: The component ensures the `images/uploads` and `images/processed` directories exist, creating them if necessary.
- **Routing**: Manages routes for displaying metadata, handling uploads, and downloading processed images:
- `/`: Displays a dashboard with image metadata.
- `/upload`: Handles the image upload and processing.
- `/processed/<filename>`: Enables downloading of processed images.

#### 2. **`image_processor.py`: Image Processing**

This module handles the image transformation, performing two operations:

- **Grayscale Conversion**: Converts the uploaded image to grayscale using [OpenCV](https://opencv.org/).
- **Resizing**: Resizes the grayscale image to 300x300 pixels.

The processed images are stored in the `processed` directory.

#### 3. `database.py`: SQLite Database Management

The `database.py` module handles interactions with the SQLite database, which stores essential metadata for each uploaded and processed image. Key metadata fields include original and processed filenames, image sizes, upload dates, and optional descriptions, providing a comprehensive record of each image.

**Main functions in `database.py`:**

- **`init_db()`**: Initializes the database by creating the `ImageMetadata` table if it doesn't already exist. The `metadata.db` file is automatically generated in the project directory upon initialization.
- **`insert_metadata()`**: Adds metadata for both original and processed images, supporting detailed tracking.
- **`get_metadata()`**: Retrieves stored metadata for display on the application's dashboard.

Once an image is processed, `app.py` saves it in the `images/processed` directory on the system. Both `uploads` and `processed` directories are automatically created when the application runs, if they don't already exist.

By managing and retrieving image metadata efficiently, `database.py` enables the application to track details like:

- Filenames for original and processed images.
- Image sizes.
- Upload date and time.
- Optional descriptions.

This setup ensures efficient metadata storage and retrieval, contributing to the application's smooth functionality and user experience.


### Running the Application

The application can be run in two different ways, depending on your setup:

#### 1. **Running Locally with Python:**

To run the application locally on your system:

1. Make sure the repository is cloned and you are inside the home directory of the application.
2. Install the necessary Python dependencies:
```bash
pip install -r requirements.txt
```
3. Run the Flask application:
```bash
python app.py
```

The application will be accessible at http://localhost:5000

#### 2. **Running with Docker:**

Alternatively, you can run the application inside a Docker container:

1. Build the Docker image:
```bash
docker build -t image-processing-app .
```
2. Run the Docker container:
```bash
docker run -p 5000:5000 image-processing-app
```
This will make the application available at http://localhost:5000, without the need to install Python or any other dependencies directly on your machine.


### Application Workflow

1. **Image Upload:** Users upload images via a form on the main page. These images are saved in the `uploads` directory.
2. **Image Processing:** After an image is uploaded, the `image_processor.py` module converts it to grayscale and resizes it. The processed image is stored in the `processed` directory.
3. **Metadata Management:** Metadata for both the original and processed images—such as filename, size, and upload date—is stored in the SQLite database. This information is viewable on the application's dashboard.
4. **Download Processed Images:** Users can download the processed images directly from the dashboard.


This locally hosted image processing application provides an introduction to file uploads, image processing, and database management. It integrates **Flask** for web routing and user interaction, **OpenCV** for image processing, and **SQLite** for managing image metadata. In later sections of this course, we will expand the application by transitioning from local storage and databases to AWS services such as **S3** and **DynamoDB**, creating a scalable, cloud-native solution.
Loading