FunctionUrl

class FunctionUrl : KotlinCustomResource

Provides a Lambda function URL resource. A function URL is a dedicated HTTP(S) endpoint for a Lambda function. See the AWS Lambda documentation for more information.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const testLatest = new aws.lambda.FunctionUrl("test_latest", {
functionName: test.functionName,
authorizationType: "NONE",
});
const testLive = new aws.lambda.FunctionUrl("test_live", {
functionName: test.functionName,
qualifier: "my_alias",
authorizationType: "AWS_IAM",
cors: {
allowCredentials: true,
allowOrigins: ["*"],
allowMethods: ["*"],
allowHeaders: [
"date",
"keep-alive",
],
exposeHeaders: [
"keep-alive",
"date",
],
maxAge: 86400,
},
});
import pulumi
import pulumi_aws as aws
test_latest = aws.lambda_.FunctionUrl("test_latest",
function_name=test["functionName"],
authorization_type="NONE")
test_live = aws.lambda_.FunctionUrl("test_live",
function_name=test["functionName"],
qualifier="my_alias",
authorization_type="AWS_IAM",
cors={
"allow_credentials": True,
"allow_origins": ["*"],
"allow_methods": ["*"],
"allow_headers": [
"date",
"keep-alive",
],
"expose_headers": [
"keep-alive",
"date",
],
"max_age": 86400,
})
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var testLatest = new Aws.Lambda.FunctionUrl("test_latest", new()
{
FunctionName = test.FunctionName,
AuthorizationType = "NONE",
});
var testLive = new Aws.Lambda.FunctionUrl("test_live", new()
{
FunctionName = test.FunctionName,
Qualifier = "my_alias",
AuthorizationType = "AWS_IAM",
Cors = new Aws.Lambda.Inputs.FunctionUrlCorsArgs
{
AllowCredentials = true,
AllowOrigins = new[]
{
"*",
},
AllowMethods = new[]
{
"*",
},
AllowHeaders = new[]
{
"date",
"keep-alive",
},
ExposeHeaders = new[]
{
"keep-alive",
"date",
},
MaxAge = 86400,
},
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/lambda"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := lambda.NewFunctionUrl(ctx, "test_latest", &lambda.FunctionUrlArgs{
FunctionName: pulumi.Any(test.FunctionName),
AuthorizationType: pulumi.String("NONE"),
})
if err != nil {
return err
}
_, err = lambda.NewFunctionUrl(ctx, "test_live", &lambda.FunctionUrlArgs{
FunctionName: pulumi.Any(test.FunctionName),
Qualifier: pulumi.String("my_alias"),
AuthorizationType: pulumi.String("AWS_IAM"),
Cors: &lambda.FunctionUrlCorsArgs{
AllowCredentials: pulumi.Bool(true),
AllowOrigins: pulumi.StringArray{
pulumi.String("*"),
},
AllowMethods: pulumi.StringArray{
pulumi.String("*"),
},
AllowHeaders: pulumi.StringArray{
pulumi.String("date"),
pulumi.String("keep-alive"),
},
ExposeHeaders: pulumi.StringArray{
pulumi.String("keep-alive"),
pulumi.String("date"),
},
MaxAge: pulumi.Int(86400),
},
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.lambda.FunctionUrl;
import com.pulumi.aws.lambda.FunctionUrlArgs;
import com.pulumi.aws.lambda.inputs.FunctionUrlCorsArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var testLatest = new FunctionUrl("testLatest", FunctionUrlArgs.builder()
.functionName(test.functionName())
.authorizationType("NONE")
.build());
var testLive = new FunctionUrl("testLive", FunctionUrlArgs.builder()
.functionName(test.functionName())
.qualifier("my_alias")
.authorizationType("AWS_IAM")
.cors(FunctionUrlCorsArgs.builder()
.allowCredentials(true)
.allowOrigins("*")
.allowMethods("*")
.allowHeaders(
"date",
"keep-alive")
.exposeHeaders(
"keep-alive",
"date")
.maxAge(86400)
.build())
.build());
}
}
resources:
testLatest:
type: aws:lambda:FunctionUrl
name: test_latest
properties:
functionName: ${test.functionName}
authorizationType: NONE
testLive:
type: aws:lambda:FunctionUrl
name: test_live
properties:
functionName: ${test.functionName}
qualifier: my_alias
authorizationType: AWS_IAM
cors:
allowCredentials: true
allowOrigins:
- '*'
allowMethods:
- '*'
allowHeaders:
- date
- keep-alive
exposeHeaders:
- keep-alive
- date
maxAge: 86400

Import

Using pulumi import, import Lambda function URLs using the function_name or function_name/qualifier. For example:

$ pulumi import aws:lambda/functionUrl:FunctionUrl test_lambda_url my_test_lambda_function

Properties

Link copied to clipboard

The type of authentication that the function URL uses. Set to "AWS_IAM" to restrict access to authenticated IAM users only. Set to "NONE" to bypass IAM authentication and create a public endpoint. See the AWS documentation for more details.

Link copied to clipboard
val cors: Output<FunctionUrlCors>?

The cross-origin resource sharing (CORS) settings for the function URL. Documented below.

Link copied to clipboard
val functionArn: Output<String>

The Amazon Resource Name (ARN) of the function.

Link copied to clipboard
val functionName: Output<String>

The name (or ARN) of the Lambda function.

Link copied to clipboard
val functionUrl: Output<String>

The HTTP URL endpoint for the function in the format https://<url_id>.lambda-url.<region>.on.aws/.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard
val invokeMode: Output<String>?

Determines how the Lambda function responds to an invocation. Valid values are BUFFERED (default) and RESPONSE_STREAM. See more in Configuring a Lambda function to stream responses.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val qualifier: Output<String>?

The alias name or "$LATEST".

Link copied to clipboard
val urlId: Output<String>

A generated ID for the endpoint.

Link copied to clipboard
val urn: Output<String>