Serverless Computing

Aaryan
IoT Lab KIIT
Published in
7 min readJul 11, 2021

--

When I first heard about Serverless computing, the word itself perplexed me. I began to wonder where the code ran, but after reading more about it, I discovered that the term “serverless computing” is misleading because serverless computing uses servers as well. Now we all have the same question: what is the difference between serverless computing and server-based computing? So, with serverless computing, developers don’t have to worry about managing and inspecting servers because the service provider will do everything for them, leaving them free to focus on developing code.

Defining Serverless

Serverless computing is a way of offering on-demand backend services. Although servers are still needed, a firm that uses serverless backend services is charged based on use rather than a predetermined amount of bandwidth or number of servers.

Developers that use serverless computing don’t have to manage servers and can only design and operate apps. The service providers maintain and expand the infrastructure necessary to run the code for you automatically.

The developers must only pay for the services they utilize.

HOW DOES SERVERLESS WORK?

The Functions as a Service (FaaS) paradigm underpins serverless architecture. Event-driven, scalable, and completely managed by cloud providers, FaaS is also known as Compute as a Service (CaaS).

A function is created by developers, and it usually performs a specific purpose inside the application code. The developer then creates an event, such as an HTTP request, which instructs the service provider to run the function. After the function was completed, the service provider forwarded the outcome to the client for evaluation by the users.

Advantages Of Serverless Computing

  1. It’s not necessary to handle any servers, operating systems, software, or hardware. Concentrate solely on the logic of the application.
  2. You just have to pay for the services that you utilize. There is no need to pay for capacity that isn’t being used, resulting in cost savings.
  3. Serverless programs can scale on their own. There’s no need to construct any sort of scalable infrastructure.

Serverless Cloud Providers

  1. AWS Lambda
  2. Google Cloud Platform
  3. Microsoft Azure Functions
  4. IBM OpenWhisk
  5. Oracle
  6. Alibaba Function Compute
  7. Auth0 Webtask

Now let us talk about AWS lambda which is Serverless Cloud Provider

AWS lambda

AWS Lambda is a serverless computing service that allows you to run code without having to deploy or manage servers, write workload-aware cluster scaling logic, keep event integrations up to date, or manage runtimes. You can execute code for almost any sort of application or backend service using Lambda, and you don’t have to worry about management. Simply submit your code as a ZIP file or container image, and Lambda will assign compute execution power and run your code based on the incoming request or event, at any scale. You may use over 200 AWS services and SaaS apps to trigger your code, or you can call it directly from any web or mobile app. You may develop Lambda functions in whatever language you choose (Node.js, Python, Go, Java, and more) and build, test, and deploy them using both serverless and container tools like AWS SAM or Docker CLI.

Important keyword used in lambda

Function:- A function is a resource that executes your code. A function consists of event-processing code and runtime for passing requests and replies between Lambda and the function code.

Runtime:-Lambda runtimes enable the execution of functions written in different languages in the same execution environment. You configure your function to use a runtime that matches your programming language.

Event: -An event is a JSON formatted document that contains data for a function to process.

Event Source/Trigger:-An AWS service such as Amazon SNS, or a custom service that triggers your function and executes its logic.

Downstream Resource:-An AWS Service, such as DynamoDB tables or S3 Buckets, etc. Your lambda function is called once it is triggered.

Concurrency-The number of requests served by your function at any given time.

Characteristics of AWS Lambda

  • Integrate with other AWS services: AWS Lambda allows us to add custom logic to AWS services
  • Automatic Scaling: AWS Lambda runs your code just when it’s required and scales up and down automatically, from a few requests per day to thousands per second.
  • AWS lambda maintain everything automatically you don’t have to worry about an update of OS and increasing of server, everything is taken care of by AWS lambda
  • To protect your code from individual machine or data center facility failures, AWS Lambda maintains computing capacity across multiple Availability Zones in each region.

Serverless security

Serverless architectures are sometimes mistakenly assumed to be safer than traditional infrastructures. Because there are many more components in the program, serverless architecture provides a significantly larger attack surface than traditional design.

According to Protego, the “solution to secure serverless apps is a close partnership between developers, DevOps, and AppSec, also known as DevSecOps. Find the balance where developers don’t own security, but they aren’t absolved from responsibility either. Take steps to make it everyone’s problem. Create cross-functional teams and work towards tight integration between security specialists and development teams. Collaborate so your organization can resolve security risks at the speed of serverless.

Firewalls, intrusion detection and prevention systems, and instrumentation agents of any kind have no place in a serverless architecture. Rather than network scanning and access control lists, the focus of security is on permission, behavioral protection, and robust code.

serverless AWS security services -

  1. Amazon Cognito:-Amazon Cognito is a fully managed, scalable, and cost-effective sign-up/sign-in service from Amazon. User authentication, authorization, and administration are all possible in online and mobile apps. A user pool token can be swapped for temporary AWS credentials by an authorized user or an anonymous guest utilizing an identity pool.
  2. AWS Key Management Service:-The Amazon Web Services Key Management Service (KMS) is a fully managed service that lets you produce and manage security keys. Many AWS services are linked with KMS to make encryption handling easier across your application. It allows developers to quickly add encryption capabilities to their applications using the service APIs or the AWS Encryption SDK.

The drawback of serverless computing

1)Third-party API systems can create a variety of issues, including system unavailability, forced upgrades, loss of functionality, unanticipated restrictions, and pricing changes. Vendor control, multitenancy difficulties, vendor lock-in, and security concerns are just a few of the challenges that APIs may create.

2)Debugging distributed systems is difficult, because determining the root cause generally necessitates access to a large number of relevant metrics. Debugging a serverless function is a complex and time-consuming task.

3)Implementation flaws: Compared to other architectural approaches, serverless programs rely heavily on integration testing. There are additional issues with deployment, versioning, and packaging. Because there is no idea of versioned apps, some users will be unable to do an atomic rollback. It’s possible that you’ll need to stop the event source that’s triggering the functions, deploy the complete group, and then re-enable the event source.

--

--