CLF-C02 Recap
Serverless Computing

Serverless Computing

Amazon EC2 is a service that lets you run virtual servers in the cloud. If you have applications that you want to run in Amazon EC2, you must do the following;

  1. Provision instances (virtual servers)
  2. Upload your code
  3. Continue to manage the instances while your application is running

4CCw_UNETnygsP1DRM58WQ_b8c1c87562fc4cd3adcb3bd08bece012_Serverless-Computing.png

The term “serverless’ means that your code runs on servers, but you do not need to provision or manage these servers. With serverless computing, you can focus more on innovating new products and features instead of maintaining servers.

Another benefit of serverless computing is the flexibility to scale serverless applications automatically. Serverless computing can adjust the applications’ capacity by modifying the units of consumptions, such as throughput and memory.

An AWS service for serverless computing is AWS Lambda.

AWS Lambda

AWS Lambda is a service that lets you run code without needing to provision or manage servers.

While using AWS Lambda, you pay only for the compute time that you consume. Charges apply only when your code is running. You can also run code for virtually any type of application or backend service, all with zero administration.

For example, a simple Lambda function might involve automatically resizing uploaded images to the Aws Cloud. In this case, the function triggers when uploading a new image.

How AWS Lambda works

aFDLTd29SHSQy03dvZh02w_14639fa7da6e4e7f895ffb6720671934_Lambda.png

  1. You upload your code to Lambda.
  2. You set your code to trigger from an event source, such as AWS services, mobile applications, or HTTP endpoints.
  3. Lambda runs your code only when triggered.
  4. You pay only for the compute time that you use. Resizing images application, for instance, you would pay only for the compute time that you use when uploading new images. Uploading the images triggers Lambda to run code for the image resizing function.

Containers

In AWS, you can also build and run containerized applications.

Containers provide you with a standard way to package your applications’ code and dependencies into a single object. You can also use containers for processes and workflows in which there are essential requirements for security, reliability, and scalability.

Example: One host with multiple containers

hP-3PaWVR1a_tz2llbdWRQ_3616a8a1e54545c3ab4e42469c4559e2_Containers1.png

Suppose that a company’s application developer has an environment on their computer that is different form the environment on the computers used by the IT operations staff. The developer wants to ensure that the application’s environment remains consistent regardless of deployment, so they use a containerized approach. This helps to reduce time spent debugging applications and diagnosing differences in computing environments.

Example: Tens of hosts with hundreds of containers

eJ0dRbpYQbmdHUW6WIG5DQ_75fdd82e8d014bef831d39b0122ed901_Containers2.png

When running containerized applications, it’s important to consider scalability. Suppose that instead of a single host with multiple containers, you have to manage tens of hosts with hundreds of containers. Alternatively, you have to manage possibly hundreds of hosts with thousands of containers. At a large scale, imagine how much time it might take for you to monitor memory usage, security, logging, and so on.

Amazon Elastic Container Service (Amazon ECS)

Amazon Elastic Container Service (Amazon ECS) is a highly scalable, high-performance containers management system that enables you to run and scale containerized applications on AWS.

Amazon ECS supports Docker containers. Docker is a software platform that enables you to build, test, and deploy applications quickly. AWS supports the use of open-source Docker Community Edition and subscription-based Docker Enterprise Edition. With Amazon ECS, you can use API calls to launch and stop Docker-enabled applications.