Comprehensive lifecycle management for AWS Lambda functions including creation, updating, configuration, deletion, versioning, and monitoring.
Creates a new Lambda function with the specified configuration.
class CreateFunctionCommand {
constructor(input: CreateFunctionCommandInput);
}
interface CreateFunctionCommandInput {
/** The name or ARN of the Lambda function */
FunctionName: string;
/** The identifier of the function's runtime language */
Runtime?: Runtime;
/** The Amazon Resource Name (ARN) of the function's execution role */
Role: string;
/** The name of the method within your code that Lambda calls to execute your function */
Handler?: string;
/** The code for the function */
Code: FunctionCode;
/** A description of the function */
Description?: string;
/** The amount of time (in seconds) that Lambda allows a function to run before stopping it */
Timeout?: number;
/** The amount of memory available to the function at runtime */
MemorySize?: number;
/** Environment variables that are accessible from function code during execution */
Environment?: Environment;
/** For network connectivity to AWS resources in a VPC, specify a list of security groups and subnets */
VpcConfig?: VpcConfig;
/** The type of deployment package */
PackageType?: PackageType;
/** Dead letter queue configuration that specifies the queue or topic where Lambda sends asynchronous events */
DeadLetterConfig?: DeadLetterConfig;
/** Set Mode to Active to sample and trace a subset of incoming requests with X-Ray */
TracingConfig?: TracingConfig;
/** A list of function layers to add to the function's execution environment */
Layers?: string[];
/** Connection settings for an Amazon EFS file system */
FileSystemConfigs?: FileSystemConfig[];
/** Container image configuration values that override the values in the container image Docker file */
ImageConfig?: ImageConfig;
/** To enable code signing for this function, specify the ARN of a code-signing configuration */
CodeSigningConfigArn?: string;
/** The instruction set architecture that the function supports (x86_64 or arm64) */
Architectures?: Architecture[];
/** The size of the function's /tmp directory in MB */
EphemeralStorage?: EphemeralStorage;
/** The function's SnapStart setting */
SnapStart?: SnapStart;
/** Set to true to publish the first version of your function during the creation process */
Publish?: boolean;
/** List of tags to apply to the function */
Tags?: Record<string, string>;
/** The ARN of the Key Management Service (KMS) customer managed key used to encrypt the function's environment variables */
KMSKeyArn?: string;
/** The function's Amazon CloudWatch Logs configuration settings */
LoggingConfig?: LoggingConfig;
}
interface CreateFunctionCommandOutput extends FunctionConfiguration {}Usage Example:
import { LambdaClient, CreateFunctionCommand } from "@aws-sdk/client-lambda";
const client = new LambdaClient({ region: "us-east-1" });
const command = new CreateFunctionCommand({
FunctionName: "my-function",
Runtime: "nodejs18.x",
Role: "arn:aws:iam::123456789012:role/lambda-role",
Handler: "index.handler",
Code: {
ZipFile: Buffer.from("exports.handler = async () => 'Hello World';")
},
Description: "My first Lambda function",
Timeout: 30,
MemorySize: 128,
Environment: {
Variables: {
NODE_ENV: "production"
}
}
});
const result = await client.send(command);Retrieves information about a Lambda function, including its configuration and code details.
class GetFunctionCommand {
constructor(input: GetFunctionCommandInput);
}
interface GetFunctionCommandInput {
/** The name or ARN of the Lambda function, version, or alias */
FunctionName: string;
/** Specify a version or alias to get details about a published version of the function */
Qualifier?: string;
}
interface GetFunctionCommandOutput {
/** The configuration of the function or version */
Configuration?: FunctionConfiguration;
/** The deployment package of the function or version */
Code?: FunctionCodeLocation;
/** The function's tags */
Tags?: Record<string, string>;
/** The function's concurrency and provisioned-concurrency settings */
Concurrency?: Concurrency;
}
class GetFunctionConfigurationCommand {
constructor(input: GetFunctionConfigurationCommandInput);
}
interface GetFunctionConfigurationCommandInput {
/** The name or ARN of the Lambda function, version, or alias */
FunctionName: string;
/** Specify a version or alias to get details about a published version of the function */
Qualifier?: string;
}
interface GetFunctionConfigurationCommandOutput extends FunctionConfiguration {}Updates the code of a Lambda function by uploading a .zip file archive or container image to the function.
class UpdateFunctionCodeCommand {
constructor(input: UpdateFunctionCodeCommandInput);
}
interface UpdateFunctionCodeCommandInput {
/** The name or ARN of the Lambda function */
FunctionName: string;
/** The base64-encoded contents of the deployment package */
ZipFile?: Uint8Array;
/** An Amazon S3 bucket in the same Amazon Web Services Region as your function */
S3Bucket?: string;
/** The Amazon S3 key of the deployment package */
S3Key?: string;
/** For versioned objects, the version of the deployment package object to use */
S3ObjectVersion?: string;
/** URI of a container image in the Amazon ECR registry */
ImageUri?: string;
/** Set to true to publish a new version of the function after updating the code */
Publish?: boolean;
/** Set to true to validate the request parameters and access permissions without modifying the function code */
DryRun?: boolean;
/** Update the function only if the revision ID matches the ID that's specified */
RevisionId?: string;
/** The instruction set architecture that the function supports (x86_64 or arm64) */
Architectures?: Architecture[];
}
interface UpdateFunctionCodeCommandOutput extends FunctionConfiguration {}Modify the version-specific settings of a Lambda function.
class UpdateFunctionConfigurationCommand {
constructor(input: UpdateFunctionConfigurationCommandInput);
}
interface UpdateFunctionConfigurationCommandInput {
/** The name or ARN of the Lambda function */
FunctionName: string;
/** The Amazon Resource Name (ARN) of the function's execution role */
Role?: string;
/** The name of the method within your code that Lambda calls to execute your function */
Handler?: string;
/** A description of the function */
Description?: string;
/** The amount of time (in seconds) that Lambda allows a function to run before stopping it */
Timeout?: number;
/** The amount of memory available to the function at runtime */
MemorySize?: number;
/** For network connectivity to AWS resources in a VPC, specify a list of security groups and subnets */
VpcConfig?: VpcConfig;
/** Environment variables that are accessible from function code during execution */
Environment?: Environment;
/** The identifier of the function's runtime language */
Runtime?: Runtime;
/** Dead letter queue configuration that specifies the queue or topic where Lambda sends asynchronous events */
DeadLetterConfig?: DeadLetterConfig;
/** ARN of the Key Management Service (KMS) customer managed key that's used to encrypt your function's environment variables */
KMSKeyArn?: string;
/** Set Mode to Active to sample and trace a subset of incoming requests with X-Ray */
TracingConfig?: TracingConfig;
/** Update the function only if the revision ID matches the ID that's specified */
RevisionId?: string;
/** A list of function layers to add to the function's execution environment */
Layers?: string[];
/** Connection settings for an Amazon EFS file system */
FileSystemConfigs?: FileSystemConfig[];
/** Container image configuration values that override the values in the container image Dockerfile */
ImageConfig?: ImageConfig;
/** The size of the function's /tmp directory in MB */
EphemeralStorage?: EphemeralStorage;
/** The function's SnapStart setting */
SnapStart?: SnapStart;
}
interface UpdateFunctionConfigurationCommandOutput extends FunctionConfiguration {}Deletes a Lambda function. To delete a specific function version, use the Qualifier parameter.
class DeleteFunctionCommand {
constructor(input: DeleteFunctionCommandInput);
}
interface DeleteFunctionCommandInput {
/** The name or ARN of the Lambda function or version */
FunctionName: string;
/** Specify a version to delete. You can't delete a version that an alias references */
Qualifier?: string;
}Returns a list of Lambda functions, with the version-specific configuration of each.
class ListFunctionsCommand {
constructor(input: ListFunctionsCommandInput);
}
interface ListFunctionsCommandInput {
/** For the us-east-1 Region only, set to ALL to include all functions */
MasterRegion?: string;
/** Set to ALL to include entries for all published versions of each function */
FunctionVersion?: FunctionVersion;
/** Specify the pagination token that's returned by a previous request to retrieve the next page of results */
Marker?: string;
/** The maximum number of functions to return in the response */
MaxItems?: number;
}
interface ListFunctionsCommandOutput {
/** The pagination token that's included if more results are available */
NextMarker?: string;
/** A list of Lambda functions */
Functions?: FunctionConfiguration[];
}Creates a version from the current code and configuration of a function.
class PublishVersionCommand {
constructor(input: PublishVersionCommandInput);
}
interface PublishVersionCommandInput {
/** The name or ARN of the Lambda function */
FunctionName: string;
/** Only publish a version if the hash value matches the value that's specified */
CodeSha256?: string;
/** A description for the version to override the description in the function configuration */
Description?: string;
/** Only update the function if the revision ID matches the ID that's specified */
RevisionId?: string;
}
interface PublishVersionCommandOutput extends FunctionConfiguration {}
class ListVersionsByFunctionCommand {
constructor(input: ListVersionsByFunctionCommandInput);
}
interface ListVersionsByFunctionCommandInput {
/** The name or ARN of the Lambda function */
FunctionName: string;
/** Specify the pagination token that's returned by a previous request to retrieve the next page of results */
Marker?: string;
/** The maximum number of versions to return in the response */
MaxItems?: number;
}
interface ListVersionsByFunctionCommandOutput {
/** The pagination token that's included if more results are available */
NextMarker?: string;
/** A list of Lambda function versions */
Versions?: FunctionConfiguration[];
}Retrieves details about your account's limits and usage in an Amazon Web Services Region.
class GetAccountSettingsCommand {
constructor(input: GetAccountSettingsCommandInput);
}
interface GetAccountSettingsCommandInput {}
interface GetAccountSettingsCommandOutput {
/** Limits that are related to concurrency and storage */
AccountLimit?: AccountLimit;
/** The number of functions and amount of storage in use */
AccountUsage?: AccountUsage;
}interface FunctionCode {
/** The base64-encoded contents of the deployment package */
ZipFile?: Uint8Array;
/** An Amazon S3 bucket in the same Amazon Web Services Region as your function */
S3Bucket?: string;
/** The Amazon S3 key of the deployment package */
S3Key?: string;
/** For versioned objects, the version of the deployment package object to use */
S3ObjectVersion?: string;
/** URI of a container image in the Amazon ECR registry */
ImageUri?: string;
}
interface Environment {
/** Environment variable key-value pairs */
Variables?: Record<string, string>;
}
interface VpcConfig {
/** A list of VPC subnet IDs */
SubnetIds?: string[];
/** A list of VPC security group IDs */
SecurityGroupIds?: string[];
}
interface DeadLetterConfig {
/** The Amazon Resource Name (ARN) of an Amazon SQS queue or Amazon SNS topic */
TargetArn?: string;
}
interface TracingConfig {
/** The tracing mode */
Mode?: TracingMode;
}
interface FileSystemConfig {
/** The Amazon Resource Name (ARN) of the Amazon EFS access point */
Arn: string;
/** The path where the function can access the file system, starting with /mnt/ */
LocalMountPath: string;
}
interface ImageConfig {
/** Specifies the entry point to their application, which is typically the location of the runtime executable */
EntryPoint?: string[];
/** Specifies parameters that you want to pass in with ENTRYPOINT */
Command?: string[];
/** Specifies the working directory */
WorkingDirectory?: string;
}
interface EphemeralStorage {
/** The size of the function's /tmp directory */
Size: number;
}
interface SnapStart {
/** Set to PublishedVersions to create a snapshot of the initialized execution environment */
ApplyOn?: SnapStartApplyOn;
}
interface LoggingConfig {
/** The log format */
LogFormat?: LogFormat;
/** The log group name */
LogGroup?: string;
/** Set this property to filter the application logs for your function */
ApplicationLogLevel?: ApplicationLogLevel;
/** Set this property to filter the system logs for your function */
SystemLogLevel?: SystemLogLevel;
}
enum TracingMode {
Active = "Active",
PassThrough = "PassThrough"
}
enum SnapStartApplyOn {
PublishedVersions = "PublishedVersions",
None = "None"
}
enum FunctionVersion {
ALL = "ALL"
}
enum LogFormat {
JSON = "JSON",
Text = "Text"
}
enum ApplicationLogLevel {
TRACE = "TRACE",
DEBUG = "DEBUG",
INFO = "INFO",
WARN = "WARN",
ERROR = "ERROR",
FATAL = "FATAL"
}
enum SystemLogLevel {
DEBUG = "DEBUG",
INFO = "INFO",
WARN = "WARN"
}