FunctionUrlConfig - AWS Serverless Application Model

FunctionUrlConfig

Creates a function URL with the specified configuration parameters. A function URL is an HTTPS endpoint that you can use to invoke your function.

By default, the function URL 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 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: String Cors: Cors

Properties

AuthType

The type of authorization for your function URL. Set to AWS_IAM to use IAM to authorize requests. Set to NONE for open access.

For more information, see Function URLs in the AWS Lambda Developer Guide

Type: String

Required: Yes

AWS 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

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

Examples

Function URL

The following example create 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: nodejs14.x FunctionUrlConfig: AuthType: AWS_IAM Outputs: MyFunctionUrlEndpoint: Description: "My Lambda Function URL Endpoint" Value: Fn::GetAtt: HelloWorldFunctionUrl.FunctionUrl