AWS.Lambda (2014-11-11) — AWS SDK for JavaScript (original) (raw)

We recommend that you migrate to AWS SDK for JavaScript v3. For dates, additional details, and information on how to migrate, please refer to the linked announcement.

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();

Constructor Summarycollapse

Property Summarycollapse

Properties inherited from AWS.Service

apiVersions

Method Summarycollapse

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.

Property Details

endpointAWS.Endpoint

Returns 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.

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

Deletes the specified Lambda function code and configuration.

This operation requires permission for the lambda:DeleteFunction action.

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.

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.

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.

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.

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.

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.

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.

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.

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.