AWS Lambda For Beginners

March 21, 2022 | Comments(1) |

TABLE OF CONTENT

1. Introduction to AWS Lambda
2. What does AWS Lambda Work
3. Creating your first Lambda Function
4. Conclusion
5. About CloudThat
6. FAQs

1. Introduction to AWS Lambda

AWS Lambda is a compute service that lets you run code without provisioning or managing servers. Instead, Lambda runs your code on a high-availability compute infrastructure and performs all of the administration of the compute resources, including server and operating system maintenance, capacity provisioning and automatic scaling, code monitoring, and logging. As a result, you can run code for virtually any application or back-end service with Lambda. All you need to do is supply your code in one of the languages that Lambda supports.

AWS Lambda supports the following languages for now:

  • Java
  • Python
  • C#
  • js
  • Go
  • PowerShell
  • Ruby

2. How does AWS Lambda work?

AWS Lambda

Developers can start using AWS Lambda services by coding directly in Lambda’s code editor, mentioning the conditions that trigger the code, or directly uploading the code.

The code executed on Lambda run time environment is called a Lambda Function.

First of all, you need to create a function and add basic information, such as which programming language to use.

Then you need to decide whether you want to write the code directly or upload the code in the supported programming language in a zip file.

Once the code is uploaded, the service will handle all the patching, capacity scaling, and administration.

The code runs when the trigger invokes the lambda function. Thus, we need to trigger the lambda function with an external AWS service. Ex. S3 bucket

Now, Lambda is ready to trigger your function automatically when an event occurs. It will run the code when the trigger event is called and manage and monitor the servers for you.

3. Creating your first Lambda Function

  • Go to AWS console and search for Lambda
    AWS Lambda
  • Select Lambda and then click on create a function
    AWS Lambda
  • Now, you have many options. I will go with Author from scratch
    AWS Lambda
  • Enter the function name and select Python 3.9 which you want to use for this function
    AWS Lambda
  • Fill in the details as required and click on create the function
    AWS Lambda
  • Now your function is created
    AWS Lambda
  • You can write your code or can copy-paste the following code
    AWS Lambda
  • Use the test button on the top to test your code after deploying it
    AWS Lambda
  • Create the test as follows
    AWS Lambda
  • Click on Save and then Test.
  • Go to the execution tab and see the result
    AWS Lambda

Now you have your first AWS Lambda code exected.

4. Conclusion

Lambda is FaaS(Function-as-a-service) by AWS. It also provides a runtime API that helps run functions written in other (native) programming languages. It is a serverless, event-driven compute platform that operates whenever an event occurs. It is auto-scalable, efficiently uses resources, and is managed by AWS.

5. About CloudThat

We here at CloudThat are the official AWS (Amazon Web Services) Advanced Consulting Partner and Training partner and Microsoft gold partner, helping people develop knowledge on cloud and help their businesses aim for higher goals using best in industry cloud computing practices and expertise. We are on a mission to build a robust cloud computing ecosystem by disseminating knowledge on technological intricacies within the cloud space. Our blogs, webinars, case studies, and white papers enable all the stakeholders in the cloud computing sphere.

Feel free to drop a comment or any queries you have regarding AWS Lambda, serverless architecture, consulting and we will get back to you quickly. You can go through our Expert Advisory page and Managed Services Package for CloudThat‘s offerings.

6. FAQs

  1. Can I create a Lambda function for free?

Yes. You can create your Lambda function in the free tier of AWS.

  1. Are environment variables supported by AWS Lambda?

Yes. Environment variables can be easily created and modified from AWS Lambda console, CLI, or SDKs.

  1. Is there any way to monitor a Lambda Function?

Yes. AWS Lambda Function can be monitored through Amazon CloudWatch.


One Response to “AWS Lambda For Beginners”

Leave a Reply