I am trying to create a AWS lambda function
with public access without any authorization via serverless
. In my API witch I have all functions with a private access via authorizer. I tried to deploy the function without authorizer but it gives me 403 Forbidden
.
My function example:
rel-Session:
description: do something public
handler: src/handlers/items/getNewPublicItem.getNewPublicItem
events:
- http:
path: api/v1.0/public/item/{id}
method: get
request:
parameters:
paths:
id: true
cors:
origin: ${env:CorsAllowOrigin}
How can I make my endpoint to be with public access?
Your issue is with your API, not the Lambda function. You can make your api available to the public with an API key or by configuring identity pools with AWS Cognito. It would all depend on what you're using for authentication. Here's a serverless template for attaching a lambda function to run based on an API method:
https://carova.io/snippets/serverless-aws-lambda-function-as-api-gateway-endpoint
Here's AWS docs on configuring an API Key:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.