AWS Classic

Pulumi Official
Package maintained by Pulumi
v5.10.0 published on Monday, Jul 11, 2022 by Pulumi

FunctionUrl

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

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var testLatest = new Aws.Lambda.FunctionUrl("testLatest", new Aws.Lambda.FunctionUrlArgs
        {
            FunctionName = aws_lambda_function.Test.Function_name,
            AuthorizationType = "NONE",
        });
        var testLive = new Aws.Lambda.FunctionUrl("testLive", new Aws.Lambda.FunctionUrlArgs
        {
            FunctionName = aws_lambda_function.Test.Function_name,
            Qualifier = "my_alias",
            AuthorizationType = "AWS_IAM",
            Cors = new Aws.Lambda.Inputs.FunctionUrlCorsArgs
            {
                AllowCredentials = true,
                AllowOrigins = 
                {
                    "*",
                },
                AllowMethods = 
                {
                    "*",
                },
                AllowHeaders = 
                {
                    "date",
                    "keep-alive",
                },
                ExposeHeaders = 
                {
                    "keep-alive",
                    "date",
                },
                MaxAge = 86400,
            },
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/lambda"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := lambda.NewFunctionUrl(ctx, "testLatest", &lambda.FunctionUrlArgs{
			FunctionName:      pulumi.Any(aws_lambda_function.Test.Function_name),
			AuthorizationType: pulumi.String("NONE"),
		})
		if err != nil {
			return err
		}
		_, err = lambda.NewFunctionUrl(ctx, "testLive", &lambda.FunctionUrlArgs{
			FunctionName:      pulumi.Any(aws_lambda_function.Test.Function_name),
			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 java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;

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(aws_lambda_function.test().function_name())
            .authorizationType("NONE")
            .build());

        var testLive = new FunctionUrl("testLive", FunctionUrlArgs.builder()        
            .functionName(aws_lambda_function.test().function_name())
            .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());

    }
}
import pulumi
import pulumi_aws as aws

test_latest = aws.lambda_.FunctionUrl("testLatest",
    function_name=aws_lambda_function["test"]["function_name"],
    authorization_type="NONE")
test_live = aws.lambda_.FunctionUrl("testLive",
    function_name=aws_lambda_function["test"]["function_name"],
    qualifier="my_alias",
    authorization_type="AWS_IAM",
    cors=aws.lambda..FunctionUrlCorsArgs(
        allow_credentials=True,
        allow_origins=["*"],
        allow_methods=["*"],
        allow_headers=[
            "date",
            "keep-alive",
        ],
        expose_headers=[
            "keep-alive",
            "date",
        ],
        max_age=86400,
    ))
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const testLatest = new aws.lambda.FunctionUrl("testLatest", {
    functionName: aws_lambda_function.test.function_name,
    authorizationType: "NONE",
});
const testLive = new aws.lambda.FunctionUrl("testLive", {
    functionName: aws_lambda_function.test.function_name,
    qualifier: "my_alias",
    authorizationType: "AWS_IAM",
    cors: {
        allowCredentials: true,
        allowOrigins: ["*"],
        allowMethods: ["*"],
        allowHeaders: [
            "date",
            "keep-alive",
        ],
        exposeHeaders: [
            "keep-alive",
            "date",
        ],
        maxAge: 86400,
    },
});
resources:
  testLatest:
    type: aws:lambda:FunctionUrl
    properties:
      functionName: ${aws_lambda_function.test.function_name}
      authorizationType: NONE
  testLive:
    type: aws:lambda:FunctionUrl
    properties:
      functionName: ${aws_lambda_function.test.function_name}
      qualifier: my_alias
      authorizationType: AWS_IAM
      cors:
        allowCredentials: true
        allowOrigins:
          - '*'
        allowMethods:
          - '*'
        allowHeaders:
          - date
          - keep-alive
        exposeHeaders:
          - keep-alive
          - date
        maxAge: 86400

Create a FunctionUrl Resource

new FunctionUrl(name: string, args: FunctionUrlArgs, opts?: CustomResourceOptions);
@overload
def FunctionUrl(resource_name: str,
                opts: Optional[ResourceOptions] = None,
                authorization_type: Optional[str] = None,
                cors: Optional[_lambda_.FunctionUrlCorsArgs] = None,
                function_name: Optional[str] = None,
                qualifier: Optional[str] = None)
@overload
def FunctionUrl(resource_name: str,
                args: FunctionUrlArgs,
                opts: Optional[ResourceOptions] = None)
func NewFunctionUrl(ctx *Context, name string, args FunctionUrlArgs, opts ...ResourceOption) (*FunctionUrl, error)
public FunctionUrl(string name, FunctionUrlArgs args, CustomResourceOptions? opts = null)
public FunctionUrl(String name, FunctionUrlArgs args)
public FunctionUrl(String name, FunctionUrlArgs args, CustomResourceOptions options)
type: aws:lambda:FunctionUrl
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args FunctionUrlArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args FunctionUrlArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args FunctionUrlArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args FunctionUrlArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args FunctionUrlArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

FunctionUrl Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The FunctionUrl resource accepts the following input properties:

AuthorizationType string

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.

FunctionName string

The name (or ARN) of the Lambda function.

Cors FunctionUrlCorsArgs

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

Qualifier string

The alias name or "$LATEST".

AuthorizationType string

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.

FunctionName string

The name (or ARN) of the Lambda function.

Cors FunctionUrlCorsArgs

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

Qualifier string

The alias name or "$LATEST".

authorizationType String

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.

functionName String

The name (or ARN) of the Lambda function.

cors FunctionUrlCorsArgs

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

qualifier String

The alias name or "$LATEST".

authorizationType string

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.

functionName string

The name (or ARN) of the Lambda function.

cors FunctionUrlCorsArgs

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

qualifier string

The alias name or "$LATEST".

authorization_type str

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.

function_name str

The name (or ARN) of the Lambda function.

cors FunctionUrlCorsArgs

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

qualifier str

The alias name or "$LATEST".

authorizationType String

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.

functionName String

The name (or ARN) of the Lambda function.

cors Property Map

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

qualifier String

The alias name or "$LATEST".

Outputs

All input properties are implicitly available as output properties. Additionally, the FunctionUrl resource produces the following output properties:

FunctionArn string

The Amazon Resource Name (ARN) of the function.

FunctionUrlResult string

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

Id string

The provider-assigned unique ID for this managed resource.

UrlId string

A generated ID for the endpoint.

FunctionArn string

The Amazon Resource Name (ARN) of the function.

FunctionUrl string

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

Id string

The provider-assigned unique ID for this managed resource.

UrlId string

A generated ID for the endpoint.

functionArn String

The Amazon Resource Name (ARN) of the function.

functionUrl String

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

id String

The provider-assigned unique ID for this managed resource.

urlId String

A generated ID for the endpoint.

functionArn string

The Amazon Resource Name (ARN) of the function.

functionUrl string

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

id string

The provider-assigned unique ID for this managed resource.

urlId string

A generated ID for the endpoint.

function_arn str

The Amazon Resource Name (ARN) of the function.

function_url str

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

id str

The provider-assigned unique ID for this managed resource.

url_id str

A generated ID for the endpoint.

functionArn String

The Amazon Resource Name (ARN) of the function.

functionUrl String

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

id String

The provider-assigned unique ID for this managed resource.

urlId String

A generated ID for the endpoint.

Look up an Existing FunctionUrl Resource

Get an existing FunctionUrl resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: FunctionUrlState, opts?: CustomResourceOptions): FunctionUrl
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        authorization_type: Optional[str] = None,
        cors: Optional[_lambda_.FunctionUrlCorsArgs] = None,
        function_arn: Optional[str] = None,
        function_name: Optional[str] = None,
        function_url: Optional[str] = None,
        qualifier: Optional[str] = None,
        url_id: Optional[str] = None) -> FunctionUrl
func GetFunctionUrl(ctx *Context, name string, id IDInput, state *FunctionUrlState, opts ...ResourceOption) (*FunctionUrl, error)
public static FunctionUrl Get(string name, Input<string> id, FunctionUrlState? state, CustomResourceOptions? opts = null)
public static FunctionUrl get(String name, Output<String> id, FunctionUrlState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
AuthorizationType string

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.

Cors FunctionUrlCorsArgs

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

FunctionArn string

The Amazon Resource Name (ARN) of the function.

FunctionName string

The name (or ARN) of the Lambda function.

FunctionUrlResult string

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

Qualifier string

The alias name or "$LATEST".

UrlId string

A generated ID for the endpoint.

AuthorizationType string

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.

Cors FunctionUrlCorsArgs

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

FunctionArn string

The Amazon Resource Name (ARN) of the function.

FunctionName string

The name (or ARN) of the Lambda function.

FunctionUrl string

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

Qualifier string

The alias name or "$LATEST".

UrlId string

A generated ID for the endpoint.

authorizationType String

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.

cors FunctionUrlCorsArgs

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

functionArn String

The Amazon Resource Name (ARN) of the function.

functionName String

The name (or ARN) of the Lambda function.

functionUrl String

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

qualifier String

The alias name or "$LATEST".

urlId String

A generated ID for the endpoint.

authorizationType string

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.

cors FunctionUrlCorsArgs

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

functionArn string

The Amazon Resource Name (ARN) of the function.

functionName string

The name (or ARN) of the Lambda function.

functionUrl string

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

qualifier string

The alias name or "$LATEST".

urlId string

A generated ID for the endpoint.

authorization_type str

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.

cors FunctionUrlCorsArgs

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

function_arn str

The Amazon Resource Name (ARN) of the function.

function_name str

The name (or ARN) of the Lambda function.

function_url str

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

qualifier str

The alias name or "$LATEST".

url_id str

A generated ID for the endpoint.

authorizationType String

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.

cors Property Map

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

functionArn String

The Amazon Resource Name (ARN) of the function.

functionName String

The name (or ARN) of the Lambda function.

functionUrl String

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

qualifier String

The alias name or "$LATEST".

urlId String

A generated ID for the endpoint.

Supporting Types

FunctionUrlCors

AllowCredentials bool

Whether to allow cookies or other credentials in requests to the function URL. The default is false.

AllowHeaders List<string>

The HTTP headers that origins can include in requests to the function URL. For example: ["date", "keep-alive", "x-custom-header"].

AllowMethods List<string>

The HTTP methods that are allowed when calling the function URL. For example: ["GET", "POST", "DELETE"], or the wildcard character (["*"]).

AllowOrigins List<string>

The origins that can access the function URL. You can list any number of specific origins (or the wildcard character ("*")), separated by a comma. For example: ["https://www.example.com", "http://localhost:60905"].

ExposeHeaders List<string>

The HTTP headers in your function response that you want to expose to origins that call the function URL.

MaxAge int

The maximum amount of time, in seconds, that web browsers can cache results of a preflight request. By default, this is set to 0, which means that the browser doesn't cache results. The maximum value is 86400.

AllowCredentials bool

Whether to allow cookies or other credentials in requests to the function URL. The default is false.

AllowHeaders []string

The HTTP headers that origins can include in requests to the function URL. For example: ["date", "keep-alive", "x-custom-header"].

AllowMethods []string

The HTTP methods that are allowed when calling the function URL. For example: ["GET", "POST", "DELETE"], or the wildcard character (["*"]).

AllowOrigins []string

The origins that can access the function URL. You can list any number of specific origins (or the wildcard character ("*")), separated by a comma. For example: ["https://www.example.com", "http://localhost:60905"].

ExposeHeaders []string

The HTTP headers in your function response that you want to expose to origins that call the function URL.

MaxAge int

The maximum amount of time, in seconds, that web browsers can cache results of a preflight request. By default, this is set to 0, which means that the browser doesn't cache results. The maximum value is 86400.

allowCredentials Boolean

Whether to allow cookies or other credentials in requests to the function URL. The default is false.

allowHeaders List<String>

The HTTP headers that origins can include in requests to the function URL. For example: ["date", "keep-alive", "x-custom-header"].

allowMethods List<String>

The HTTP methods that are allowed when calling the function URL. For example: ["GET", "POST", "DELETE"], or the wildcard character (["*"]).

allowOrigins List<String>

The origins that can access the function URL. You can list any number of specific origins (or the wildcard character ("*")), separated by a comma. For example: ["https://www.example.com", "http://localhost:60905"].

exposeHeaders List<String>

The HTTP headers in your function response that you want to expose to origins that call the function URL.

maxAge Integer

The maximum amount of time, in seconds, that web browsers can cache results of a preflight request. By default, this is set to 0, which means that the browser doesn't cache results. The maximum value is 86400.

allowCredentials boolean

Whether to allow cookies or other credentials in requests to the function URL. The default is false.

allowHeaders string[]

The HTTP headers that origins can include in requests to the function URL. For example: ["date", "keep-alive", "x-custom-header"].

allowMethods string[]

The HTTP methods that are allowed when calling the function URL. For example: ["GET", "POST", "DELETE"], or the wildcard character (["*"]).

allowOrigins string[]

The origins that can access the function URL. You can list any number of specific origins (or the wildcard character ("*")), separated by a comma. For example: ["https://www.example.com", "http://localhost:60905"].

exposeHeaders string[]

The HTTP headers in your function response that you want to expose to origins that call the function URL.

maxAge number

The maximum amount of time, in seconds, that web browsers can cache results of a preflight request. By default, this is set to 0, which means that the browser doesn't cache results. The maximum value is 86400.

allow_credentials bool

Whether to allow cookies or other credentials in requests to the function URL. The default is false.

allow_headers Sequence[str]

The HTTP headers that origins can include in requests to the function URL. For example: ["date", "keep-alive", "x-custom-header"].

allow_methods Sequence[str]

The HTTP methods that are allowed when calling the function URL. For example: ["GET", "POST", "DELETE"], or the wildcard character (["*"]).

allow_origins Sequence[str]

The origins that can access the function URL. You can list any number of specific origins (or the wildcard character ("*")), separated by a comma. For example: ["https://www.example.com", "http://localhost:60905"].

expose_headers Sequence[str]

The HTTP headers in your function response that you want to expose to origins that call the function URL.

max_age int

The maximum amount of time, in seconds, that web browsers can cache results of a preflight request. By default, this is set to 0, which means that the browser doesn't cache results. The maximum value is 86400.

allowCredentials Boolean

Whether to allow cookies or other credentials in requests to the function URL. The default is false.

allowHeaders List<String>

The HTTP headers that origins can include in requests to the function URL. For example: ["date", "keep-alive", "x-custom-header"].

allowMethods List<String>

The HTTP methods that are allowed when calling the function URL. For example: ["GET", "POST", "DELETE"], or the wildcard character (["*"]).

allowOrigins List<String>

The origins that can access the function URL. You can list any number of specific origins (or the wildcard character ("*")), separated by a comma. For example: ["https://www.example.com", "http://localhost:60905"].

exposeHeaders List<String>

The HTTP headers in your function response that you want to expose to origins that call the function URL.

maxAge Number

The maximum amount of time, in seconds, that web browsers can cache results of a preflight request. By default, this is set to 0, which means that the browser doesn't cache results. The maximum value is 86400.

Import

Lambda function URLs can be imported using the function_name or function_name/qualifier, e.g.,

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

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes

This Pulumi package is based on the aws Terraform Provider.