This is one of the simplest lambda function. It is equivalent to Hello World program.
To create your first program follow the below mentioned steps.
Login to AWS Console
Click Lambda under compute
Click create a Lambda Function
Skip select blueprint section
In configure trigger click on the dotted rectangle
Select API Gateway
Fill the required details as in the image. API Name is the name of your API you are going to build. Resource Pattern is the URL path which you can invoke your Lambda function. Select the required http method. In our example we choose GET. In AWS staging can be done in different ways like prod,dev ... It will help you to differentiate the functions from prod and dev. For demo purpose lets choose security as Open(Its not recommended in production).Click next
Configure the function as below Provide the function name , description of your function and runtime environment. We are choosing python as runtime environment.
Modify the code. Here we are printing the aws lambda event in cloudtrail which is free. It is also returning a string.
Provide Lambda function handler and role Make sure that the handler name should start with lambda_function.. Also create a new role for execute the lambda function. Select the amount of main memory required for execute your function. Select the default timeout and click next
Click create function
Now your function is ready to execute. Click the link provided by the aws When you click the link your lambda function will be executed in the background and you will get output in the browser.