FunctionUrlAuthType Enum
The auth types for a function url.
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),
},
})
Members
| Member | Description |
|---|---|
AWS_IAM | Restrict access to authenticated IAM users only. |
NONE | Bypass IAM authentication to create a public endpoint. |
Referenced by
FunctionUrl.authTypeauth_typeauthTypeAuthTypeAuthTypeFunctionUrlOptions.authTypeauth_typeauthTypeAuthTypeAuthTypeIFunctionUrl.authTypeauth_typeauthTypeAuthTypeAuthTypePermission.functionUrlAuthTypefunction_url_auth_typefunctionUrlAuthTypeFunctionUrlAuthTypeFunctionUrlAuthType