Lambda

@aws-lite/lambda

Maintained by: @architect

Install

npm i @aws-lite/lambda

Optionally install types:

npm i -D @aws-lite/lambda-types

Methods

CreateFunction

Canonical AWS API doc

Properties

Code (object) [required]

Code payload to be run in Lambda; object can contain: ImageUri (ECR image), S3Bucket + S3Key + S3ObjectVersion (S3 bucket in the same region, key, and optional version), or ZipFile (base64-encoded zip)

More details (AWS)
Description (string)

Description of the function

Environment (object)

Environment variable configuration

More details (AWS)
FileSystemConfigs (array)

EFS file system connection settings

More details (AWS)
ImageConfig (object)

Container image configuration (overrides Docker file)

More details (AWS)
SnapStart (object)

SnapStart settings

More details (AWS)
VpcConfig (object)

VPC networking configuration

Example
await aws.Lambda.CreateFunction({
  Code: Object, // required
  FunctionName: String, // required
  Role: String, // required
  Architectures: Array,
  CodeSigningConfigArn: String,
  DeadLetterConfig: Object,
  Description: String,
  Environment: Object,
  EphemeralStorage: Object,
  FileSystemConfigs: Array,
  Handler: String,
  ImageConfig: Object,
  KMSKeyArn: String,
  Layers: Array,
  MemorySize: Number,
  PackageType: String,
  Publish: Boolean,
  Runtime: String,
  SnapStart: Object,
  Tags: Array,
  Timeout: Number,
  TracingConfig: Object,
  VpcConfig: Object,
})

DeleteFunctionConcurrency

Canonical AWS API doc

Properties

FunctionName (string) [required]

The name of the Lambda function, version, or alias

Example

await aws.Lambda.DeleteFunctionConcurrency({
  FunctionName: String, // required
})

GetFunctionConfiguration

Canonical AWS API doc

Properties

FunctionName (string) [required]

The name of the Lambda function, version, or alias

Qualifier (string)

Specify a version or alias to invoke a published version of the function

Example

await aws.Lambda.GetFunctionConfiguration({
  FunctionName: String, // required
  Qualifier: String,
})

Invoke

Canonical AWS API doc

Properties

FunctionName (string) [required]

The name of the Lambda function, version, or alias

Payload (array, object) [required]

Event payload to invoke function with

ClientContext (string)

Up to 3,583 bytes of base64-encoded data to pass to the function in the context object

InvocationType (string)

Set invocation type to one of: RequestResponse (default, synchronous), Event (asynchronous), DryRun (validate invoke request only)

LogType (string)

Set to Tail to include the execution log in the X-Amz-Log-Result response header of synchronously invoked functions

Qualifier (string)

Specify a version or alias to invoke a published version of the function

Example

await aws.Lambda.Invoke({
  FunctionName: String, // required
  Payload: Array || Object, // required
  ClientContext: String,
  InvocationType: String,
  LogType: String,
  Qualifier: String,
})

PutFunctionConcurrency

Canonical AWS API doc

Properties

FunctionName (string) [required]

The name of the Lambda function, version, or alias

ReservedConcurrentExecutions (number) [required]

number of simultaneous executions to reserve

Example

await aws.Lambda.PutFunctionConcurrency({
  FunctionName: String, // required
  ReservedConcurrentExecutions: Number, // required
})

UpdateFunctionCode

Canonical AWS API doc

Properties

FunctionName (string) [required]

The name of the Lambda function, version, or alias

Architectures (array)

System architecture, array can contain either x86_64 (default) or arm64

DryRun (string)

Validate the request parameters and access permissions without modifying the function code (true)

ImageUri (string)

URI of a container image in the Amazon ECR registry (if not using a .zip file)

Publish (boolean)

Publish a new version after after updating the code (true); effectively the same as calling PublishVersion

RevisionId (string)

Update the function config only if the current revision ID matches the specified RevisionId; used to avoid modifying a function that has changed since you last read it

S3Bucket (string)

S3 bucket containing the key of the deployment package; must be in the same region

S3Key (string)

S3 key of the deployment package (must be a .zip file)

S3ObjectVersion (string)

S3 object version to use, if applicable

ZipFile (string, buffer)

File path or raw buffer of the .zip deployment package

Example

await aws.Lambda.UpdateFunctionCode({
  FunctionName: String, // required
  Architectures: Array,
  DryRun: String,
  ImageUri: String,
  Publish: Boolean,
  RevisionId: String,
  S3Bucket: String,
  S3Key: String,
  S3ObjectVersion: String,
  ZipFile: String || ,
})

UpdateFunctionConfiguration

Canonical AWS API doc

Properties

FunctionName (string) [required]

The name of the Lambda function, version, or alias

DeadLetterConfig (object)

Dead-letter queue configuration

More details (AWS)
EphemeralStorage (object)

Size of the function /tmp directory (in MB), from 512 (default) to 10240

More details (AWS)
Handler (string)

The name of the handler file and method method within your code that Lambda calls to run your function (e.g. index.handler)

More details (AWS)
KMSKeyArn (string)

ARN of the Key Management Service (KMS) customer managed key used to encrypt your function environment variables

Layers (array)

List of function layer ARNs (including version) to add to the function execution environment

MemorySize (number)

Amount of memory available (in MB) at runtime from 128 to 10240; increasing memory also increases CPU allocation

RevisionId (string)

Update the function config only if the current revision ID matches the specified RevisionId; used to avoid modifying a function that has changed since you last read it

Role (string)

ARN of the function’s execution role

Runtime (string)

Runtime identifier

More details (AWS)
Timeout (number)

Time (in seconds) a function is allowed to run before being stopped, from 3 (default) to 900

TracingConfig (object)

Sample and trace a subset of incoming requests with X-Ray

More details (AWS)

Example

await aws.Lambda.UpdateFunctionConfiguration({
  FunctionName: String, // required
  DeadLetterConfig: Object,
  Description: String,
  Environment: Object,
  EphemeralStorage: Object,
  FileSystemConfigs: Array,
  Handler: String,
  ImageConfig: Object,
  KMSKeyArn: String,
  Layers: Array,
  MemorySize: Number,
  RevisionId: String,
  Role: String,
  Runtime: String,
  SnapStart: Object,
  Timeout: Number,
  TracingConfig: Object,
  VpcConfig: Object,
})

Methods yet to be implemented

Please help out by opening a PR!

aws-lite is an Apache 2.0-licensed open source project under the umbrella of OpenJS Foundation Architect. aws-lite is not in any way affiliated with Amazon Web Services, Inc. (AWS). All names and trademarks are the property of their respective owners.