Step 2: Create a Lambda Function and Invoke It Manually
In this section, you do the following:
Create a deployment package. A deployment package is a .zip file that contains your code and any dependencies. For this tutorial there are no dependencies, you only have a simple example code.
Create an IAM role (execution role). At the time you upload the deployment package, you need to specify an IAM role (execution role) that Lambda can assume to execute the function on your behalf.
You also grant this role the permissions that your Lambda function needs. The code in this tutorial writes logs to Amazon CloudWatch Logs. So you need to grant permissions for CloudWatch actions. For more information, see AWS Lambda Watch Logs.
Create a Lambda function (
HelloWorld) using the
create-functionCLI command. For more information about the underlying API and related parameters, see CreateFunction.