FunctionUrlConfig - Amazon Serverless Application Model
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

FunctionUrlConfig

Creates an Amazon 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 Amazon Lambda Developer Guide.

Syntax

To declare this entity in your Amazon Serverless Application Model (Amazon SAM) template, use the following syntax.

YAML

AuthType: String Cors: Cors InvokeMode: String

Properties

AuthType

The type of authorization for your function URL. To use Amazon Identity and Access Management (IAM) to authorize requests, set to AWS_IAM. For open access, set to NONE.

Type: String

Required: Yes

Amazon CloudFormation compatibility: This property is passed directly to the AuthType property of an AWS::Lambda::Url resource.

Cors

The cross-origin resource sharing (CORS) settings for your function URL.

Type: Cors

Required: No

Amazon CloudFormation compatibility: This property is passed directly to the Cors property of an AWS::Lambda::Url resource.

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 to RESPONSE_STREAM. The default value is BUFFERED.

Valid values: BUFFERED or RESPONSE_STREAM

Type: String

Required: No

Amazon CloudFormation compatibility: This property is passed directly to the InvokeMode property of an AWS::Lambda::Url resource.

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