Class: AWS.Lambda (2014-11-11)

Inherits:
AWS.Service show all
Identifier:
lambda
API Version:
2014-11-11
Defined in:
(unknown)

Overview

Constructs a service interface object. Each API operation is exposed as a function on service.

Service Description

Overview

This is the AWS Lambda API Reference. The AWS Lambda Developer Guide provides additional information. For the service overview, go to What is AWS Lambda, and for information about how the service works, go to AWS LambdaL How it Works in the AWS Lambda Developer Guide.

Sending a Request Using Lambda

var lambda = new AWS.Lambda();
lambda.addEventSource(params, function (err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Locking the API Version

In order to ensure that the Lambda object uses this specific API, you can construct the object by passing the apiVersion option to the constructor:

var lambda = new AWS.Lambda({apiVersion: '2014-11-11'});

You can also set the API version globally in AWS.config.apiVersions using the lambda service identifier:

AWS.config.apiVersions = {
  lambda: '2014-11-11',
  // other service API versions
};

var lambda = new AWS.Lambda();

Version:

  • 2014-11-11

Constructor Summary

Property Summary

Properties inherited from AWS.Service

apiVersions

Method Summary

Methods inherited from AWS.Service

makeRequest, makeUnauthenticatedRequest, waitFor, setupRequestListeners, defineService

Constructor Details

new AWS.Lambda(options = {}) ⇒ Object

Constructs a service object. This object has one method for each API operation.

Examples:

Constructing a Lambda object

var lambda = new AWS.Lambda({apiVersion: '2014-11-11'});

Options Hash (options):

  • params (map)

    An optional map of parameters to bind to every request sent by this service object. For more information on bound parameters, see "Working with Services" in the Getting Started Guide.

  • endpoint (String)

    The endpoint URI to send requests to. The default endpoint is built from the configured region. The endpoint should be a string like 'https://{service}.{region}.amazonaws.com'.

  • accessKeyId (String)

    your AWS access key ID.

  • secretAccessKey (String)

    your AWS secret access key.

  • sessionToken (AWS.Credentials)

    the optional AWS session token to sign requests with.

  • credentials (AWS.Credentials)

    the AWS credentials to sign requests with. You can either specify this object, or specify the accessKeyId and secretAccessKey options directly.

  • credentialProvider (AWS.CredentialProviderChain)

    the provider chain used to resolve credentials if no static credentials property is set.

  • region (String)

    the region to send service requests to. See AWS.Lambda_20141111.region for more information.

  • maxRetries (Integer)

    the maximum amount of retries to attempt with a request. See AWS.Lambda_20141111.maxRetries for more information.

  • maxRedirects (Integer)

    the maximum amount of redirects to follow with a request. See AWS.Lambda_20141111.maxRedirects for more information.

  • sslEnabled (Boolean)

    whether to enable SSL for requests.

  • paramValidation (Boolean|map)

    whether input parameters should be validated against the operation description before sending the request. Defaults to true. Pass a map to enable any of the following specific validation features:

    • min [Boolean] — Validates that a value meets the min constraint. This is enabled by default when paramValidation is set to true.
    • max [Boolean] — Validates that a value meets the max constraint.
    • pattern [Boolean] — Validates that a string value matches a regular expression.
    • enum [Boolean] — Validates that a string value matches one of the allowable enum values.
  • computeChecksums (Boolean)

    whether to compute checksums for payload bodies when the service accepts it (currently supported in S3 only)

  • convertResponseTypes (Boolean)

    whether types are converted when parsing response data. Currently only supported for JSON based services. Turning this off may improve performance on large response payloads. Defaults to true.

  • correctClockSkew (Boolean)

    whether to apply a clock skew correction and retry requests that fail because of an skewed client clock. Defaults to false.

  • s3ForcePathStyle (Boolean)

    whether to force path style URLs for S3 objects.

  • s3BucketEndpoint (Boolean)

    whether the provided endpoint addresses an individual bucket (false if it addresses the root API endpoint). Note that setting this configuration option requires an endpoint to be provided explicitly to the service constructor.

  • s3DisableBodySigning (Boolean)

    whether S3 body signing should be disabled when using signature version v4. Body signing can only be disabled when using https. Defaults to true.

  • retryDelayOptions (map)

    A set of options to configure the retry delay on retryable errors. Currently supported options are:

    • base [Integer] — The base number of milliseconds to use in the exponential backoff for operation retries. Defaults to 100 ms for all services except DynamoDB, where it defaults to 50ms.
    • customBackoff [function] — A custom function that accepts a retry count and returns the amount of time to delay in milliseconds. The base option will be ignored if this option is supplied.
  • httpOptions (map)

    A set of options to pass to the low-level HTTP request. Currently supported options are:

    • proxy [String] — the URL to proxy requests through
    • agent [http.Agent, https.Agent] — the Agent object to perform HTTP requests with. Used for connection pooling. Defaults to the global agent (http.globalAgent) for non-SSL connections. Note that for SSL connections, a special Agent object is used in order to enable peer certificate verification. This feature is only available in the Node.js environment.
    • connectTimeout [Integer] — Sets the socket to timeout after failing to establish a connection with the server after connectTimeout milliseconds. This timeout has no effect once a socket connection has been established.
    • timeout [Integer] — Sets the socket to timeout after timeout milliseconds of inactivity on the socket. Defaults to two minutes (120000).
    • xhrAsync [Boolean] — Whether the SDK will send asynchronous HTTP requests. Used in the browser environment only. Set to false to send requests synchronously. Defaults to true (async on).
    • xhrWithCredentials [Boolean] — Sets the "withCredentials" property of an XMLHttpRequest object. Used in the browser environment only. Defaults to false.
  • apiVersion (String, Date)

    a String in YYYY-MM-DD format (or a date) that represents the latest possible API version that can be used in all services (unless overridden by apiVersions). Specify 'latest' to use the latest possible version.

  • apiVersions (map<String, String|Date>)

    a map of service identifiers (the lowercase service class name) with the API version to use when instantiating a service. Specify 'latest' for each individual that can use the latest available version.

  • logger (#write, #log)

    an object that responds to .write() (like a stream) or .log() (like the console object) in order to log information about requests

  • systemClockOffset (Number)

    an offset value in milliseconds to apply to all signing times. Use this to compensate for clock skew when your system may be out of sync with the service time. Note that this configuration option can only be applied to the global AWS.config object and cannot be overridden in service-specific configuration. Defaults to 0 milliseconds.

  • signatureVersion (String)

    the signature version to sign requests with (overriding the API configuration). Possible values are: 'v2', 'v3', 'v4'.

  • signatureCache (Boolean)

    whether the signature to sign requests with (overriding the API configuration) is cached. Only applies to the signature version 'v4'. Defaults to true.

  • dynamoDbCrc32 (Boolean)

    whether to validate the CRC32 checksum of HTTP response bodies returned by DynamoDB. Default: true.

  • useAccelerateEndpoint (Boolean)

    Whether to use the S3 Transfer Acceleration endpoint with the S3 service. Default: false.

  • clientSideMonitoring (Boolean)

    whether to collect and publish this client's performance metrics of all its API requests.

  • endpointDiscoveryEnabled (Boolean)

    whether to enable endpoint discovery for operations that allow optionally using an endpoint returned by the service. Defaults to 'false'

  • endpointCacheSize (Number)

    the size of the global cache storing endpoints from endpoint discovery operations. Once endpoint cache is created, updating this setting cannot change existing cache size. Defaults to 1000

  • hostPrefixEnabled (Boolean)

    whether to marshal request parameters to the prefix of hostname. Defaults to true.

Property Details

endpointAWS.Endpoint (readwrite)

Returns an Endpoint object representing the endpoint URL for service requests.

Returns:

  • (AWS.Endpoint)

    an Endpoint object representing the endpoint URL for service requests.

Method Details

addEventSource(params = {}, callback) ⇒ AWS.Request

Identifies a stream as an event source for an AWS Lambda function. It can be either an Amazon Kinesis stream or a Amazon DynamoDB stream. AWS Lambda invokes the specified function when records are posted to the stream.

This is the pull model, where AWS Lambda invokes the function. For more information, go to AWS Lambda: How it Works in the AWS Lambda Developer Guide.

This association between an Amazon Kinesis stream and an AWS Lambda function is called the event source mapping. You provide the configuration information (for example, which stream to read from and which AWS Lambda function to invoke) for the event source mapping in the request body.

Each event source, such as a Kinesis stream, can only be associated with one AWS Lambda function. If you call AddEventSource for an event source that is already mapped to another AWS Lambda function, the existing mapping is updated to call the new function instead of the old one.

This operation requires permission for the iam:PassRole action for the IAM role. It also requires permission for the lambda:AddEventSource action.

Examples:

Calling the addEventSource operation

var params = {
  EventSource: 'STRING_VALUE', /* required */
  FunctionName: 'STRING_VALUE', /* required */
  Role: 'STRING_VALUE', /* required */
  BatchSize: 'NUMBER_VALUE',
  Parameters: {
    '<String>': 'STRING_VALUE',
    /* '<String>': ... */
  }
};
lambda.addEventSource(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • EventSource — (String)

      The Amazon Resource Name (ARN) of the Amazon Kinesis stream that is the event source. Any record added to this stream causes AWS Lambda to invoke your Lambda function. AWS Lambda POSTs the Amazon Kinesis event, containing records, to your Lambda function as JSON.

    • FunctionName — (String)

      The Lambda function to invoke when AWS Lambda detects an event on the stream.

    • Role — (String)

      The ARN of the IAM role (invocation role) that AWS Lambda can assume to read from the stream and invoke the function.

    • BatchSize — (Integer)

      The largest number of records that AWS Lambda will give to your function in a single event. The default is 100 records.

    • Parameters — (map<String>)

      A map (key-value pairs) defining the configuration for AWS Lambda to use when reading the event source. Currently, AWS Lambda supports only the InitialPositionInStream key. The valid values are: "TRIM_HORIZON" and "LATEST". The default value is "TRIM_HORIZON". For more information, go to ShardIteratorType in the Amazon Kinesis Service API Reference.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • UUID — (String)

        The AWS Lambda assigned opaque identifier for the mapping.

      • BatchSize — (Integer)

        The largest number of records that AWS Lambda will POST in the invocation request to your function.

      • EventSource — (String)

        The Amazon Resource Name (ARN) of the Amazon Kinesis stream that is the source of events.

      • FunctionName — (String)

        The Lambda function to invoke when AWS Lambda detects an event on the stream.

      • Parameters — (map<String>)

        The map (key-value pairs) defining the configuration for AWS Lambda to use when reading the event source.

      • Role — (String)

        The ARN of the IAM role (invocation role) that AWS Lambda can assume to read from the stream and invoke the function.

      • LastModified — (Date)

        The UTC time string indicating the last time the event mapping was updated.

      • IsActive — (Boolean)

        Indicates whether the event source mapping is currently honored. Events are only processes if IsActive is true.

      • Status — (String)

        The description of the health of the event source mapping. Valid values are: "PENDING", "OK", and "PROBLEM:message". Initially this staus is "PENDING". When AWS Lambda begins processing events, it changes the status to "OK".

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

deleteFunction(params = {}, callback) ⇒ AWS.Request

Deletes the specified Lambda function code and configuration.

This operation requires permission for the lambda:DeleteFunction action.

Examples:

Calling the deleteFunction operation

var params = {
  FunctionName: 'STRING_VALUE' /* required */
};
lambda.deleteFunction(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • FunctionName — (String)

      The Lambda function to delete.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

getEventSource(params = {}, callback) ⇒ AWS.Request

Returns configuration information for the specified event source mapping (see AddEventSource).

This operation requires permission for the lambda:GetEventSource action.

Examples:

Calling the getEventSource operation

var params = {
  UUID: 'STRING_VALUE' /* required */
};
lambda.getEventSource(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UUID — (String)

      The AWS Lambda assigned ID of the event source mapping.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • UUID — (String)

        The AWS Lambda assigned opaque identifier for the mapping.

      • BatchSize — (Integer)

        The largest number of records that AWS Lambda will POST in the invocation request to your function.

      • EventSource — (String)

        The Amazon Resource Name (ARN) of the Amazon Kinesis stream that is the source of events.

      • FunctionName — (String)

        The Lambda function to invoke when AWS Lambda detects an event on the stream.

      • Parameters — (map<String>)

        The map (key-value pairs) defining the configuration for AWS Lambda to use when reading the event source.

      • Role — (String)

        The ARN of the IAM role (invocation role) that AWS Lambda can assume to read from the stream and invoke the function.

      • LastModified — (Date)

        The UTC time string indicating the last time the event mapping was updated.

      • IsActive — (Boolean)

        Indicates whether the event source mapping is currently honored. Events are only processes if IsActive is true.

      • Status — (String)

        The description of the health of the event source mapping. Valid values are: "PENDING", "OK", and "PROBLEM:message". Initially this staus is "PENDING". When AWS Lambda begins processing events, it changes the status to "OK".

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

getFunction(params = {}, callback) ⇒ AWS.Request

Returns the configuration information of the Lambda function and a presigned URL link to the .zip file you uploaded with UploadFunction so you can download the .zip file. Note that the URL is valid for up to 10 minutes. The configuration information is the same information you provided as parameters when uploading the function.

This operation requires permission for the lambda:GetFunction action.

Examples:

Calling the getFunction operation

var params = {
  FunctionName: 'STRING_VALUE' /* required */
};
lambda.getFunction(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • FunctionName — (String)

      The Lambda function name.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Configuration — (map)

        A complex type that describes function metadata.

        • FunctionName — (String)

          The name of the function.

        • FunctionARN — (String)

          The Amazon Resource Name (ARN) assigned to the function.

        • ConfigurationId — (String)

          A Lambda-assigned unique identifier for the current function code and related configuration.

        • Runtime — (String)

          The runtime environment for the Lambda function.

          Possible values include:
          • "nodejs"
        • Role — (String)

          The Amazon Resource Name (ARN) of the IAM role that Lambda assumes when it executes your function to access any other Amazon Web Services (AWS) resources.

        • Handler — (String)

          The function Lambda calls to begin executing your function.

        • Mode — (String)

          The type of the Lambda function you uploaded.

          Possible values include:
          • "event"
        • CodeSize — (Integer)

          The size, in bytes, of the function .zip file you uploaded.

        • Description — (String)

          The user-provided description.

        • Timeout — (Integer)

          The function execution time at which Lambda should terminate the function. Because the execution time has cost implications, we recommend you set this value based on your expected execution time. The default is 3 seconds.

        • MemorySize — (Integer)

          The memory size, in MB, you configured for the function. Must be a multiple of 64 MB.

        • LastModified — (Date)

          The timestamp of the last time you updated the function.

      • Code — (map)

        The object for the Lambda function location.

        • RepositoryType — (String)

          The repository from which you can download the function.

        • Location — (String)

          The presigned URL you can use to download the function's .zip file that you previously uploaded. The URL is valid for up to 10 minutes.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

getFunctionConfiguration(params = {}, callback) ⇒ AWS.Request

Returns the configuration information of the Lambda function. This the same information you provided as parameters when uploading the function by using UploadFunction.

This operation requires permission for the lambda:GetFunctionConfiguration operation.

Examples:

Calling the getFunctionConfiguration operation

var params = {
  FunctionName: 'STRING_VALUE' /* required */
};
lambda.getFunctionConfiguration(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • FunctionName — (String)

      The name of the Lambda function for which you want to retrieve the configuration information.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • FunctionName — (String)

        The name of the function.

      • FunctionARN — (String)

        The Amazon Resource Name (ARN) assigned to the function.

      • ConfigurationId — (String)

        A Lambda-assigned unique identifier for the current function code and related configuration.

      • Runtime — (String)

        The runtime environment for the Lambda function.

        Possible values include:
        • "nodejs"
      • Role — (String)

        The Amazon Resource Name (ARN) of the IAM role that Lambda assumes when it executes your function to access any other Amazon Web Services (AWS) resources.

      • Handler — (String)

        The function Lambda calls to begin executing your function.

      • Mode — (String)

        The type of the Lambda function you uploaded.

        Possible values include:
        • "event"
      • CodeSize — (Integer)

        The size, in bytes, of the function .zip file you uploaded.

      • Description — (String)

        The user-provided description.

      • Timeout — (Integer)

        The function execution time at which Lambda should terminate the function. Because the execution time has cost implications, we recommend you set this value based on your expected execution time. The default is 3 seconds.

      • MemorySize — (Integer)

        The memory size, in MB, you configured for the function. Must be a multiple of 64 MB.

      • LastModified — (Date)

        The timestamp of the last time you updated the function.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

invokeAsync(params = {}, callback) ⇒ AWS.Request

Submits an invocation request to AWS Lambda. Upon receiving the request, Lambda executes the specified function asynchronously. To see the logs generated by the Lambda function execution, see the CloudWatch logs console.

This operation requires permission for the lambda:InvokeAsync action.

Examples:

Calling the invokeAsync operation

var params = {
  FunctionName: 'STRING_VALUE', /* required */
  InvokeArgs: new Buffer('...') || 'STRING_VALUE' || streamObject /* required */
};
lambda.invokeAsync(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • FunctionName — (String)

      The Lambda function name.

    • InvokeArgs — (Buffer, Typed Array, Blob, String, ReadableStream)

      JSON that you want to provide to your Lambda function as input.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Status — (Integer)

        It will be 202 upon success.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

listEventSources(params = {}, callback) ⇒ AWS.Request

Returns a list of event source mappings you created using the AddEventSource (see AddEventSource), where you identify a stream as event source. This list does not include Amazon S3 event sources.

For each mapping, the API returns configuration information. You can optionally specify filters to retrieve specific event source mappings.

This operation requires permission for the lambda:ListEventSources action.

Examples:

Calling the listEventSources operation

var params = {
  EventSourceArn: 'STRING_VALUE',
  FunctionName: 'STRING_VALUE',
  Marker: 'STRING_VALUE',
  MaxItems: 'NUMBER_VALUE'
};
lambda.listEventSources(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • EventSourceArn — (String)

      The Amazon Resource Name (ARN) of the Amazon Kinesis stream.

    • FunctionName — (String)

      The name of the AWS Lambda function.

    • Marker — (String)

      Optional string. An opaque pagination token returned from a previous ListEventSources operation. If present, specifies to continue the list from where the returning call left off.

    • MaxItems — (Integer)

      Optional integer. Specifies the maximum number of event sources to return in response. This value must be greater than 0.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • NextMarker — (String)

        A string, present if there are more event source mappings.

      • EventSources — (Array<map>)

        An arrary of EventSourceConfiguration objects.

        • UUID — (String)

          The AWS Lambda assigned opaque identifier for the mapping.

        • BatchSize — (Integer)

          The largest number of records that AWS Lambda will POST in the invocation request to your function.

        • EventSource — (String)

          The Amazon Resource Name (ARN) of the Amazon Kinesis stream that is the source of events.

        • FunctionName — (String)

          The Lambda function to invoke when AWS Lambda detects an event on the stream.

        • Parameters — (map<String>)

          The map (key-value pairs) defining the configuration for AWS Lambda to use when reading the event source.

        • Role — (String)

          The ARN of the IAM role (invocation role) that AWS Lambda can assume to read from the stream and invoke the function.

        • LastModified — (Date)

          The UTC time string indicating the last time the event mapping was updated.

        • IsActive — (Boolean)

          Indicates whether the event source mapping is currently honored. Events are only processes if IsActive is true.

        • Status — (String)

          The description of the health of the event source mapping. Valid values are: "PENDING", "OK", and "PROBLEM:message". Initially this staus is "PENDING". When AWS Lambda begins processing events, it changes the status to "OK".

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

listFunctions(params = {}, callback) ⇒ AWS.Request

Returns a list of your Lambda functions. For each function, the response includes the function configuration information. You must use GetFunction to retrieve the code for your function.

This operation requires permission for the lambda:ListFunctions action.

Examples:

Calling the listFunctions operation

var params = {
  Marker: 'STRING_VALUE',
  MaxItems: 'NUMBER_VALUE'
};
lambda.listFunctions(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • Marker — (String)

      Optional string. An opaque pagination token returned from a previous ListFunctions operation. If present, indicates where to continue the listing.

    • MaxItems — (Integer)

      Optional integer. Specifies the maximum number of AWS Lambda functions to return in response. This parameter value must be greater than 0.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • NextMarker — (String)

        A string, present if there are more functions.

      • Functions — (Array<map>)

        A list of Lambda functions.

        • FunctionName — (String)

          The name of the function.

        • FunctionARN — (String)

          The Amazon Resource Name (ARN) assigned to the function.

        • ConfigurationId — (String)

          A Lambda-assigned unique identifier for the current function code and related configuration.

        • Runtime — (String)

          The runtime environment for the Lambda function.

          Possible values include:
          • "nodejs"
        • Role — (String)

          The Amazon Resource Name (ARN) of the IAM role that Lambda assumes when it executes your function to access any other Amazon Web Services (AWS) resources.

        • Handler — (String)

          The function Lambda calls to begin executing your function.

        • Mode — (String)

          The type of the Lambda function you uploaded.

          Possible values include:
          • "event"
        • CodeSize — (Integer)

          The size, in bytes, of the function .zip file you uploaded.

        • Description — (String)

          The user-provided description.

        • Timeout — (Integer)

          The function execution time at which Lambda should terminate the function. Because the execution time has cost implications, we recommend you set this value based on your expected execution time. The default is 3 seconds.

        • MemorySize — (Integer)

          The memory size, in MB, you configured for the function. Must be a multiple of 64 MB.

        • LastModified — (Date)

          The timestamp of the last time you updated the function.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

removeEventSource(params = {}, callback) ⇒ AWS.Request

Removes an event source mapping. This means AWS Lambda will no longer invoke the function for events in the associated source.

This operation requires permission for the lambda:RemoveEventSource action.

Examples:

Calling the removeEventSource operation

var params = {
  UUID: 'STRING_VALUE' /* required */
};
lambda.removeEventSource(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • UUID — (String)

      The event source mapping ID.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

updateFunctionConfiguration(params = {}, callback) ⇒ AWS.Request

Updates the configuration parameters for the specified Lambda function by using the values provided in the request. You provide only the parameters you want to change. This operation must only be used on an existing Lambda function and cannot be used to update the function's code.

This operation requires permission for the lambda:UpdateFunctionConfiguration action.

Examples:

Calling the updateFunctionConfiguration operation

var params = {
  FunctionName: 'STRING_VALUE', /* required */
  Description: 'STRING_VALUE',
  Handler: 'STRING_VALUE',
  MemorySize: 'NUMBER_VALUE',
  Role: 'STRING_VALUE',
  Timeout: 'NUMBER_VALUE'
};
lambda.updateFunctionConfiguration(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • FunctionName — (String)

      The name of the Lambda function.

    • Role — (String)

      The Amazon Resource Name (ARN) of the IAM role that Lambda will assume when it executes your function.

    • Handler — (String)

      The function that Lambda calls to begin executing your function. For Node.js, it is the module-name.export value in your function.

    • Description — (String)

      A short user-defined function description. Lambda does not use this value. Assign a meaningful description as you see fit.

    • Timeout — (Integer)

      The function execution time at which Lambda should terminate the function. Because the execution time has cost implications, we recommend you set this value based on your expected execution time. The default is 3 seconds.

    • MemorySize — (Integer)

      The amount of memory, in MB, your Lambda function is given. Lambda uses this memory size to infer the amount of CPU allocated to your function. Your function use-case determines your CPU and memory requirements. For example, a database operation might need less memory compared to an image processing function. The default value is 128 MB. The value must be a multiple of 64 MB.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • FunctionName — (String)

        The name of the function.

      • FunctionARN — (String)

        The Amazon Resource Name (ARN) assigned to the function.

      • ConfigurationId — (String)

        A Lambda-assigned unique identifier for the current function code and related configuration.

      • Runtime — (String)

        The runtime environment for the Lambda function.

        Possible values include:
        • "nodejs"
      • Role — (String)

        The Amazon Resource Name (ARN) of the IAM role that Lambda assumes when it executes your function to access any other Amazon Web Services (AWS) resources.

      • Handler — (String)

        The function Lambda calls to begin executing your function.

      • Mode — (String)

        The type of the Lambda function you uploaded.

        Possible values include:
        • "event"
      • CodeSize — (Integer)

        The size, in bytes, of the function .zip file you uploaded.

      • Description — (String)

        The user-provided description.

      • Timeout — (Integer)

        The function execution time at which Lambda should terminate the function. Because the execution time has cost implications, we recommend you set this value based on your expected execution time. The default is 3 seconds.

      • MemorySize — (Integer)

        The memory size, in MB, you configured for the function. Must be a multiple of 64 MB.

      • LastModified — (Date)

        The timestamp of the last time you updated the function.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

uploadFunction(params = {}, callback) ⇒ AWS.Request

Creates a new Lambda function or updates an existing function. The function metadata is created from the request parameters, and the code for the function is provided by a .zip file in the request body. If the function name already exists, the existing Lambda function is updated with the new code and metadata.

This operation requires permission for the lambda:UploadFunction action.

Examples:

Calling the uploadFunction operation

var params = {
  FunctionName: 'STRING_VALUE', /* required */
  FunctionZip: new Buffer('...') || 'STRING_VALUE' || streamObject, /* required */
  Handler: 'STRING_VALUE', /* required */
  Mode: event, /* required */
  Role: 'STRING_VALUE', /* required */
  Runtime: nodejs, /* required */
  Description: 'STRING_VALUE',
  MemorySize: 'NUMBER_VALUE',
  Timeout: 'NUMBER_VALUE'
};
lambda.uploadFunction(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • FunctionName — (String)

      The name you want to assign to the function you are uploading. The function names appear in the console and are returned in the ListFunctions API. Function names are used to specify functions to other AWS Lambda APIs, such as InvokeAsync.

    • FunctionZip — (Buffer, Typed Array, Blob, String, ReadableStream)

      A .zip file containing your packaged source code. For more information about creating a .zip file, go to AWS LambdaL How it Works in the AWS Lambda Developer Guide.

    • Runtime — (String)

      The runtime environment for the Lambda function you are uploading. Currently, Lambda supports only "nodejs" as the runtime.

      Possible values include:
      • "nodejs"
    • Role — (String)

      The Amazon Resource Name (ARN) of the IAM role that Lambda assumes when it executes your function to access any other Amazon Web Services (AWS) resources.

    • Handler — (String)

      The function that Lambda calls to begin execution. For Node.js, it is the module-name.export value in your function.

    • Mode — (String)

      How the Lambda function will be invoked. Lambda supports only the "event" mode.

      Possible values include:
      • "event"
    • Description — (String)

      A short, user-defined function description. Lambda does not use this value. Assign a meaningful description as you see fit.

    • Timeout — (Integer)

      The function execution time at which Lambda should terminate the function. Because the execution time has cost implications, we recommend you set this value based on your expected execution time. The default is 3 seconds.

    • MemorySize — (Integer)

      The amount of memory, in MB, your Lambda function is given. Lambda uses this memory size to infer the amount of CPU allocated to your function. Your function use-case determines your CPU and memory requirements. For example, database operation might need less memory compared to image processing function. The default value is 128 MB. The value must be a multiple of 64 MB.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • FunctionName — (String)

        The name of the function.

      • FunctionARN — (String)

        The Amazon Resource Name (ARN) assigned to the function.

      • ConfigurationId — (String)

        A Lambda-assigned unique identifier for the current function code and related configuration.

      • Runtime — (String)

        The runtime environment for the Lambda function.

        Possible values include:
        • "nodejs"
      • Role — (String)

        The Amazon Resource Name (ARN) of the IAM role that Lambda assumes when it executes your function to access any other Amazon Web Services (AWS) resources.

      • Handler — (String)

        The function Lambda calls to begin executing your function.

      • Mode — (String)

        The type of the Lambda function you uploaded.

        Possible values include:
        • "event"
      • CodeSize — (Integer)

        The size, in bytes, of the function .zip file you uploaded.

      • Description — (String)

        The user-provided description.

      • Timeout — (Integer)

        The function execution time at which Lambda should terminate the function. Because the execution time has cost implications, we recommend you set this value based on your expected execution time. The default is 3 seconds.

      • MemorySize — (Integer)

        The memory size, in MB, you configured for the function. Must be a multiple of 64 MB.

      • LastModified — (Date)

        The timestamp of the last time you updated the function.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.