Skip to content

Commit fb55434

Browse files
committed
lessons 1 & 3
1 parent 80cbdbc commit fb55434

File tree

7 files changed

+231
-4
lines changed

7 files changed

+231
-4
lines changed
52.3 KB
Loading

module7-cloud-computing/assets/saas-paas-iaas-diagram.svg

Lines changed: 1 addition & 0 deletions
Loading
30.4 KB
Loading
Lines changed: 105 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,117 @@
11
# Introduction to cloud computing
22

3-
In the olden days, companies would keep physical computers at their company in order to run a website which is called on-premises datacenter. Or you might have tried hosting your application on a hosting server that gives you a shared or dedicated hosting storage space on Virtual Private Server (VPS) to host your application. The hosting server is usually in charge of handling the infrastructure and the underlying environment like PHP processor, or nodejs.
3+
In the olden days, companies would keep physical computers at their company to run a website (aka on-premises datacenter). You might also have tried hosting your application on a hosting server that gives you a shared or dedicated hosting storage space on Virtual Private Server (VPS) to host your application. The hosting server is usually in charge of handling the infrastructure and the underlying environment like PHP preprocessor, or Node.js.
44

5-
That was enough at some point in time, but then the needs grew larger when web apps were used more and more, the VPS bandwidth was not enough to accomodate the usage surge. Nor it was enough to fascilitate the communications between many backend applications. Or if the company used their own physical servers, they have to manage everything, such as purchasing and installing hardware, virtualization, installing the operating system, and any other required applications, setting up the network, configuring the firewall, and setting up storage for data. After doing all the set-up, they become responsible for maintaining it through its entire lifecycle.
5+
That was enough at some point in time, but then the needs grew larger when web apps were used more and more, the VPS bandwidth was not enough to accommodate the usage surge. Nor it was enough to facilitate the communications between many backend applications.
66

7-
That was when the cloud infrastructure came alive. Cloud Computing is the delivery of computing services such as servers, storage, databases, networking, software, analytics, intelligence, and more, over the Cloud (Internet). It provides an alternative to the on-premises datacentre. In Cloud Computing, a cloud vendor is responsible for the hardware purchase and maintenance. They also provide a wide variety of software and platform as a service. We can take any required services on rent. The cloud computing services will be charged based on usage. The cloud environment provides an easily accessible online portal that makes handy for the user to manage the compute, storage, network, and application resources.
7+
On the other hand, if the company used their physical servers, they have to manage everything, such as purchasing and installing hardware, virtualization, installing the operating system and any other required applications, setting up the network, configuring the firewall, and setting up storage for data. After doing all the setup, they become responsible for maintaining it through its entire lifecycle.
8+
9+
That was when the cloud infrastructure came alive. Cloud computing is the delivery of computing services such as servers, storage, databases, networking, software, analytics, intelligence, and more, over the Cloud (Internet). It provides an alternative to the on-premises data center.
10+
11+
In cloud computing, a cloud vendor is responsible for hardware purchase and maintenance. They also provide a wide variety of software and platform as a service. The cloud computing services will be charged based on usage, aka pay-as-you-go. The cloud environment provides an easily accessible online portal that makes it handy for the user to manage the compute, storage, network, and application resources.
12+
13+
## Usage of the Cloud
14+
15+
In this course, we have added a cloud computing module as an entry-level overview for backend students. Using cloud vendors to host and deploy a product is the current market standard everywhere. As a backend developer, you may use the cloud in the following scenarios:
16+
17+
- Deploy your source code on a cloud machine that acts as a server.
18+
- Host cloud functions that are responsible for doing certain business logic as a serverless computing solution.
19+
- Use the cloud to run fault-tolerant, auto-scaling, and containerized applications in clusters using Kubernetes or containers services.
20+
- To host, run, and secure a remote database using either database as a service (DBaaS) offering, or a machine that hosts your Database.
21+
- To use cloud provider's certain Backend as a service (BaaS) offering, that would enable you to run frontend apps without developing a backend.
22+
- Use the cloud to securely store, archive, or backup your data with or without encryption using the cloud storage services.
23+
- To run self-managed registries for packages, container images, and version control.
24+
- You can also use the cloud to manage your network (isolate, load-balance, and proxy), connect datacenters, and manage DNS (IP to domain resolution).
25+
- Cloud providers offer tools to monitor your application and services with analytics and logs.
26+
- Cloud vendors also offer CDNs that would deliver your content everywhere with very low latency and high speed.
27+
- Use the cloud to geo-locate your app in different regions for faster load time to end-user.
28+
- Use the cloud as a security gateway to prevent various attacks aimed to overload your servers.
29+
- You can also use the cloud to build, monitor, manage, and test your projects using code building services and CI/CD pipelines.
30+
- Finally, you can even use the cloud to develop and write code using cloud-managed IDEs. They can be self-hosted or offered as a service and can be configured to ensure a secure remote development environment for your team by ensuring no piece of business property (source code, proprietary tools) is sitting in any personal computer.
831

932
## Advantages of cloud computing
1033

1134
- Cost: It reduces the huge capital costs of buying hardware and software.
1235
- Speed: Resources can be accessed in minutes, typically within a few clicks.
1336
- Scalability: We can increase or decrease the requirement of resources according to the business requirements.
14-
- Productivity: While using cloud computing, we put less operational effort. We do not need to apply patching, as well as no need to maintain hardware and software. So, in this way, the IT team can be more productive and focus on achieving business goals.
37+
- Productivity: While using cloud computing, we put less operational effort. We do not need to apply patches, as well as no need to maintain hardware and software. So, in this way, the IT team can be more productive and focus on achieving business goals.
1538
- Reliability: Backup and recovery of data are less expensive and very fast for business continuity.
1639
- Security: Many cloud vendors offer a broad set of policies, technologies, and controls that strengthen our data security.
40+
41+
## Cloud Technologies
42+
43+
All major cloud providers offer a variety of tools and stacks that help you host your applications and expose them to the internet. There are many ways to do this, each way has its benefits, cost projection, maintenance, and scaling requirements. We will summarize some of the main technologies that can be helpful to you as a backend software developer.
44+
45+
### Compute Instances
46+
47+
These are the basic units of any cloud vendor. They are computers predefined with a set of hardware (processors, RAMs, GPUs) that are run remotely through virtualization technologies. You can deploy your app directly on a compute instance via continuous delivery or by uploading it manually.
48+
49+
Once your source code is there on the cloud machine, you need to ensure the prerequisites to build and run it are installed, like installing Node.js, or Apache server. If you want your backend app to be available to the public, you need to also expose the port that is being listened to by your application (usually 80 for HTTP and 443 for HTTPS).
50+
51+
The instance will have its public IP address, you can access your app using that IP address or configure your domain DNS to forward to that IO.
52+
53+
Databases can also be hosted on these compute instances, by installing the DB software and exposing its ports or simply connecting to the database using the local cloud vendor subnet (subnetwork) to isolate it from the public. Alternatively, most cloud vendors offer managed, highly available database hosting that comes preconfigured with backup schedule, scaling, and data residency policy (where is your data located and under which country laws).
54+
55+
### Clusters & Scaling Groups
56+
57+
To run your instances means you are merely renting a computer. You still have to do most of the heavy lifting yourself. At some point, pages will start to load slowly, network connections start timing out and your servers are starting to creak under heavy load. Congratulations – your web app has hit scale! One of the most important concepts you will need to learn then is scaling your application. By scaling, we mean resizing or running more instances that contain the same application, and then when an instance is busy, the load is redirected towards another instance.
58+
59+
Servers bottlenecks are mainly due to:
60+
61+
CPU
62+
Memory (RAM)
63+
Disk I/O
64+
Network I/O
65+
66+
When a webserver listens to requests, it will spawn a worker thread or process for each request that is coming to your app. The worker will be responsible to run the instructions that handle that request and responding to it up till the connection closes. The instruction might include reading/writing files to disk, connecting to other computers, or query databases, among others.
67+
68+
When many requests come to the server, the processor will be loaded and at some point, it will start lagging due to overloading. On the other hand, if your app uses lots of memory like querying lots of data or image processing, your server can run out of RAM quickly.
69+
70+
These would contribute to server errors, crashes, slow loading, or failed connections. That is why more machines are needed to balance the load.
71+
72+
If you are running your app inside an instance, and this load peaked at a certain time due to some promotion or advertisement that led people to your app. Then you will lose lots of customers due to their bad experience using your laggy-crashy app. Until you've figured out the problem and ran and configured more machines, it would be too late...
73+
74+
That's mostly an indication that you need to run your app in scaling groups or clusters. These are tools that help auto-scale your app (run more machines/containers) when needed. They are configuration files that define how your app can be installed and run. It would automatically create copies of your app, and balance the load between these machines to serve all the requests.
75+
76+
We will explore this more in the Kubernetes lesson.
77+
78+
### Serverless Architecture
79+
80+
Another flow that can be appealing at times is to not manage a whole backend application. Instead, you can run cloud functions, and use a backend as a service platform to host your business logic.
81+
82+
Such configuration is mostly favorable for mobile apps, and web frontend apps that do not necessarily require a backend.
83+
84+
Using the serverless architecture, directly from your frontend app (mobile, or web) you can use:
85+
86+
- Services like Auth0, Firebase Auth, or Congnito to offer seamless authentication.
87+
- Databases like DynamoDB, DocumentDB, or Firestore to be queried frontend side.
88+
- Cloud functions to create a simple HTTP server, or to run a job that interacts with databases and other services similar to a backend server without actually running a server.
89+
- Cloud storage like AWS S3, or Google Storage to upload and persist user data.
90+
- CDNs to deliver your app content (images, assets, js, and css files) anywhere with very high speeds.
91+
- Analytics that logs errors and crashes that happen in your app anywhere.
92+
- Push notifications to be able to notify your app users when an event occurs.
93+
- Machine learning to offer labeling, translation, facial recognition, object detection, smart reply, etc.
94+
95+
### Continuos Integration / Continuous Delivery (CI/CD)
96+
97+
This isn't necessarily a cloud technology, however, most cloud providers offer it as a service in their arsenal. Plus, it does require computers to do the required pipeline for CI/CD, and cloud computers are often used for this.
98+
99+
Continuous integration is the practice of merging code changes back to the main branch as often as possible. The developer's changes are validated by creating a build and running automated tests against the build. By doing so, you avoid integration challenges that can happen when waiting for release day to merge changes into the release branch.
100+
101+
Continuous integration puts a great emphasis on testing automation to check that the application is not broken whenever new commits are integrated into the main branch.
102+
103+
Usually, a machine is run to build and run the tests against any code merge request.
104+
105+
Continuous delivery is an extension of continuous integration since it automatically deploys all code changes to a staging and/or production environment after the build stage.
106+
107+
This means that on top of automated testing, you have an automated release process and you can deploy your application any time by clicking a button.
108+
109+
CD can also refer to another practice called continuous deployment which in turn goes one step further than continuous delivery. With this practice, every change that passes all stages of your production pipeline is released to your customers. There's no human intervention, and only a failed test will prevent a new change to be deployed to production. This practice accelerates the feedback loop with your customers and takes the pressure off the team as there isn't a Release Day anymore. Developers can focus on building software, and they see their work go live minutes after they've finished working on it.
110+
111+
CI/CD pipelines are part of larger DevOps practices that are often offered as a service by cloud providers. Examples are Github Actions, Jenkins, AWS CodePipeline and GCP Cloud Build.
112+
113+
## Conclusion
114+
115+
In this lesson, we only scratched the surface of cloud computing. It was meant to give you an overview of how you can use the cloud to serve your role as a backend engineer.
116+
117+
Most of the time, you aren't required to do cloud management as a backend engineer. However, you will need to know what makes the cloud and how it can be used so you can leverage it to your product development needs.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Iaas, PaaS, and SaaS
2+
3+
You may have read these terms in your journey to learn technologies of the web. They refer to cloud computing services offered to end-users in different formats. In this lesson, we will learn about what each of them is, and what are the differences between them. We will also cover how to choose one over the other in deploying your web application.
4+
5+
## Software as a Service
6+
7+
This is the most common offering in cloud services. It is to offer you a service that is connected to the cloud in the form of software. It is also known as cloud application services. Mostly, SaaS applications run directly through the web browser, which means we do not require to download and install these applications. They are mostly offered for a monthly or annual subscription model. Some examples of such services are:
8+
9+
- Google Apps (Workspaces: Docs, Spreadsheets, Drive)
10+
- Salesforce
11+
- Dropbox
12+
- Slack
13+
- Shopify
14+
15+
You might be better off relying on such services instead of creating and hosting your own. For example, if your organization is requiring a sort of data storage service, you can rely on Dropbox or Google Workspaces to serve your users. Most of these services offer APIs and libraries to integrate into your app and customize the use case.
16+
17+
## Platform as a Service
18+
19+
Cloud platform services, also known as Platform as a Service (PaaS), provide cloud components to certain software while being used mainly for applications. PaaS delivers a framework for developers that they can build upon and use to create customized applications. All servers, storage, and networking can be managed by the enterprise or a third-party provider while the developers can maintain management of the applications.
20+
21+
In PaaS, you won't need to manage instances, storage, networks, and the likes. The platform is built to run your application and offer you all the cloud components that you need. We can take Heroku as an example of PaaS.
22+
23+
With Heroku, using their platform or CLI you can start by creating an app, and defining where do you want your app to be located (region). Then you simply deploy your code on this app. Heroku will take care of provisioning the resources needed to run your app, the programming language runtime libraries, storage, and availability. It will scale your app based on need, and offer you a domain to access your application. It would also provide all the metrics and tools to help you ensure seamless operation of your software in the cloud as well as continuous integration and deployment. Any change you do in the source code, Heroku would pull the changes, and build your app replacing the current version without downtime.
24+
25+
Other examples of PaaS are AWS Elastic Beanstalk, Google App Engine, OpenShift, Vercel.
26+
27+
## Infrastructure as a Service
28+
29+
![IaaS vs PaaS vs SaaS](../assets/saas-paas-iaas-diagram.svg)
30+
_Image credits: [CloudFlare](https://www.cloudflare.com/learning/serverless/glossary/platform-as-a-service-paas/)_
31+
32+
IaaS offering is made of highly scalable and automated compute resources. IaaS is fully self-service for accessing and monitoring computers, networking, storage, and other services. IaaS allows businesses to purchase resources on-demand and as-needed instead of having to buy the hardware outright.
33+
34+
IaaS delivers cloud computing infrastructure, including servers, networks, operating systems, and storage, through virtualization technology. These cloud servers are typically provided to the organization through a dashboard or an API, giving IaaS clients complete control over the entire infrastructure. IaaS provides the same technologies and capabilities as a traditional on-premises datacenter without having to physically maintain or manage all of it. IaaS clients can still access their servers and storage directly, but it is all outsourced through a “virtual datacenter” in the cloud.
35+
36+
As opposed to SaaS or PaaS, using this offering will delegate the responsibility for managing aspects such as applications, runtime, operation systems, middleware, and data to you. However, providers of the IaaS manage the servers, hard drives, networking, virtualization, and storage. Some providers even offer more services beyond the virtualization layer, such as databases or message queues.
37+
38+
Let's take AWS as an example of an IaaS vendor. AWS offers a variety of computing machines with versatile processing power, memory, storage, and even GPU units. You may select your machine requirements, storage, specs, and they provision it for you. It's the vendor's responsibility to also ensure isolation of machines, physical security of resources, and seamless operation of the infrastructure.
39+
40+
Having access to a computing machine, the rest is left to you to prepare the resource to run your app.
41+
42+
Other examples of IaaS vendors: DigitalOcean, Linode, Google Compute Engine, Microsoft Azure.
43+
44+
## Conclusion
45+
46+
When time comes to deploy your app, you might get overwhelmed with all these different offerings out there, and there are still more like DB as a service, Functions as a service, AI as a service, etc... This lesson was intended to give you a quick overview of each of these top-level services.
47+
48+
If you've written your code, SaaS might not be the way forward. However, before jumping into paying for infrastructure, PaaS might be a good test for your application. It usually comes with suitable and competitive pricing compared to IaaS where you only pay for the resources you use. Other times, when high customizability is needed you could be better off renting machines and customizing your own infrastructure.
49+
50+
The next lesson will cover some examples and a guide on how to choose a service.

module7-cloud-computing/r3.1-how-to-choose/README.md

Whitespace-only changes.

0 commit comments

Comments
 (0)