FunctionUrlConfig
Creates an AWS Lambda function URL with the specified configuration parameters. A Lambda function URL is an HTTPS endpoint that you can use to invoke your function.
By default, the function URL that you create uses the $LATEST version of your
Lambda function. If you specify an AutoPublishAlias for your Lambda function, the
endpoint connects to the specified function alias.
For more information, see Lambda function URLs in the AWS Lambda Developer Guide.
Syntax
To declare this entity in your AWS Serverless Application Model (AWS SAM) template, use the following syntax.
YAML
AuthType:StringCors:CorsInvokeMode:String
Properties
-
AuthType -
The type of authorization for your function URL. To use AWS Identity and Access Management (IAM) to authorize requests, set to
AWS_IAM. For open access, set toNONE.Type: String
Required: Yes
AWS CloudFormation compatibility: This property is passed directly to the
AuthTypeproperty of anAWS::Lambda::Urlresource. -
Cors -
The cross-origin resource sharing (CORS) settings for your function URL.
Type: Cors
Required: No
AWS CloudFormation compatibility: This property is passed directly to the
Corsproperty of anAWS::Lambda::Urlresource. -
InvokeMode -
The mode that your function URL will be invoked. To have your function return the response after invocation completes, set to
BUFFERED. To have your function stream the response, set toRESPONSE_STREAM. The default value isBUFFERED.Valid values:
BUFFEREDorRESPONSE_STREAMType: String
Required: No
AWS CloudFormation compatibility: This property is passed directly to the
InvokeModeproperty of anAWS::Lambda::Urlresource.
Examples
Function URL
The following example creates a Lambda function with a function URL. The function URL uses IAM authorization.
YAML
HelloWorldFunction: Type: AWS::Serverless::Function Properties: CodeUri: hello_world/ Handler: index.handler Runtime: nodejs20.x FunctionUrlConfig: AuthType: AWS_IAM InvokeMode: RESPONSE_STREAM Outputs: MyFunctionUrlEndpoint: Description: "My Lambda Function URL Endpoint" Value: Fn::GetAtt: HelloWorldFunctionUrl.FunctionUrl