O'Reilly logo

Serverless Single Page Apps by Ben Rady

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Invoking Lambda Functions

You can invoke a Lambda function from a browser in two ways. The first way is to use the AWS SDK. The second is via the Amazon API Gateway. First, we’re going to see how to invoke Lambda functions from the browser, using the AWS SDK and the Cognito credentials issued to the user.

By adding a new policy to our authenticated Cognito role, we can invoke Lambda functions directly from the browser without going through a public HTTP interface. As long as users have the proper credentials that let them assume the role, they can perform any operation listed in the policy. The particular operation we want to perform is named invoke. To perform this operation, you need to create an instance of the Lambda class from the AWS library. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required