How to create an AWS Lambda function
AWS Lambda significantly accelerates and simplifies how developers can develop and maintain their code. AWS Lambda eliminates the need for developer/cloud operations team to manage any servers. This is known as serverless infrastructure.
Based on the load lambda can be upscaled. Another great feature about serverless is that you pay only when you use.
AWS lambda's main resources are Lambda functions, which contain a granular piece of code that performs a specific task. To deploy a Lambda function, users upload source code and configure parameters, such as the following
- Triggers
- Permission
- Database Proxy
- Memory
- Virtual Private Cloud (VPC)
- Concurrency
- Elastic File System
- Error Handling
We will be using AWS console for creating the lambda.
Step 1
An easy way to create an AWS Lambda function is through the Create function button on the Lambda console.
Step 2
After clicking the Create function button, the next screen shows several options for the function's code.
- Author from scratch. Create your own code from a Hello World example.
- Use a blueprint. AWS' code blueprints include built-in AWS integrations with other services and common uses. These blueprints can save a significant amount of time when developing Lambda functions.
- Container image. Container images stored in Amazon Elastic Container Registry are also useful to launch new Lambda functions.
- Browse serverless app repository. In AWS Serverless Application Repository, users can find various helpful products.
For this example, let's select Author from scratch to create our function.
Step 3
Let's proceed to create a Lambda function built from scratch. The basic configuration fields include function name, runtime and permissions. Supported runtimes include programming languages such as Node.js, Go, Python, Ruby, Java, C# and .NET. Lambda also supports custom runtimes, which a developer can implement in any language that can be compiled in the Amazon Linux OS
By default, lambda will create an execution role with permission to upload logs to amazon cloud watch logs. You can customize this default role later when adding triggers.
Click on Create Function.
Lambda is ready to be executed.
Great blog to start with aws lambda
ReplyDelete