Serverless on AWS

Serverless on AWS

Are you excited to know about serverless architecture!! You can build and run applications without thinking about servers.

What is serverless?

Serverless is a cloud-native development model that allows you running code, managing data, and integrating applications, all without managing servers.

Serverless technologies feature automatic scaling, built-in high availability, and a pay-for-use billing model to increase agility and optimize costs. These technologies also eliminate infrastructure management tasks like capacity provisioning and patching, so you can focus on writing code that serves your customers. Serverless applications start with AWS Lambda, an event-driven compute service natively integrated with over 200 AWS services and software as a service (SaaS) applications.

You no longer have to provision, scale, and maintain servers to run your applications, databases, and storage systems.

Why use serverless architectures?

By using a serverless architecture, your developers can focus on their core product instead of worrying about managing and operating servers or runtimes, either in the cloud or on-premises. This reduced overhead lets developers reclaim time and energy that can be spent on developing great products which scale and that are reliable.


Here are ?benefits to using a serverless architecture?for your project.

The leading advantage is that your developers can focus their attention on product development. They no longer have to account for managing and operating servers. Components like network configuration or the physical security of your servers are handled by the vendor rather than your team.

Serverless is more efficient

A serverless architecture means that you pay per request. If you had a traditional server, you’d keep it running at all times. With a serverless architecture, you’re only charged when the server’s used. That means there is less waste generated as well.

Serverless is easy to deploy

If you need to spin up an app fast, serverless might be your solution. Instead of weeks and months to deploy an app, you can do it within hours and days. The reason behind this is that you don’t have to concern yourself with infrastructure. You can focus on the code and release it immediately. Scalability is automatic and you don’t have to worry about any provisioning needs.

Low cost

Going serverless is a great way of?cutting cost. That’s because you’re outsourcing the responsibilities of managing servers, databases, and some logic. Besides the actual cost, serverless takes less computing power and human resources.you can focus on the server-side code that matters. There are situations where the cost isn’t that much cheaper, but it’ll depend on your use case.

Better scalability

Going with a serverless architecture allows you to roll with the punches. If your app succeeds and grows, it’ll be easy to stage changes that accommodate the growth.

Quick deployments and updates are possible

Developers can very quickly upload bits of code and release a new product. They can upload code all at once or one function at a time, since the application is not a single monolithic stack but rather a collection of functions provisioned by the vendor. This also makes it possible to quickly update, patch, fix, or add new features to an application. It is not necessary to make changes to the whole application; instead, developers can update the application one function at a time.

Now we are going deploy Serverless Architecture

Lambda function: AWS Lambda is a compute service that lets you run code without provisioning or managing servers.

Dynamo DB: Is aligned with the values of Serverless applications: automatic scaling according to your application load, pay-per-what-you-use pricing, easy to get started with, and no servers to manage.

API Gateway: Is the piece that ties together Serverless functions and API definitions.

S3: To store application data that doesn’t fit into a database.

IAM: Interact with other AWS services and resources in your account.

CloudWatch: Application Insights helps you monitor the AWS resources in your applications to help identify potential issues.


Required pre-requisite to deploy Serverless Architecture

Update instance/System

sudo apt update        

Install NodeJS

sudo apt install nodejs        

Check versions

Install Node version through nvm

curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash        
nvm install 16.0.0        

Install Serverless

npm install -g serverless        

run the serverless command:

serverless        

As per requirement of project you can choose any serverless project as shown below:

This image upload for example purpose.

In this project we will clone the GitHub repo

https://github.com/LondheShubham153/aws-node-http-api-project.git        

use git checkout for dev branch

Now we have create an account on serverless:

https://www.serverless.com/

Click on create app to select option as per your project requirement

Click on Existing Project

Run the following command

Run this command and select create a new app

Then you can select yes option

Now your app can deploy successfully and you will get the output like this

In above images after deployment you will see GET,POST and PUT requests.

Now we have to copy these URL's and run into the Postman tool:

What is Postman?

Postman is an API platform for building and using APIs. Postman simplifies each step of the API lifecycle and streamlines collaboration so you can create better APIs—faster.

You have to create an account on https://www.postman.com/

After creating an account we have run the URL's in postman tool:

GET request- This operation reads information from a record in the database. PUT request- This operation changes a record's information in the database. POST request- This operation creates a new record in the database.

GET request Output:

Put request OUTPUT

Before sending the POST request we have to go to Body section and select raw to write JSON query as you see below ss.

Before sending the PUT request we have to go to Body section and select raw to write JSON query as you see below ss.

for JSON query you have to go to AWS DynamoDB

Click on Tables -> Name -> Explore items -> Items returned -> id (string)

click on id you will get the JSON view and paste it into Body and raw section and put that id at the end of the PUT url:

Now your application will be accessible from serverless dashboard

Now you can view your application stack on CloudFormation

CloudFormation -> Stacks -> Stack info -> Stack ID -> Template -> View in Designer

You will get flow chart of your entire project

For more DevOps related project you can reach out to me https://www.dhirubhai.net/in/aashish-r-59397bb8/

Happy Learning!!









要查看或添加评论,请登录

Aashish R.的更多文章

  • TerraWeek Day 7 - Advanced Terraform Topics

    TerraWeek Day 7 - Advanced Terraform Topics

    Welcome to the advanced TerraWeek challenge! In this phase, we will dive into advanced topics that will enhance your…

  • TerraWeek Day 6: Terraform Providers

    TerraWeek Day 6: Terraform Providers

    Introduction In this blog, we will explore the concept of Terraform providers, compare major cloud providers such as…

    2 条评论
  • TerraWeek Day 5

    TerraWeek Day 5

    Task 1: What are modules in Terraform and why do we need modules in Terraform? You already write modules Even when you…

  • Terraweek Day 4 Knowledge about Terraform state, Local and Remote configurations

    Terraweek Day 4 Knowledge about Terraform state, Local and Remote configurations

    Task 1:The importance of Terraform state in managing infrastructure The primary purpose of Terraform state is to store…

  • TerraWeek Day 3

    TerraWeek Day 3

    Task 1:Create a Terraform configuration file to define a resource of AWS EC2 instance, Azure storage account, Google…

    1 条评论
  • HashiCorp Configuration language(HCL)

    HashiCorp Configuration language(HCL)

    #TerraWeekChallenge DAY 2 Terraform Syntax , Block parameter and arguments ,variable , data types , expressions , .tf…

  • Deployment of a Microservices Application on K8s- Do MongoDB App Deployment

    Deployment of a Microservices Application on K8s- Do MongoDB App Deployment

    Kubernetes, also known as K8s, is an open-source system for automating deployment, scaling, and management of…

  • How to Install terraform on Ubuntu server.

    How to Install terraform on Ubuntu server.

    What is Terraform? HashiCorp Terraform is an infrastructure as code tool that lets you define both cloud and on-prem…

    1 条评论
  • Deploying Reddit Copy on Kubernetes Cluster using Ingress.

    Deploying Reddit Copy on Kubernetes Cluster using Ingress.

    Prerequisites: ? EC2 (AMI- Ubuntu, Type- t2.medium) ? Docker ? Minikube ? Kubectl Follow below steps for install all…

    5 条评论

社区洞察

其他会员也浏览了