Deploy-a-Highly-Available-web-application-Combining-Server-Serverless-Concepts-using-Hands-on-Labs

How to Deploy a Highly Available Web Application Combining Server & Serverless Concepts| Hands on Labs

Serverless Architectures on AWS helps to build, secure, and manage the serverless architectures to fuel the most demanding web applications and mobile applications.

In this article, we’ll cover what is serverless architecture, how serverless architecture works, serverless architecture use cases, and how to build serverless architecture with the help of AWS Services in hands-on labs.

This hands-on labs project is designed for individuals working in the roles of cloud architects and cloud developers. It is also suitable for those who are preparing to obtain the AWS Certified Developer Associate certification.

Let’s dig in!

Overview of Serverless Architecture 

First, we have to understand the serverless architecture meaning before diving into depth.

A serverless architecture is a method of designing and operating applications and services without the need to handle infrastructure management. While your application still operates on servers, all the tasks related to server management are handled by Amazon Web Services.

It means you no longer need to handle activities like provisioning, scaling, and maintaining servers to support your applications, databases, and storage systems. For more information on serverless computing, you can explore this link.

The advantages of utilizing a serverless architecture are that it allows your developers to concentrate on their primary product development without being burdened by the complexities of server and runtime management, whether in the cloud or on-premises. 

This reduction in administrative overhead empowers developers to dedicate their time and effort to creating exceptional, scalable, and dependable products.

How Serverless Architecture Works?

Servers are mainly used for communication and business logic accessing purposes but server management requires a considerable amount of time and resources. Software teams need to take care of server hardware, software updates, and backups in failure cases. 

By the adoption of the serverless architecture, the software developers can offload their responsibilities to third-party service providers, making them only focus on the application code scripting process.

One of the widely used serverless architectures is called Function as a Service (FaaS). In FaaS, developers create their application code as a series of small, specific functions. Each function has a designated task, and they are triggered by events like receiving an email or an HTTP request

After going through the usual testing phases, developers deploy these functions, along with their triggers, to their cloud provider’s account. 

When a function is triggered, the cloud provider does the work of running the function. It might either run the function on an existing server or, if there isn’t one available, create a new server to handle the function’s execution. This whole execution process is hidden from the developers, who primarily focus on writing and deploying their application code.

What is AWS Managed Services?

AWS Managed Services offers a collection of services and tools designed to automate the management of infrastructure tasks for Amazon Web Services (AWS) deployments. This service is primarily geared towards large enterprises seeking a streamlined approach for migrating their on-premises workloads to the public cloud and effectively managing those workloads post-migration.

With AWS Managed Services, enterprises can automate various cloud management activities, such as handling patches, implementing changes, provisioning resources, managing user access, monitoring incidents, and ensuring backup and recovery.

One notable feature of AWS Managed Services is the provision of a dedicated Cloud Service Delivery Manager along with enterprise-level AWS Support coverage. This ensures that businesses receive the necessary support and expertise to manage their AWS infrastructure efficiently.

Steps to Build Serverless Architecture with AWS-Managed Services

To carry out the serverless architecture building process in a successful manner, you have to follow the below steps:

Step 1: Sign in to the AWS Management Console

  • On the Whizlabs hands-on lab page, click on the open console button to be directed to the AWS Console page. 
  • Now you can see the sign-in page and you need to enter the username and password in the console. You can copy those from the AWS console page. It is advisable not to make any changes to the account ID.
  • After keying in the credentials, click on the sign-in button.

Step 2: Create a DynamoDB Table

  • Access the DynamoDB service by clicking on “Services” and selecting it under the “Database” section.
  • In the DynamoDB menu, choose “Tables,” and then click “Create Table.”
  • Configure the table as follows:
    • Table Name: Enter “store_server_details.”
    • Partition Key: Set “ID” as the key and choose the data type “String.”
  • Keep other options at their default settings.
  • Click Create Table and wait for the table to be created.

store-server-details

Step 3: Create an SNS Topic and Subscription

  • Ensure you’re in the US East (N. Virginia) Region.
  • Access the Simple Notification Service (SNS) via Services under the “Application Integration” section.
  • In the SNS menu, click Topics and then “Create Topic.”
  • Configure the topic as follows:
    • Type: Choose “Standard.”
    • Name: Enter “Invoke_upload_to_table_lambda.”
    • Display name (optional): Type “Email Alert – Serverless.”

details-creating-topic

  • Leave other options as default and click “Create Topic.”
  • Copy the SNS Topic ARN for later use.
  • Scroll down to Create Subscription, and set the following:
    • Protocol: Select “Email.”
    • Endpoint: Enter your working email address.
  • Leave other options as default and create the subscription.

details-2-arn

  • You will receive a confirmation email; click on the confirmation link.

confirmation-link

Step 4: Create Two Lambda Functions

  • Go to the Lambda service by clicking on “Services” under the “Compute” section.
  • Ignore any error messages in the Lambda console.
  • Click “Create Function.”
  • Choose to create the first function, “upload_data_to_DynamoDB,” using Python 3.9 runtime.
  • Select an existing role, “Lambda_execution_role_<RANDOMNUMBER>.”
  • Select “Create Function.”
  • Open the “upload_data_to_DynamoDB.py” file and paste its code into the Lambda console. Ensure the table name in the code matches your DynamoDB table if it’s different.

store-server-details

  • Choose “Deploy” to save the code.
  • Create the second function, “send_email_notification,” with similar steps.
  • Add a DynamoDB trigger for the “store_server_details” table.

trigger-configuration

  • Open the “send_email_notification.py” file, paste the code, and provide your SNS Topic ARN.
  • Deploy the code.

Step 5: Create an S3 Bucket and Configure Events

  • Access the S3 service from the “Services” menu under “Storage.”
  • Create a new S3 bucket with a unique name, such as “whizserver-logs-RANDOMNUMBER,” in the US East (N. Virginia) region.

whizlabs-access

  • Click on the  bucket and navigate to “Properties.”
  • Set up an event notification named “upload_to_table” to trigger the “upload_data_to_DynamoDB” Lambda function.

event-notifications

Step 6: Upload CSV Objects to S3 Bucket

Now you have to download a sample CSV file and upload it to your S3 bucket.

  • Access the S3 service from the “Services” menu under the “Storage” section.
  • Select the created bucket.
  • Click “Upload” and add the “server-logs.csv” file from your local storage.

Step 7: View Data on the Dashboard Webpage

  • Access AWS Cognito and copy the Identity Pool ID.

identity-pools

  • Open the dashboard webpage using the provided link and replace COGNITO_ID and TABLE_NAME with your Identity Pool ID and DynamoDB table name.

scan-data-1

  • Verify the dashboard.

scan-data-2

Step 8: Check for Critical Email Notification

Check your email inbox for critical notifications sent by the “send_email_notification” Lambda function.

server-alert

Step 9: Validation of the Lab

  • Finally, click the “Validation” button to confirm the successful completion of the lab steps.

Serverless Architecture Use Cases

Serverless-Architecture-Use-Cases

 

Serverless architecture offers various practical applications:

  1. Media Processing: Serverless architecture is ideal for creating multimedia services with improved performance. It can be used to transcode videos for different devices or resize images. Users can upload files, and the desired processing can be triggered in response to these uploads. It’s also useful for implementing image processing, particularly in applications that involve images as input, such as document verification, image-based search, or payment methods.
  2. Event-Driven Applications: Event-driven applications are a common and valuable use case for serverless architecture. These applications respond to changes or updates in the system’s state, providing agility and swift responsiveness. 

Serverless architecture runs applications in response to event triggers, which can include HTTP triggers, Object Storage Service (OSS) events, RDS triggers, MNS triggers, Table store triggers, or time triggers. For instance, you can use Alibaba Cloud Function Compute (FC) triggered by an OSS event (like a file upload) to send notifications via email or messages.

  1. Building APIs: Serverless architecture simplifies the creation of REST APIs. You can develop REST APIs by setting up a basic web framework, writing code to fetch data from the backend, and using a rendering library to present the data. Alibaba API Gateway takes care of much of the infrastructure, allowing developers to focus on coding.
  2. Chatbots: Chatbots are another compelling use of serverless technology. They can be implemented to handle user queries, such as providing order status updates and answering frequently asked questions. Serverless chatbots operate on a pay-as-you-go pricing model, meaning you only pay for the resources you use. 

Chatbots enhance customer engagement by providing instant, value-driven support. Automation can be integrated into chatbots, enabling tasks like checking an account’s status and sending messages or emails to customers when necessary.

  1. Webhooks: If your application needs to communicate with external SaaS (Software as a Service) services and receive notifications to perform tasks, you can implement webhook HTTP endpoints using serverless architecture. 

Webhooks built with a serverless approach offer low overhead, and automatic scaling, and require minimal maintenance. Alibaba Cloud log service can be used to manage these webhooks efficiently.

Also Read : How to Deploy Static Feedback with 100% Serverless Architecture AWS

FAQs

Which AWS service would be considered serverless?

Serverless architecture AWS Lambda is considered a serverless and event-driven computing service that helps to run code virtually in the application or backend service without managing servers. 

How to build serverless architecture in AWS?

You have the option to construct a serverless web application by combining various AWS services. These services are entirely managed, eliminating the need for server provisioning or management. Your primary tasks involve configuring these services to work in tandem and uploading your application code to AWS Lambda, which is a serverless computing service.

What are the benefits of Serverless architecture?

Serverless architecture brings several advantages, including enhanced scalability, increased flexibility, faster time-to-market, and cost savings. Developers using serverless architectures are freed from the complexities of buying, setting up, and overseeing backend servers. By following AWS Serverless Architecture best practices, the servers can operate efficiently.

List out some serverless architecture examples.

Data integration pipelines and ML model training are examples of serverless architecture.

Which AWS Services fall under serverless architecture?

Some of the popular AWS Serverless Services such as:

  • AWS Lambda
  • AWS Fargate
  • Amazon SNS
  • Amazon SQS
  • AWS DynamoDB
  • Amazon Aurora
  • AWS Step Functions
  • Amazon API Gateway

Conclusion

Hope this blog covers the AWS Serverless Architecture tutorial in a detailed way and how to build Serverless Architecture with AWS-managed services.

If you want to know more about the Serverless architecture of AWS, take a try on our AWS Sandboxes.

About Vidhya Boopathi

Vidhya is a Senior Digital Marketing Executive with 5 years of experience. She is skilled in content creation, marketing strategy, digital marketing, social media, website design, and creative team management. Vidhya pursued her Master's Degree in computer science engineering, making her an expert in all things digital. She always looking for new and innovative ways to reach her target audience.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top