top of page

Creating AWS Lambda Function Via Console


Before creating the AWS Lambda Function(I will use just lambda for the rest of the post), I want to provide some details about lambda.

What is Lambda?

Lambda is a compute service that runs your code. This is known as serverless infrastructure that removes the need for users to manage any servers and it can automate operational procedures. You do not need to think about management server and scalability etc. Because AWS does this for you.

What languages does Lambda support?

Official Lambda supported languages:

  • C#

  • Go

  • Java

  • Node.js

  • PowerShell

  • Python

  • Ruby

How can we create Lambda?

We can create lambdas using different ways. But in this post, I will focus that creating with AWS management console.

For creating lambda, unfortunately, you need to have an AWS account at the first.

I assume you have an AWS account and I continue to the next process. I’ll try to explain the function creation process in 6 steps.

Step 1: Log in

Log in to the AWS Management Console;



Step 2: Find Lambda main page

If you success log in then you will find the management console main page. But we need to create lambda functions. That’s why please type lambda in the search area of the main page;



Or you can also click Lambda in the dashboard;



Then you will be directed to the Lambda page. On that page you will see a screen as follows;



Step 3: Create a function

On the dashboard page, please find Create Function which is coloured orange and click it.

Now you are on the creating functions configuration page;


On this page, the console will ask you for some information about your function(the italics were quoted from the AWS)

Function name: Enter a name that describes the purpose of your function. For example hello-function

Runtime info: Choose the language to use to write your function.

Note that the console code editor supports only Node.js, Python, and Ruby.

In this example, I chose Node.js 14.x version

Architecture: Choose the instruction set architecture you want for your function code.

I chose x86_64 architecture

Permissions; By default, Lambda will create an execution role with permissions to upload logs to Amazon CloudWatch Logs. You can customize this default role later when adding triggers.

Also, you can change the default execution role on the same page;



If you chose the first one, then you will create a new role for that. But in this example, I chose the second one. Because I had the sample role.


If you need the add or edit advance settings you can click advanced settings;


Step 4: Develop the function

If your configuration has finished then click create a function which is located at the right bottom of the screen.

And you will find a screen that you can develop with your chosen language(Node.js, Ruby or Python).


Now you can develop your lambda function is in a created class(index.js). At the first, it is created very simple function by default;

const response = {

statusCode: 200,

body: JSON.stringify(‘Hello from Lambda!’),

};

return response;

};

Step 5: Test your function

After(or before if you have TDD approach) development, you can test your functions. But first, you must configure your test event. If you do not have it yet, please create a new one.



After creating test-event as above and deploying the latest changes, click the test button and you will see the response of hello-function is as;

Response { “statusCode”: 200, “body”: “\”Hello from Lambda!\”” }



Step 6: Deploy your function

If all processes are okay as you want, then you can deploy your lambda.

Congratulations! you have created a successful lambda function.

Also, in the next post, I want to talk about how we create lambda functions with typescript and vscode.

Stay tuned :)

Thank you for reading.

Hope it helps…


Halil İbrahim Ateş

Senior Software Engineer

Group 7.png
bottom of page