FunctionUrlOptions Struct
Options to add a url to a Lambda function.
Example
ts
import * as lambda from 'aws-cdk-lib/aws-lambda';
declare const fn: lambda.Function;
const fnUrl = fn.addFunctionUrl({
authType: lambda.FunctionUrlAuthType.AWS_IAM,
});
new cloudfront.Distribution(this, 'MyDistribution', {
defaultBehavior: {
origin: origins.FunctionUrlOrigin.withOriginAccessControl(fnUrl),
},
});
python
import aws_cdk.aws_lambda as lambda_
# fn: lambda.Function
fn_url = fn.add_function_url(
auth_type=lambda_.FunctionUrlAuthType.AWS_IAM
)
cloudfront.Distribution(self, "MyDistribution",
default_behavior=cloudfront.BehaviorOptions(
origin=origins.FunctionUrlOrigin.with_origin_access_control(fn_url)
)
)
java
import software.amazon.awscdk.services.lambda.*;
Function fn;
FunctionUrl fnUrl = fn.addFunctionUrl(FunctionUrlOptions.builder()
.authType(FunctionUrlAuthType.AWS_IAM)
.build());
Distribution.Builder.create(this, "MyDistribution")
.defaultBehavior(BehaviorOptions.builder()
.origin(FunctionUrlOrigin.withOriginAccessControl(fnUrl))
.build())
.build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
using Amazon.CDK.AWS.Lambda;
Function fn;
var fnUrl = fn.AddFunctionUrl(new FunctionUrlOptions {
AuthType = FunctionUrlAuthType.AWS_IAM
});
new Distribution(this, "MyDistribution", new DistributionProps {
DefaultBehavior = new BehaviorOptions {
Origin = FunctionUrlOrigin.WithOriginAccessControl(fnUrl)
}
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
import lambda "github.com/aws/aws-cdk-go/awscdk"
var fn Function
fnUrl := fn.AddFunctionUrl(&FunctionUrlOptions{
AuthType: lambda.FunctionUrlAuthType_AWS_IAM,
})
cloudfront.NewDistribution(this, jsii.String("MyDistribution"), &DistributionProps{
DefaultBehavior: &BehaviorOptions{
Origin: origins.FunctionUrlOrigin_WithOriginAccessControl(fnUrl),
},
})
Properties
authTypeoptionalFunctionUrlAuthTypeauth_typeoptionalFunctionUrlAuthTypeauthTypeoptionalFunctionUrlAuthTypeAuthTypeoptionalFunctionUrlAuthTypeAuthTypeoptionalFunctionUrlAuthType= FunctionUrlAuthType.AWS_IAM#The type of authentication that your function URL uses.
corsoptionalFunctionUrlCorsOptionscorsoptionalFunctionUrlCorsOptionscorsoptionalFunctionUrlCorsOptionsCorsoptionalFunctionUrlCorsOptionsCorsoptionalFunctionUrlCorsOptions#The cross-origin resource sharing (CORS) settings for your function URL.
Default: No CORS configuration.
invokeModeoptionalInvokeModeinvoke_modeoptionalInvokeModeinvokeModeoptionalInvokeModeInvokeModeoptionalInvokeModeInvokeModeoptionalInvokeMode= InvokeMode.BUFFERED#The type of invocation mode that your Lambda function uses.