Lambda Function URL Module
This module used to create a AWS Lambda function URLs for existing Lambda function. A function URL is a dedicated HTTP(S) endpoint for a Lambda function.
When you create a function URL, Lambda automatically generates a unique URL endpoint for you. Once you create a function URL, its URL endpoint never changes. Function URLs are dual stack-enabled, supporting IPv4 and IPv6. After you configure a function URL for your function, you can invoke your function through its HTTP(S) endpoint via a web browser, curl, Postman, or any HTTP client.
Function URL endpoints have the following format:
https://<url-id>.lambda-url.<region>.on.aws
Background info
For more information on AWS Lambda, how it works, and how to configure your functions, check out the lambda module documentation.
Sample Usage
- Terraform
- Terragrunt
# ------------------------------------------------------------------------------------------------------
# DEPLOY GRUNTWORK'S LAMBDA-FUNCTION-URL MODULE
# ------------------------------------------------------------------------------------------------------
module "lambda_function_url" {
source = "git::git@github.com:gruntwork-io/terraform-aws-lambda.git//modules/lambda-function-url?ref=v0.23.0"
# ----------------------------------------------------------------------------------------------------
# REQUIRED VARIABLES
# ----------------------------------------------------------------------------------------------------
# Alias name of the lambda function
alias = <string>
# Autherisation type of genrating function url
authorization_type = <string>
# CORS configuration for the Lambda function URL
cors_config = <object(
allow_credentials = bool
allow_origins = list(string)
allow_methods = list(string)
allow_headers = list(string)
expose_headers = list(string)
max_age = number
)>
# The name of the iam role to be created
iam_role_name = <string>
# The name of the Lambda function. Used to generate function url
lambda_function_name = <string>
# ----------------------------------------------------------------------------------------------------
# OPTIONAL VARIABLES
# ----------------------------------------------------------------------------------------------------
# The AWS region in which all resources will be created
aws_region = "us-east-1"
}
# ------------------------------------------------------------------------------------------------------
# DEPLOY GRUNTWORK'S LAMBDA-FUNCTION-URL MODULE
# ------------------------------------------------------------------------------------------------------
terraform {
source = "git::git@github.com:gruntwork-io/terraform-aws-lambda.git//modules/lambda-function-url?ref=v0.23.0"
}
inputs = {
# ----------------------------------------------------------------------------------------------------
# REQUIRED VARIABLES
# ----------------------------------------------------------------------------------------------------
# Alias name of the lambda function
alias = <string>
# Autherisation type of genrating function url
authorization_type = <string>
# CORS configuration for the Lambda function URL
cors_config = <object(
allow_credentials = bool
allow_origins = list(string)
allow_methods = list(string)
allow_headers = list(string)
expose_headers = list(string)
max_age = number
)>
# The name of the iam role to be created
iam_role_name = <string>
# The name of the Lambda function. Used to generate function url
lambda_function_name = <string>
# ----------------------------------------------------------------------------------------------------
# OPTIONAL VARIABLES
# ----------------------------------------------------------------------------------------------------
# The AWS region in which all resources will be created
aws_region = "us-east-1"
}
Reference
- Inputs
- Outputs
Required
alias
stringAlias name of the lambda function
authorization_type
stringAutherisation type of genrating function url
cors_config
object(…)CORS configuration for the Lambda function URL
object({
allow_credentials = bool
allow_origins = list(string)
allow_methods = list(string)
allow_headers = list(string)
expose_headers = list(string)
max_age = number
})
iam_role_name
stringThe name of the iam role to be created
lambda_function_name
stringThe name of the Lambda function. Used to generate function url
Optional
aws_region
stringThe AWS region in which all resources will be created
"us-east-1"
The Amazon Resource Name (ARN) of the function.
The HTTP URL endpoint for the function in the format https://<url_id>.lambda-url.<region>.on.aws/
A generated ID for the endpoint.