0% found this document useful (0 votes)
23 views2 pages

Cloud Computing - Lab 7

This document provides instructions for using AWS Lambda serverless functions including how to configure the AWS CLI, common AWS Lambda CLI commands like listing, invoking, and deleting functions, and two assignments - one to create a greeting function and another to test invoking a Lambda function from an S3 bucket. Key points covered include configuring the AWS region, listing and invoking Lambda functions with optional parameters like function name, payload, and log output, and getting function configuration details.

Uploaded by

Gigi Beton
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views2 pages

Cloud Computing - Lab 7

This document provides instructions for using AWS Lambda serverless functions including how to configure the AWS CLI, common AWS Lambda CLI commands like listing, invoking, and deleting functions, and two assignments - one to create a greeting function and another to test invoking a Lambda function from an S3 bucket. Key points covered include configuring the AWS region, listing and invoking Lambda functions with optional parameters like function name, payload, and log output, and getting function configuration details.

Uploaded by

Gigi Beton
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Serverless applications - AWS Lambda

To read:
https://aws.amazon.com/lambda/

https://docs.aws.amazon.com/lambda/latest/dg/welcome.html

To read and test examples:


https://docs.aws.amazon.com/lambda/latest/dg/getting-started.html

Configure region for AWS CLI


aws configure
AWS Access Key ID [****************????]: <Enter>

AWS Secret Access Key [****************????]:<Enter>

Default region name [None]: us-east-1

Default output format [None]: <Enter>

AWS CLI commands for AWS Lambda


List lambda functions
aws lambda list-functions

Invoke lambda function


aws lambda invoke --function-name my-function out

To include the invocation log, provided as a separate LogResult attribute:


aws lambda invoke --function-name my-function out --log-type Tail

To extract LogResult (which is encoded in Base64) and decode it:


aws lambda invoke --function-name my-function out --log-type Tail --query
'LogResult' --output text | base64 -d

Invoke lambda function with parameters


aws lambda invoke --function-name my-function --payload '{ "key": "value" }'
out

Invoke lambda function asynchronous


aws lambda invoke --function-name my-function --invocation-type Event out
Get lambda function content
aws lambda get-function --function-name my-function
// the URL for the function content is provided in Location attribute

Delete lambda function


aws lambda delete-function --function-name my-function
// also don’t forget to delete the role created for this function and its attached policy (go to Services /
Identity and Access Management (IAM) / Roles | Policies)

Assignment
Create a lambda function that takes as parameter a JSON object that provides the first name and last
name of a person and responds with a greeting.

You have to set the permission to use the LabRole role.

Example:
JSON object: {firstName: ' John', lastName:' Doe'}

Response: Hello John Doe!

Assignment 2
Test the Tutorial: Using an Amazon S3 trigger to invoke a Lambda function from https://
docs.aws.amazon.com/lambda/latest/dg/with-s3-example.html

You might also like