· Hakan Çelik · Cloud / AWS · 2 dk okuma

How to Deploy a Serverless Application on AWS Lambda

There are many options for deploying a serverless application on AWS Lambda. Here are the ones I know of:

There are many options for deploying a serverless application on AWS Lambda. Here are the ones I know of:

In addition, while applying one of these, you can send your serverless application to AWS as a zip file or a Docker image and continue the deployment process that way.

I will be using a Docker image and SAM during the deploy process.

Let’s Deploy Our First Serverless Application with SAM

You can do this with just the 3 simple commands shown below. Of course, you must have already configured the necessary API keys and settings to connect to AWS.

$ sam init
$ sam build --use-container
$ sam deploy --guided

After these commands, a simple hello world API will be created. Docker files and a config file for SAM will be generated. SAM will build an image using the Dockerfile, push it to Amazon ECR, and then use that image to bring up your API and give you a link to test it. You can also attach a domain to it later using SAM.

If you want to test your application locally:

$ sam local start-api

That’s all you need to write.

How AWS Lambda Works

When Lambda invokes your function handler, the Lambda runtime passes two arguments to the function handler: event and context. The event object is a JSON-format object that contains information about the Lambda function and the data needed for the function to run. The context object contains information about your Lambda function such as function_name and version.

You can learn more about deployment by reading the next article.

Back to Blog

Related Posts

View All Posts »
Cloud Computing

Cloud Computing

Cloud · 4 dk

Cloud computing is the on-demand delivery of technology resources over the Internet with pay-as-you-go pricing. Instead of buying, owning, and maintaining physical data centers and servers, you can access technology services such as computing power, storage, and databases on an as-needed basis from a cloud provider like Amazon Web Services (AWS).