WebFunctionEndpoint L2 construct Added in v2.276.0
An endpoint of a Lambda WebFunction: a domain that serves HTTP traffic for one of the function's revisions.
A WebFunction creates one, fn.endpoint. Create more with fn.addEndpoint(), for example to serve the same function with a different auth type or endpoint type.
Example
declare const fn: lambda.WebFunction;
const internal = fn.addEndpoint('Internal', {
authType: lambda.WebFunctionAuthType.IAM_AUTH,
});
# fn: lambda.WebFunction
internal = fn.add_endpoint("Internal",
auth_type=lambda_.WebFunctionAuthType.IAM_AUTH
)
WebFunction fn;
WebFunctionEndpoint internal = fn.addEndpoint("Internal", WebFunctionEndpointOptions.builder()
.authType(WebFunctionAuthType.IAM_AUTH)
.build());
// Install: dotnet add package Amazon.CDK.Lib
WebFunction fn;
var internal = fn.AddEndpoint("Internal", new WebFunctionEndpointOptions {
AuthType = WebFunctionAuthType.IAM_AUTH
});
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var fn WebFunction
internal := fn.AddEndpoint(jsii.String("Internal"), &WebFunctionEndpointOptions{
AuthType: lambda.WebFunctionAuthType_IAM_AUTH,
})
Initializer
new WebFunctionEndpoint(scope: Construct, id: string, props: WebFunctionEndpointProps)
WebFunctionEndpoint(scope: Construct, id: str, props: WebFunctionEndpointProps)
new WebFunctionEndpoint(Construct scope, String id, WebFunctionEndpointProps props)
new WebFunctionEndpoint(Construct scope, string id, WebFunctionEndpointProps props)
NewWebFunctionEndpoint(Scope Construct, Id *string, Props WebFunctionEndpointProps)
Construct Props
authTypeWebFunctionAuthTypeauth_typeWebFunctionAuthTypeauthTypeWebFunctionAuthTypeAuthTypeWebFunctionAuthTypeAuthTypeWebFunctionAuthTyperequired#notes
There is no default: you must choose explicitly so an endpoint is never accidentally public or accidentally locked down. Specify WebFunctionAuthType.IAM_AUTH (Lambda authorizes requests with SigV4/IAM) or WebFunctionAuthType.APPLICATION_MANAGED (the endpoint is public and your function handles authorization).
With IAM_AUTH, requests must be signed with SigV4 and carry the X-Amz-Content-SHA256 header, also for a request without a body; without it the endpoint returns 403 even for a valid signature. A MULTI_REGION endpoint is signed with SigV4a, for the Region set *.
endpointDescriptionoptionalstringendpoint_descriptionoptionalstrendpointDescriptionoptionalStringEndpointDescriptionoptionalstringEndpointDescriptionoptional*string#Default: No description.
Up to 256 characters.
endpointLocationoptionalWebFunctionEndpointLocationendpoint_locationoptionalWebFunctionEndpointLocationendpointLocationoptionalWebFunctionEndpointLocationEndpointLocationoptionalWebFunctionEndpointLocationEndpointLocationoptionalWebFunctionEndpointLocation#Default: WebFunctionEndpointLocation.homeRegion()
Changing it replaces the endpoint, which yields a new domainName. If you set endpointName, change it at the same time.
endpointNameoptionalstringendpoint_nameoptionalstrendpointNameoptionalStringEndpointNameoptionalstringEndpointNameoptional*string#Default: for the endpoint a WebFunction creates, prod in the home Region and, for a regional endpoint, prod- followed by a hash of its location; for any other endpoint, a name derived from its construct path and location
notes
Must be 2 to 64 characters of letters, numbers, hyphens or underscores, starting and ending with a letter or number.
Changing this property replaces the endpoint, which yields a new domainName.
endpointLocation also replaces the endpoint when it changes, and CloudFormation cannot replace a resource that keeps its name. Without this property the name is derived from the location, so that works. With it, change the name together with the location, or the deployment fails.
maxEnvironmentsoptionalnumbermax_environmentsoptionalint | floatmaxEnvironmentsoptionalNumberMaxEnvironmentsoptionaldoubleMaxEnvironmentsoptional*float64#Default: Scaling is limited only by your account's vCPU quota.
This is an optional cap on top of your account's vCPU quota, not a reservation: it further constrains how far the endpoint scales. Must be 2 or greater.
rateLimitoptionalnumberrate_limitoptionalint | floatrateLimitoptionalNumberRateLimitoptionaldoubleRateLimitoptional*float64#Default: The request rate is limited only by your account's rate limit quota.
notes
This is an optional cap on top of your account's rate limit quota. Specify 0 to reject all new requests.
The service accepts only certain values: 0, 100 through 1000 in increments of 100, and 2000 through 10000 in increments of 1000. Which of those are available varies by Region, and an unsupported value is rejected at deploy time with the values that Region does accept. Only the lower bound is checked at synth, since the schema declares nothing more.
trafficWebFunctionTraffictrafficWebFunctionTraffictrafficWebFunctionTrafficTrafficWebFunctionTrafficTrafficWebFunctionTrafficrequired#For a WebFunction defined in this app, WebFunction.addEndpoint() sets this to the function's revision.
webFunctionIWebFunctionRefweb_functionIWebFunctionRefwebFunctionIWebFunctionRefWebFunctionIWebFunctionRefWebFunctionIWebFunctionRefrequired#Properties
authTypeWebFunctionAuthTypeauth_typeWebFunctionAuthTypeauthTypeWebFunctionAuthTypeAuthTypeWebFunctionAuthTypeAuthTypeWebFunctionAuthType#endpointTypeWebFunctionEndpointTypeendpoint_typeWebFunctionEndpointTypeendpointTypeWebFunctionEndpointTypeEndpointTypeWebFunctionEndpointTypeEndpointTypeWebFunctionEndpointType#envResourceEnvironmentenvResourceEnvironmentenvResourceEnvironmentEnvResourceEnvironmentEnvResourceEnvironment#notes
For resources that are created and managed in a Stack (those created by creating new class instances like new Role(), new Bucket(), etc.), this is always the same as the environment of the stack they belong to.
For referenced resources (those obtained from referencing methods like Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be different than the stack they were imported into.
grantsWebFunctionEndpointGrantsgrantsWebFunctionEndpointGrantsgrantsWebFunctionEndpointGrantsGrantsWebFunctionEndpointGrantsGrantsWebFunctionEndpointGrants#PROPERTY_INJECTION_IDstringproperty_injection_idstrPROPERTY_INJECTION_IDStringPROPERTY_INJECTION_IDstringPROPERTY_INJECTION_ID*stringstatic#resourceCfnWebFunctionEndpointresourceCfnWebFunctionEndpointresourceCfnWebFunctionEndpointResourceCfnWebFunctionEndpointResourceCfnWebFunctionEndpoint#Use for escape hatches.
webFunctionArnstringweb_function_arnstrwebFunctionArnStringWebFunctionArnstringWebFunctionArn*string#webFunctionEndpointRefWebFunctionEndpointReferenceweb_function_endpoint_refWebFunctionEndpointReferencewebFunctionEndpointRefWebFunctionEndpointReferenceWebFunctionEndpointRefWebFunctionEndpointReferenceWebFunctionEndpointRefWebFunctionEndpointReference#Methods
addToResourcePolicy(statement: PolicyStatement): AddToResourcePolicyResultdef add_to_resource_policy(self, statement: PolicyStatement) -> AddToResourcePolicyResultpublic AddToResourcePolicyResult addToResourcePolicy(PolicyStatement statement)public AddToResourcePolicyResult AddToResourcePolicy(PolicyStatement statement)func AddToResourcePolicy(Statement PolicyStatement) AddToResourcePolicyResult#For an endpoint in another stack than its function, the statement names the endpoint by the function's ARN and the endpoint name, so the name must be a literal.
applyCrossStackReferenceStrength(strength: ReferenceStrength): voiddef apply_cross_stack_reference_strength(self, strength: ReferenceStrength) -> Nonepublic void applyCrossStackReferenceStrength(ReferenceStrength strength)public void ApplyCrossStackReferenceStrength(ReferenceStrength strength)func ApplyCrossStackReferenceStrength(Strength ReferenceStrength)#notes · 1 parameter
When set, any cross-stack reference to this resource will use the specified mechanism instead of the global default determined by the @aws-cdk/core:defaultCrossStackReferences context key. This is useful for selectively weakening specific references to avoid the "deadly embrace" problem without changing the app-wide default.
Parameters
strengthstrengthstrengthstrengthStrength— - The reference strength to use for this resource.
applyRemovalPolicy(policy: RemovalPolicy): voiddef apply_removal_policy(self, policy: RemovalPolicy) -> Nonepublic void applyRemovalPolicy(RemovalPolicy policy)public void ApplyRemovalPolicy(RemovalPolicy policy)func ApplyRemovalPolicy(Policy RemovalPolicy)#notes
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).
fromWebFunctionEndpointAttributes(scope: Construct, id: string, attrs: WebFunctionEndpointAttributes): IWebFunctionEndpoint@staticmethod def from_web_function_endpoint_attributes(scope: Construct, id: str, attrs: WebFunctionEndpointAttributes) -> IWebFunctionEndpointpublic static IWebFunctionEndpoint fromWebFunctionEndpointAttributes(Construct scope, String id, WebFunctionEndpointAttributes attrs)public static IWebFunctionEndpoint FromWebFunctionEndpointAttributes(Construct scope, string id, WebFunctionEndpointAttributes attrs)func FromWebFunctionEndpointAttributes(Scope Construct, Id *string, Attrs WebFunctionEndpointAttributes) IWebFunctionEndpointstatic#isConstruct(x: any): boolean@staticmethod def is_construct(x: Any) -> boolpublic static Boolean isConstruct(Object x)public static bool IsConstruct(object x)func IsConstruct(X interface{}) *boolstatic#notes · 1 parameter · returns
Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.
Parameters
xxxxX— Any object.
Returns: true if x is an object created from a class which extends Construct.
isOwnedResource(construct: IConstruct): boolean@staticmethod def is_owned_resource(construct: IConstruct) -> boolpublic static Boolean isOwnedResource(IConstruct construct)public static bool IsOwnedResource(IConstruct construct)func IsOwnedResource(Construct IConstruct) *boolstatic#isResource(construct: IConstruct): boolean@staticmethod def is_resource(construct: IConstruct) -> boolpublic static Boolean isResource(IConstruct construct)public static bool IsResource(IConstruct construct)func IsResource(Construct IConstruct) *boolstatic#isWebFunctionEndpoint(x: any): boolean@staticmethod def is_web_function_endpoint(x: Any) -> boolpublic static Boolean isWebFunctionEndpoint(Object x)public static bool IsWebFunctionEndpoint(object x)func IsWebFunctionEndpoint(X interface{}) *boolstatic#toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct#Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.