Hi folks! Welcome to Day 8 of 100 Days of AWS🎯, where we will cover the complete AWS cloud from beginner to professional. Today, we will expand our horizons in the AWS cloud by understanding the AWS Serverless technology offerings and other various aspects of Serverless. Let’s get started🚀!
Day 11 Overview;
on Day 11 we discussed about one of the fundamental AWS compute service EC2. in which we have discussed about Instance Type, Amazon Machine Image and much more.
What is Serverless Computing;
Serverless computing is an application development model where you can build and deploy applications on third-party managed server infrastructure. All applications require servers to run. But in the serverless model, a cloud provider manages the routine work; they provision, scale, and maintain the underlying infrastructure. The cloud provider handles several tasks, such as operating system management, security patches, file system and capacity management, load balancing, monitoring, and logging. As a result, your developers can focus on application design and still receive the benefits of cost-effective, efficient, and massively scalable server infrastructure.
Why they are important;
In the early days of the internet, running a web application required purchasing and maintaining physical servers, typically housed in costly on-premises data centers. The cloud computing model emerged to allow users to create virtual servers, but customers still had to manage provisioning and scaling. To improve upon this, cloud providers introduced serverless technologies, which allow developers to run code and manage applications without worrying about infrastructure. The benefits of serverless computing include:
1. Increased Productivity: Developers can focus on building applications instead of managing configurations, leading to faster market delivery and more frequent updates.
2. Efficient Scalability: Serverless applications automatically scale from zero to peak demand without developers needing to plan for usage.
3. Lower Costs: Customers pay only for compute resources when their code is running, avoiding charges for idle resources and reducing waste from over-provisioning.
Use cases of Serverless Computing;
Serverless computing has many practical applications:
Stateless Application Development Serverless architecture is ideal for asynchronous, stateless applications that do not retain client data between sessions. Examples include chatbots and IoT applications. Coca-Cola, for instance, developed a mobile app for its touchless drink dispenser using AWS in just 100 days with AWS Lambda.
Batch Processing Serverless environments are well-suited for batch processing, which involves high-volume, repetitive data jobs like backups and sorting. Liberty Mutual, for example, consolidated its global lines of business into a centralized system called Financial Central Services (FCS) using AWS Step Functions, processing 100 million transactions in one run at the end of each month.
Real-Time Data Analytics Serverless computing enhances real-time data analysis by handling vast amounts of streaming data with low latency. Genentech uses AWS serverless functionality for clinical data analysis, allowing researchers to complete tasks in hours that previously took weeks.
Business Process Automation Serverless architecture can automate time-consuming business processes. Taco Bell created serverless applications using AWS that provided real-time menu and restaurant information to delivery partners, enabling quick adaptation to increased delivery demand during the COVID-19 pandemic.
How does Serverless Architecture work;
Applications consist of two main areas: the frontend and the backend. The frontend includes the elements users interact with, such as visual layout and buttons, while the backend involves functions like data storage and processing. For example, in a flight booking app, the frontend is the user interface where you select dates and request flight information. This request is sent to the backend, which queries the database and returns available flights. In serverless architecture, developers deploy backend code in the cloud. This model relies on event-driven architecture, where small, independent services communicate through events, making it easier to scale and update components.
Functions Functions are small units of code that perform specific tasks and require compute resources like CPU and memory. Cloud providers allocate these resources on-demand, creating a temporary environment for function execution. Events can trigger functions, such as a user clicking a button to retrieve database information.
Scaling Requests As the number of requests increases, the serverless platform allocates additional resources, allowing a single function to handle varying request loads without code changes. When requests cease, the infrastructure is deactivated to save costs, scaling down to zero when not in use.
Types of Serverless Architecture;
In serverless architecture, the cloud provider manages various backend tasks for your application. You can deploy custom code, and resources are dynamically allocated when your code runs. The cloud platform may also offer built-in backend functionalities.
Function as a Service (FaaS) FaaS allows developers to write custom backend functions and deploy them directly to the cloud. When a function is called, the provider runs it on an existing server or creates a new one if needed. These functions are called "serverless" as developers do not manage the execution process.
Backend as a Service (BaaS) BaaS provides developers with access to backend functions through APIs, which allow two software components to communicate. In a serverless environment, cloud vendors offer access to services like encryption, authentication, and databases, along with prewritten functions that can be called directly in your code.
what is the Serverless first Strategy;
Serverless architecture is recognized by the following tenets:
No server management
Pay-for-value services
Continuous scaling
Built-in fault tolerance
A serverless-first strategy prioritizes these tenets throughout an organization's applications, operations, and development cycles. A serverless developer or serverless-first company works to build using these tenets first and foremost.
But serverless computing isn't suitable for every workload. You can incorporate non-serverless technologies as supporting architecture as you need.
Is serverless architecture secure;
Most cloud vendors adopt a shared security model. The cloud provider is responsible for the security of the cloud, while customers are responsible for security in the cloud.
With serverless, the cloud provider manages many additional infrastructure layers, including operating systems and networking. Customers must follow the principles of least privilege and the best practices of securing a serverless application.
For example, in AWS FaaS solutions like AWS Lambda, you can secure each resource with granular permissions using familiar tools like AWS IAM Identity Center. This can help give you a robust security posture for your serverless applications.
AWS Serverless computing offerings;
Amazon Web Services (AWS) provides various solutions for serverless computing. The "Serverless on AWS" framework allows you to run code, manage data, and integrate applications without server management. With AWS serverless technologies, you enjoy automatic scaling, built-in high availability, and a pay-as-you-go billing model, freeing you from infrastructure tasks like capacity provisioning and patching. Serverless applications start with
AWS Lambda, an event-driven compute service that integrates with over 200 AWS services. Additional supporting services include: -
AWS Fargate for creating serverless applications with Amazon ECS and EKS.
Amazon Aurora Serverless for databases that automatically scale based on demand.
AWS AppSync for developing scalable GraphQL APIs.
AWS Lambda;
• AWS Lambda is a compute service that lets you run code without having to provision or manage servers
• Lambda is AWS’ serverless offering
• AWS manages the server maintenance, scaling, capacity provisioning, and logging
Benefits of Lambda
• No servers to manage
• No need for an infra team
• No patching/upgrading
• Faster development
• Auto scale to handle traffic spikes
• Pay for what you use
• Pay per invocation
• No extra cost during low traffic
Downsides of Lambda
• No local state
• Will need a separate database to store data that needs to persist Limited execution duration
• Function can run at most for 15 minutes
• Not good for long running tasks
• Cold starts
• Cold starts occur due to the time it takes to initialize and load the function
• SnapStart and provisioned concurrency helps mitigate cold starts
Lambda Pricing;
• Number of times function ran
• How long did it run for
• How much memory/cpu did it require
Day 12 wrap up;
In conclusion, serverless computing offers a transformative approach to application development by allowing developers to focus on code and functionality without the burden of managing server infrastructure. With AWS's serverless offerings like AWS Lambda, developers can benefit from increased productivity, efficient scalability, and cost savings. While there are some downsides, such as cold starts and limited execution duration, the advantages often outweigh these challenges for many use cases. As we continue to explore AWS technologies, understanding serverless architecture will be crucial for leveraging the full potential of cloud computing. Up next, we'll delve into container technology in AWS, further expanding our knowledge of cloud solutions.
Summary and Key Points;
AWS Lambda is a compute service that lets you run code without having to provision or manage servers
AWS manages the server maintenance, scaling, capacity provisioning, and logging
Use cases include file processing, mobile and web backend
Autoscales to handle spike in traffic
Pay per invocation, only pay for what you use
Up-next on Day 13;
- Container Technology in AWS