HTTP(S) endpoint management for AWS Lambda functions, enabling direct invocation via HTTP requests without API Gateway. Function URLs provide a dedicated HTTP endpoint for your Lambda function with built-in authentication and CORS support.
Creates an HTTP(S) endpoint URL for a Lambda function.
class CreateFunctionUrlConfigCommand {
constructor(input: CreateFunctionUrlConfigCommandInput);
}
interface CreateFunctionUrlConfigCommandInput {
/** The name or ARN of the Lambda function */
FunctionName: string;
/** The alias name */
Qualifier?: string;
/** The type of authentication that your function URL uses */
AuthType: FunctionUrlAuthType;
/** Cross-origin resource sharing (CORS) settings for your function URL */
Cors?: Cors;
/** The invocation mode for your function (BUFFERED or RESPONSE_STREAM) */
InvokeMode?: InvokeMode;
}
interface CreateFunctionUrlConfigCommandOutput {
/** The HTTP URL endpoint for your function */
FunctionUrl: string;
/** The Amazon Resource Name (ARN) of your function */
FunctionArn: string;
/** The type of authentication that your function URL uses */
AuthType: FunctionUrlAuthType;
/** Cross-origin resource sharing (CORS) settings for your function URL */
Cors?: Cors;
/** When the function URL was created, in ISO-8601 format */
CreationTime: string;
/** The invocation mode for your function */
InvokeMode?: InvokeMode;
}Usage Example:
import { LambdaClient, CreateFunctionUrlConfigCommand } from "@aws-sdk/client-lambda";
const client = new LambdaClient({ region: "us-east-1" });
const command = new CreateFunctionUrlConfigCommand({
FunctionName: "my-function",
AuthType: "AWS_IAM", // or "NONE" for public access
Cors: {
AllowOrigins: ["*"],
AllowMethods: ["GET", "POST"],
AllowHeaders: ["content-type", "x-amz-date"],
MaxAge: 86400
},
InvokeMode: "BUFFERED"
});
const result = await client.send(command);
console.log(`Function URL created: ${result.FunctionUrl}`);Gets the configuration for a function's HTTP(S) endpoint.
class GetFunctionUrlConfigCommand {
constructor(input: GetFunctionUrlConfigCommandInput);
}
interface GetFunctionUrlConfigCommandInput {
/** The name or ARN of the Lambda function */
FunctionName: string;
/** The alias name */
Qualifier?: string;
}
interface GetFunctionUrlConfigCommandOutput {
/** The HTTP URL endpoint for your function */
FunctionUrl: string;
/** The Amazon Resource Name (ARN) of your function */
FunctionArn: string;
/** The type of authentication that your function URL uses */
AuthType: FunctionUrlAuthType;
/** Cross-origin resource sharing (CORS) settings for your function URL */
Cors?: Cors;
/** When the function URL was created, in ISO-8601 format */
CreationTime: string;
/** When the function URL configuration was last updated, in ISO-8601 format */
LastModifiedTime: string;
/** The invocation mode for your function */
InvokeMode?: InvokeMode;
}Updates the configuration for a function's HTTP(S) endpoint.
class UpdateFunctionUrlConfigCommand {
constructor(input: UpdateFunctionUrlConfigCommandInput);
}
interface UpdateFunctionUrlConfigCommandInput {
/** The name or ARN of the Lambda function */
FunctionName: string;
/** The alias name */
Qualifier?: string;
/** The type of authentication that your function URL uses */
AuthType?: FunctionUrlAuthType;
/** Cross-origin resource sharing (CORS) settings for your function URL */
Cors?: Cors;
/** The invocation mode for your function */
InvokeMode?: InvokeMode;
}
interface UpdateFunctionUrlConfigCommandOutput {
/** The HTTP URL endpoint for your function */
FunctionUrl: string;
/** The Amazon Resource Name (ARN) of your function */
FunctionArn: string;
/** The type of authentication that your function URL uses */
AuthType: FunctionUrlAuthType;
/** Cross-origin resource sharing (CORS) settings for your function URL */
Cors?: Cors;
/** When the function URL was created, in ISO-8601 format */
CreationTime: string;
/** When the function URL configuration was last updated, in ISO-8601 format */
LastModifiedTime: string;
/** The invocation mode for your function */
InvokeMode?: InvokeMode;
}Deletes the HTTP(S) endpoint for a Lambda function.
class DeleteFunctionUrlConfigCommand {
constructor(input: DeleteFunctionUrlConfigCommandInput);
}
interface DeleteFunctionUrlConfigCommandInput {
/** The name or ARN of the Lambda function */
FunctionName: string;
/** The alias name */
Qualifier?: string;
}Lists function URL configurations for a function.
class ListFunctionUrlConfigsCommand {
constructor(input: ListFunctionUrlConfigsCommandInput);
}
interface ListFunctionUrlConfigsCommandInput {
/** The name or ARN of the Lambda function */
FunctionName: string;
/** Specify the pagination token returned by a previous request */
Marker?: string;
/** The maximum number of function URLs to return in the response */
MaxItems?: number;
}
interface ListFunctionUrlConfigsCommandOutput {
/** A list of function URL configurations */
FunctionUrlConfigs: FunctionUrlConfig[];
/** The pagination token that's included if more results are available */
NextMarker?: string;
}// Authentication type for function URLs
enum FunctionUrlAuthType {
/** Restrict access to authenticated IAM users and roles only */
AWS_IAM = "AWS_IAM",
/** Allow public access without authentication */
NONE = "NONE"
}
// Invocation mode for function URLs
enum InvokeMode {
/** Lambda invokes your function using the standard Invoke API (6 MB payload limit) */
BUFFERED = "BUFFERED",
/** Lambda streams payload results as they become available (20 MB payload limit) */
RESPONSE_STREAM = "RESPONSE_STREAM"
}
// CORS configuration for function URLs
interface Cors {
/** Whether to allow cookies or other credentials in requests to your function URL */
AllowCredentials?: boolean;
/** The HTTP headers that origins can include in requests to your function URL */
AllowHeaders?: string[];
/** The HTTP methods that are allowed when calling your function URL */
AllowMethods?: string[];
/** The origins that can access your function URL */
AllowOrigins?: string[];
/** The HTTP headers in your function response that you want to expose to the web browser */
ExposeHeaders?: string[];
/** The maximum amount of time, in seconds, that web browsers can cache results of a preflight request */
MaxAge?: number;
}
// Function URL configuration object
interface FunctionUrlConfig {
/** The HTTP URL endpoint for your function */
FunctionUrl: string;
/** The Amazon Resource Name (ARN) of your function */
FunctionArn: string;
/** When the function URL was created, in ISO-8601 format */
CreationTime: string;
/** When the function URL configuration was last updated, in ISO-8601 format */
LastModifiedTime: string;
/** Cross-origin resource sharing (CORS) settings for your function URL */
Cors?: Cors;
/** The type of authentication that your function URL uses */
AuthType: FunctionUrlAuthType;
/** The invocation mode for your function */
InvokeMode?: InvokeMode;
}