Chapter 1: AWS, Lambda, and Serverless Applications
Solution for Activity 1: Creating a New Lambda Function That Finds the Square Root of the Average of Two Input Numbers
- Click on Create a function to create your first Lambda function on the AWS Lambda page.
- On the Create function page, select Author from scratch.
- In the Author from scratch window, fill in the following details:
Name: Enter
myFirstLambdaFunction
.Runtime: Choose Node.js 6.10. The Runtime window dropdown shows the list of languages that are supported by AWS Lambda and you can author your Lambda function code in any of the listed options. For this activity, we will author our code in Node.js.
Role: Choose Create new role from template(s). In this section, you specify an IAM role.
Role name: Enter
lambda_basic_execution
.Policy templates: Select Simple Microservice permissions.
- Now click on Create function.
- Go to the Function code section.
- Use the Edit code inline option, and enter this code:
exports...