To configure API Gateway for Lambda integration, complete the following steps. The Lambda function that you create generates a streaming URL when requested.
1. Open the Amazon API Gateway console at https://console.thinkwithwp.com/apigateway.
2. In the navigation pane, under the examplecorp_saas API, choose Authorizers.
3. Choose Create New Authorizer, and then do the following:
• For Name, type examplecorp_auth.
• For Type, choose Cognito.
• For Cognito User Pool, select the Amazon Cognito user pool that you created from the list (examplecorp_saas). Then, verify that the Region where you created your user pool is selected.
• For Token Source, type Authorization.
• Leave Token Validation empty.
4. Choose Create.
5. In the navigation pane, choose Resources.
6. Choose Actions, Create Resource.
7. Do the following:
• For Resource Name, type auth.
• For Resource Path, verify that the value is /auth.
• Select the Enable API Gateway CORS check box.
8. Choose Create Resource.
9. With your newly created resource (/auth) selected in the Resources pane, choose Actions, Create Method.
10. Under OPTIONS, choose POST, and select the check mark to the right of the list to save your changes.
11. In the POST Setup pane, do the following:
• For Integration type, keep Lambda Function selected.
• Select the Use Lambda Proxy integration check box.
• For Lambda Region, verify that the Region where you created your Lambda function is selected.
• For Lambda Function, type the name of the function that you created earlier in this project: examplecorp_lambda_saas_function.
12. Choose Save.
13. In the Add Permission to Lambda Function dialog box, choose OK to confirm your changes.
14. With your new method selected, in the Method Execution details pane, choose the Method Request card.
15. In the Post Method Request pane, under Settings, do the following:
• Choose the pencil icon to the right of the Authorization list.
• Choose the Amazon Cognito authorizer that you created from the list (examplecorp_auth).
• Select the check mark to the right of the list to save your changes.
16. In the Resources pane, choose your resource, /auth.
17. Choose Actions, Deploy API.
18. In the Deploy API dialog box, do the following:
• For Deployment stage, choose [New Stage].
• For Stage name, type auth
• For Stage description and Deployment description, you can optionally type a description.
• Choose Deploy.
19. At the top of the auth Stage Editor pane, the Invoke URL displays. Make a note of this URL.