With AWS Amplify, you can use amplify add api
to create REST APIs using API Gatway and Lambdas.
However, I wanted to try out the new Lambda Url feature for a simple public webhook.
Steps involved
- Make your "Webhook" Lambda
- Create a custom reasource "Webhooks".
- Give it access to the "Webhook" lambda
- Create 3 resources in your custom resource (File: Webhooks-cloudformation.json below)
- AWS::Lambda::Url
- AWS::IAM::Policy to ALLOW lambda:InvokeFunctionUrl
- AWS::Lambda::Permission
- And if you want to access the URL elsewhere in Amplify, add an output
- Give your amplify cli user/profile permissions (cli-inline-policy.json below)
Log into the console, find your lambda and you'll see the Function Url. Click it, profit.
amplify add function
amplify add custom