View a markdown version of this page

AWS::Lambda::WebFunctionEndpoint - AWS CloudFormation

This is the new CloudFormation Template Reference Guide. Please update your bookmarks and links. For help getting started with CloudFormation, see the AWS CloudFormation User Guide.

AWS::Lambda::WebFunctionEndpoint

The AWS::Lambda::WebFunctionEndpoint resource creates an endpoint for a Lambda web function. An endpoint exposes the web function over HTTPS and routes traffic to one or more revisions. The endpoint type determines how the endpoint serves and routes traffic across Regions. For canary or blue-green deployments, you can split traffic between two revisions. To do this, specify two entries in the RevisionWeights property.

Syntax

To declare this entity in your CloudFormation template, use the following syntax:

JSON

{ "Type" : "AWS::Lambda::WebFunctionEndpoint", "Properties" : { "AuthType" : String, "Description" : String, "EndpointName" : String, "EndpointType" : String, "FunctionName" : String, "Regions" : [ String, ... ], "RevisionWeights" : [ RevisionWeight, ... ], "ScalingConfig" : ScalingConfig, "ThrottleConfig" : ThrottleConfig } }

YAML

Type: AWS::Lambda::WebFunctionEndpoint Properties: AuthType: String Description: String EndpointName: String EndpointType: String FunctionName: String Regions: - String RevisionWeights: - RevisionWeight ScalingConfig: ScalingConfig ThrottleConfig: ThrottleConfig

Properties

AuthType

The authorization type for the endpoint.

Valid values:

  • ApplicationManaged – Your application handles authorization.

  • IamAuth – Lambda uses IAM to authorize requests, which must be signed with Signature Version 4 (SigV4).

Required: Yes

Type: String

Allowed values: ApplicationManaged | IamAuth

Update requires: No interruption

Description

A description of the endpoint.

Required: No

Type: String

Minimum: 0

Maximum: 256

Update requires: No interruption

EndpointName

The name of the endpoint to create. The name can contain letters, numbers, hyphens (-), and underscores (_), and can't begin or end with a hyphen or an underscore. The name is limited to 64 characters in length.

Required: Yes

Type: String

Minimum: 1

Maximum: 256

Update requires: Replacement

EndpointType

The type of endpoint to create. Determines how traffic is served and routed across Regions.

Valid values:

  • HomeRegion – Serves traffic from the Region where you created the web function.

  • MultiRegion – Replicates across the Regions that you choose and routes each request to the nearest one.

  • PerRegion – Creates a separate endpoint in each Region that you choose.

Required: Yes

Type: String

Allowed values: HomeRegion | MultiRegion | PerRegion

Update requires: Replacement

FunctionName

The web function to create the endpoint for.

You can specify either of the following:

  • The function name, for example my-function.

  • The function ARN, for example arn:aws:lambda:us-east-1:111122223333:web-function/my-function.

The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

Required: Yes

Type: String

Minimum: 1

Maximum: 256

Update requires: Replacement

Regions

The list of Regions the endpoint is deployed to. Required when the endpoint type is MultiRegion or PerRegion: specify at least one Region other than the Region where you create the endpoint (the home Region). The home Region is added automatically if you don't include it. You can't specify only the home Region. When the endpoint type is HomeRegion, omit this property or specify only the home Region.

Required: No

Type: Array of String

Minimum: 1

Maximum: 50

Update requires: Replacement

RevisionWeights

A list of revision weights that determine how traffic is distributed across revisions. You can specify up to two revisions for canary or blue-green deployments.

Required: No

Type: Array of RevisionWeight

Minimum: 1

Maximum: 2

Update requires: No interruption

ScalingConfig

The scaling configuration for the endpoint. Optionally constrains how many concurrent execution environments the endpoint can use, in addition to your account's vCPU quota.

Required: No

Type: ScalingConfig

Update requires: No interruption

ThrottleConfig

The throttling configuration for the endpoint. Optionally constrains the request rate that the endpoint accepts, in addition to your account's rate limit quota.

Required: No

Type: ThrottleConfig

Update requires: No interruption

Return values

Ref

When you pass the logical ID of this resource to the intrinsic Ref function, Ref returns the Amazon Resource Name (ARN) of the endpoint.

For more information about using the Ref function, see Ref.

Fn::GetAtt

The Fn::GetAtt intrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values.

For more information about using the Fn::GetAtt intrinsic function, see Fn::GetAtt.

RegionalEndpoints

A map of the endpoint's per-Region configuration and state. Each key is a Region code, for example us-east-1. Each value is a RegionalEndpoint object.

CreatedAt

The date and time the endpoint was created.

DomainName

The domain name assigned to the endpoint.

EndpointArn

The Amazon Resource Name (ARN) of the endpoint.

FunctionArn

The Amazon Resource Name (ARN) of the web function.

State

The current state of the endpoint.

StateReason

The reason for the current state of the endpoint.

UpdatedAt

The date and time the endpoint was last updated.

UpdateStatus

The status of the most recent update to the endpoint.

UpdateStatusReason

The reason for the endpoint's most recent update status.

Examples

Web function endpoint

Create an endpoint that routes all traffic to one revision of the web function my-web-function.

JSON

"MyEndpoint": { "Type": "AWS::Lambda::WebFunctionEndpoint", "Properties": { "FunctionName": "my-web-function", "EndpointName": "my-endpoint", "EndpointType": "HomeRegion", "AuthType": "IamAuth", "RevisionWeights": [ { "RevisionId": { "Fn::GetAtt": [ "MyRevision", "RevisionId" ] }, "Weight": 100 } ] } }

YAML

MyEndpoint: Type: AWS::Lambda::WebFunctionEndpoint Properties: FunctionName: my-web-function EndpointName: my-endpoint EndpointType: HomeRegion AuthType: IamAuth RevisionWeights: - RevisionId: !GetAtt MyRevision.RevisionId Weight: 100