capabilities.work

Expose a Function Over an HTTPS Function URL

A 3-step recipe with AWS Lambda. We can help you get access.

Recipe · 3 steps

Expose a Function Over an HTTPS Function URL

with AWS Lambda · IT Infrastructure Management

Create a function URL for a function or alias and read back the assigned endpoint.

  1. Confirm the function exists and has finished provisioning before it is put on the internet, so the first caller does not meet a Pending function.
  2. Create the function URL. AuthType is passed from input rather than defaulted because it is the single control deciding whether the endpoint is open to the internet or requires signed requests.
  3. Read the URL configuration back to confirm the endpoint, the authorization type, and the CORS policy Lambda actually stored before the URL is handed to clients.
What you'll need to have ready
  • functionName: The name or ARN of the function to expose.
  • qualifier: An alias name to attach the URL to (e.g. prod). Omit to expose the unpublished $LATEST version. Function URLs cannot target a version number.
  • authType: AWS_IAM to require SigV4-signed requests, or NONE for an unauthenticated public endpoint where the handler is solely responsible for authorization.
  • invokeMode: BUFFERED to return the response in one payload, or RESPONSE_STREAM to stream it.
  • allowOrigins: Origins permitted by CORS (e.g. ["https://example.com"]).
  • allowMethods: HTTP methods permitted by CORS (e.g. ["GET","POST"]).
  • allowHeaders: Request headers permitted by CORS.
  • allowCredentials: Whether browsers may send credentials with cross-origin requests.
  • maxAge: Seconds a browser may cache the CORS preflight response.
For your developer

Arazzo workflow aws-lambda:function-url-expose, 3 operations: GetFunctionConfiguration → CreateFunctionUrlConfig → GetFunctionUrlConfig. Specs on APIs.io.