My Lambda function URL returns Forbidden even though its AuthType is NONE and the resource policy allows public access to lambda:InvokeFunctionUrl. The function returns an SVG for a project README. What else should I check?
Why is my public Lambda function URL still returning 403?
Answers
Check whether the resource policy also allows lambda:InvokeFunction. The URL permission alone can be only half of what is needed for a public function URL.
For the InvokeFunction permission, use the lambda:InvokedViaFunctionUrl condition so it applies to calls through the function URL rather than granting unrestricted invocation. Also make sure you are inspecting the policy for the same function or alias that the URL points to.
Reply to this answer
A 403 with that authorization message points toward the URL permissions rather than the Rust response construction. I would check both required policy actions before changing the handler or hunting for an account-wide setting.
Reply to this answer
Once it works, keep an eye on the exposure. A public URL can be called repeatedly by anyone, which can run up Lambda charges and consume the upstream API's rate limit. Consider caching the SVG and putting a rate-limiting layer in front of the endpoint, such as AWS WAF with a supported integration.
Reply to this answer
Add your answer
Answers are reviewed before publication.
Related Discussions