Secure the function
Invoked directly, the function has no bearer token to check, so AWS IAM decides who can call it. Its HTTP routes are open until you add an authorizer. Think of IAM as the bouncer and your function as the band. The band doesn’t check tickets.
Invoked by other AWS services
Section titled “Invoked by other AWS services”Only principals allowed lambda:InvokeFunction on the function can invoke it. Grant that through an IAM policy on the caller, or through the function’s resource-based policy for services like EventBridge, SQS or S3. Keep it to the callers that need it. “Everyone in the account” is not a security model.
Called over HTTP with tokens
Section titled “Called over HTTP with tokens”The Http* functions already sit behind an API Gateway HTTP API. Add a JWT authorizer to it in serverless.template and API Gateway validates the token before the function runs, so bad requests never cost you an invocation, and the function itself stays the same. The sample routes only read, but a list of everyone’s reviews is still worth a lock if it isn’t meant to be public.
The sibling templates for HTTP, Clean Minimal API and Clean Web API, have optional bearer token checking built in if you’d rather run a web API than a function.