官术网_书友最值得收藏!

How AWS Lambda works

You need to write a function, which will be executed by AWS Lambda on your behalf.

AWS Lambda is implemented on a container-based model that supports a runtime environment and executes the code as per the Lambda function configuration. When the Lambda function is invoked, it launches the container (an execution environment) based on the AWS Lambda configuration and enables the basic runtime environment, which is required to execute the code.

Let's start with some practical work:

  1. To create a Lambda function, you must have an AWS account. If you don't have an AWS account, then you need to sign up on AWS (https://aws.amazon.com/) by providing some basic contact and payment information, as it's essential information required by Amazon.
  2. Go to the Lambda home page (https://console.aws.amazon.com/lambda/home). Click on the Create a function button. This will redirect you to the Create function page, which is described in the next step. Take a look at the following screenshot:
  1. AWS provides three different options to create a Lambda function, such as Author from scratch, Blueprints, and Serverless Application Repository. We will be using the Blueprint option, which has some built-in Lambda functions. We can choose these blueprints based on our requirements from the search bar, where you can filter by tag and attributes or search by keywords:
  1. Let's choose a hello-world-python blueprint. Once we choose the blueprint, we need to set up the basic information about the Lambda function. This information includes the Lambda function's Name and Role, as shown in the following screenshot:
  1. Here, Name will be a unique identification for your Lambda function and Role defines the permissions of your Lambda function.

There are three options available for creating a role:

  • Choose an existing role
  • Create new role from template(s)
  • Create a custom role
    Let's look at them in more detail:
    • Choose an existing role: This allows you to select the previously created role.
    • Create new role from template(s): Here, you need to define a role name. AWS Lambda provides ready-made built-in role policy templates that have pre-configured permissions. These are based on other AWS services-related permissions required by the AWS Lambda function. On any role selection, Lambda will automatically add the logging permission to CloudWatch (AWS logging service), as this is the basic permission required by Lambda.
    • Create a custom role: AWS provides an additional privilege to create a customized role to access AWS Lambda. Here, you can define the role based on your requirement.
  1. Let's create the HelloWorld Lambda function with some role. Here, I chose the S3 object read-only permission policy template.
  1. The following screenshot describes the newly created HelloWorld Lambda function:
HelloWorld Lambda function

The Lambda function includes three sections:

  • Configuration
  • Triggers
  • Monitoring

Let's look at detailed information about the configuration and monitoring. We will have a separate section for triggers. 

主站蜘蛛池模板: 天等县| 双辽市| 兖州市| 高邑县| 阿拉善左旗| 阿拉善盟| 伊吾县| 英吉沙县| 温泉县| 大渡口区| 三台县| 浠水县| 双峰县| 孟州市| 杭州市| 兴义市| 东明县| 恭城| 凤庆县| 张家港市| 石屏县| 麻江县| 石城县| 宣威市| 南陵县| 东辽县| 青浦区| 丹巴县| 洛扎县| 沽源县| 乌拉特后旗| 确山县| 安阳市| 南宁市| 西昌市| 浪卡子县| 都匀市| 汕头市| 南平市| 文成县| 杭锦后旗|