Class: AWS.Lambda

Inherits:
AWS.Service show all
Identifier:
lambda
API Version:
2015-03-31
Defined in:
(unknown)

Overview

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

Sending a Request Using Lambda

var lambda = new AWS.Lambda();
lambda.addLayerVersionPermission(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: '2015-03-31'});

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

AWS.config.apiVersions = {
  lambda: '2015-03-31',
  // other service API versions
};

var lambda = new AWS.Lambda();

Version:

  • 2015-03-31

Constructor Summary collapse

Property Summary collapse

Properties inherited from AWS.Service

apiVersions

Method Summary collapse

Methods inherited from AWS.Service

makeRequest, makeUnauthenticatedRequest, waitFor, 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: '2015-03-31'});

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.region for more information.

  • maxRetries (Integer)

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

  • maxRedirects (Integer)

    the maximum amount of redirects to follow with a request. See AWS.Lambda.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

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

Adds permissions to the resource-based policy of a version of an AWS Lambda layer. Use this action to grant layer usage permission to other accounts. You can grant permission to a single account, all AWS accounts, or all accounts in an organization.

To revoke permission, call RemoveLayerVersionPermission with the statement ID that you specified when you added it.

Service Reference:

Examples:

Calling the addLayerVersionPermission operation

var params = {
  Action: 'STRING_VALUE', /* required */
  LayerName: 'STRING_VALUE', /* required */
  Principal: 'STRING_VALUE', /* required */
  StatementId: 'STRING_VALUE', /* required */
  VersionNumber: 0, /* required */
  OrganizationId: 'STRING_VALUE',
  RevisionId: 'STRING_VALUE'
};
lambda.addLayerVersionPermission(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: {})
    • LayerName — (String)

      The name or Amazon Resource Name (ARN) of the layer.

    • VersionNumber — (Integer)

      The version number.

    • StatementId — (String)

      An identifier that distinguishes the policy from others on the same layer version.

    • Action — (String)

      The API action that grants access to the layer. For example, lambda:GetLayerVersion.

    • Principal — (String)

      An account ID, or * to grant permission to all AWS accounts.

    • OrganizationId — (String)

      With the principal set to *, grant permission to all accounts in the specified organization.

    • RevisionId — (String)

      Only update the policy if the revision ID matches the ID specified. Use this option to avoid modifying a policy that has changed since you last read it.

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:

      • Statement — (String)

        The permission statement.

      • RevisionId — (String)

        A unique identifier for the current revision of the policy.

Returns:

  • (AWS.Request)

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

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

Grants an AWS service or another account permission to use a function. You can apply the policy at the function level, or specify a qualifier to restrict access to a single version or alias. If you use a qualifier, the invoker must use the full Amazon Resource Name (ARN) of that version or alias to invoke the function.

To grant permission to another account, specify the account ID as the Principal. For AWS services, the principal is a domain-style identifier defined by the service, like s3.amazonaws.com or sns.amazonaws.com. For AWS services, you can also specify the ARN or owning account of the associated resource as the SourceArn or SourceAccount. If you grant permission to a service principal without specifying the source, other accounts could potentially configure resources in their account to invoke your Lambda function.

This action adds a statement to a resource-based permission policy for the function. For more information about function policies, see Lambda Function Policies.

Service Reference:

Examples:

add-permission


/* This example adds a permission for an S3 bucket to invoke a Lambda function. */

 var params = {
  Action: "lambda:InvokeFunction", 
  FunctionName: "MyFunction", 
  Principal: "s3.amazonaws.com", 
  SourceAccount: "123456789012", 
  SourceArn: "arn:aws:s3:::examplebucket/*", 
  StatementId: "ID-1"
 };
 lambda.addPermission(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    Statement: "ID-1"
   }
   */
 });

Calling the addPermission operation

var params = {
  Action: 'STRING_VALUE', /* required */
  FunctionName: 'STRING_VALUE', /* required */
  Principal: 'STRING_VALUE', /* required */
  StatementId: 'STRING_VALUE', /* required */
  EventSourceToken: 'STRING_VALUE',
  Qualifier: 'STRING_VALUE',
  RevisionId: 'STRING_VALUE',
  SourceAccount: 'STRING_VALUE',
  SourceArn: 'STRING_VALUE'
};
lambda.addPermission(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, version, or alias.

      Name formats

      • Function name - my-function (name-only), my-function:v1 (with alias).

      • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:my-function.

      • Partial ARN - 123456789012:function:my-function.

      You can append a version number or alias to any of the formats. The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

    • StatementId — (String)

      A statement identifier that differentiates the statement from others in the same policy.

    • Action — (String)

      The action that the principal can use on the function. For example, lambda:InvokeFunction or lambda:GetFunction.

    • Principal — (String)

      The AWS service or account that invokes the function. If you specify a service, use SourceArn or SourceAccount to limit who can invoke the function through that service.

    • SourceArn — (String)

      For AWS services, the ARN of the AWS resource that invokes the function. For example, an Amazon S3 bucket or Amazon SNS topic.

    • SourceAccount — (String)

      For AWS services, the ID of the account that owns the resource. Use instead of SourceArn to grant permission to resources owned by another account (e.g. all of an account's Amazon S3 buckets). Or use together with SourceArn to ensure that the resource is owned by the specified account. For example, an Amazon S3 bucket could be deleted by its owner and recreated by another account.

    • EventSourceToken — (String)

      For Alexa Smart Home functions, a token that must be supplied by the invoker.

    • Qualifier — (String)

      Specify a version or alias to add permissions to a published version of the function.

    • RevisionId — (String)

      Only update the policy if the revision ID matches the ID specified. Use this option to avoid modifying a policy that has changed since you last read it.

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:

      • Statement — (String)

        The permission statement added to the function policy.

Returns:

  • (AWS.Request)

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

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

Creates an alias for a Lambda function version. Use aliases to provide clients with a function identifier that you can update to invoke a different version.

You can also map an alias to split invocation requests between two versions. Use the RoutingConfig parameter to specify a second version and the percentage of invocation requests that it receives.

Service Reference:

Examples:

Calling the createAlias operation

var params = {
  FunctionName: 'STRING_VALUE', /* required */
  FunctionVersion: 'STRING_VALUE', /* required */
  Name: 'STRING_VALUE', /* required */
  Description: 'STRING_VALUE',
  RoutingConfig: {
    AdditionalVersionWeights: {
      '<AdditionalVersion>': 0.0,
      /* '<AdditionalVersion>': ... */
    }
  }
};
lambda.createAlias(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.

      Name formats

      • Function name - MyFunction.

      • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction.

      • Partial ARN - 123456789012:function:MyFunction.

      The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

    • Name — (String)

      The name of the alias.

    • FunctionVersion — (String)

      The function version that the alias invokes.

    • Description — (String)

      A description of the alias.

    • RoutingConfig — (map)

      The routing configuration of the alias.

      • AdditionalVersionWeights — (map<Float>)

        The name of the second alias, and the percentage of traffic that is routed to it.

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:

      • AliasArn — (String)

        The Amazon Resource Name (ARN) of the alias.

      • Name — (String)

        The name of the alias.

      • FunctionVersion — (String)

        The function version that the alias invokes.

      • Description — (String)

        A description of the alias.

      • RoutingConfig — (map)

        The routing configuration of the alias.

        • AdditionalVersionWeights — (map<Float>)

          The name of the second alias, and the percentage of traffic that is routed to it.

      • RevisionId — (String)

        A unique identifier that changes when you update the alias.

Returns:

  • (AWS.Request)

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

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

Creates a mapping between an event source and an AWS Lambda function. Lambda reads items from the event source and triggers the function.

For details about each event source type, see the following topics.

Service Reference:

Examples:

Calling the createEventSourceMapping operation

var params = {
  EventSourceArn: 'STRING_VALUE', /* required */
  FunctionName: 'STRING_VALUE', /* required */
  BatchSize: 0,
  Enabled: true || false,
  StartingPosition: TRIM_HORIZON | LATEST | AT_TIMESTAMP,
  StartingPositionTimestamp: new Date || 'Wed Dec 31 1969 16:00:00 GMT-0800 (PST)' || 123456789
};
lambda.createEventSourceMapping(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 event source.

      • Amazon Kinesis - The ARN of the data stream or a stream consumer.

      • Amazon DynamoDB Streams - The ARN of the stream.

      • Amazon Simple Queue Service - The ARN of the queue.

    • FunctionName — (String)

      The name of the Lambda function.

      Name formats

      • Function name - MyFunction.

      • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction.

      • Version or Alias ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction:PROD.

      • Partial ARN - 123456789012:function:MyFunction.

      The length constraint applies only to the full ARN. If you specify only the function name, it's limited to 64 characters in length.

    • Enabled — (Boolean)

      Disables the event source mapping to pause polling and invocation.

    • BatchSize — (Integer)

      The maximum number of items to retrieve in a single batch.

      • Amazon Kinesis - Default 100. Max 10,000.

      • Amazon DynamoDB Streams - Default 100. Max 1,000.

      • Amazon Simple Queue Service - Default 10. Max 10.

    • StartingPosition — (String)

      The position in a stream from which to start reading. Required for Amazon Kinesis and Amazon DynamoDB Streams sources. AT_TIMESTAMP is only supported for Amazon Kinesis streams.

      Possible values include:
      • "TRIM_HORIZON"
      • "LATEST"
      • "AT_TIMESTAMP"
    • StartingPositionTimestamp — (Date)

      With StartingPosition set to AT_TIMESTAMP, the time from which to start reading.

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 identifier of the event source mapping.

      • BatchSize — (Integer)

        The maximum number of items to retrieve in a single batch.

      • EventSourceArn — (String)

        The Amazon Resource Name (ARN) of the event source.

      • FunctionArn — (String)

        The ARN of the Lambda function.

      • LastModified — (Date)

        The date that the event source mapping was last updated.

      • LastProcessingResult — (String)

        The result of the last AWS Lambda invocation of your Lambda function.

      • State — (String)

        The state of the event source mapping. It can be one of the following: Creating, Enabling, Enabled, Disabling, Disabled, Updating, or Deleting.

      • StateTransitionReason — (String)

        The cause of the last state change, either User initiated or Lambda initiated.

Returns:

  • (AWS.Request)

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

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

Creates a Lambda function. To create a function, you need a deployment package and an execution role. The deployment package contains your function code. The execution role grants the function permission to use AWS services such as Amazon CloudWatch Logs for log streaming and AWS X-Ray for request tracing.

A function has an unpublished version, and can have published versions and aliases. A published version is a snapshot of your function code and configuration that can not be changed. An alias is a named resource that maps to a version, and can be changed to map to a different version. Use the Publish parameter to create version 1 of your function from its initial configuration.

The other parameters let you configure version-specific and function-level settings. You can modify version-specific settings later with UpdateFunctionConfiguration. Function-level settings apply to both the unpublished and published versions of the function and include tags (TagResource) and per-function concurrency limits (PutFunctionConcurrency).

If another account or a AWS service invokes your function, use AddPermission to grant permission by creating a resource-based IAM policy. You can grant permissions at the function level, on a version, or on an alias.

To invoke your function directly, use Invoke. To invoke your function in response to events in other AWS services, create an event source mapping (CreateEventSourceMapping), or configure a function trigger in the other service. For more information, see Invoking Functions.

Service Reference:

Examples:

create-function


/* This example creates a Lambda function. */

 var params = {
  Code: {
  }, 
  Description: "", 
  FunctionName: "MyFunction", 
  Handler: "souce_file.handler_name", // is of the form of the name of your source file and then name of your function handler
  MemorySize: 128, 
  Publish: true, 
  Role: "arn:aws:iam::123456789012:role/service-role/role-name", // replace with the actual arn of the execution role you created
  Runtime: "nodejs8.10", 
  Timeout: 15, 
  VpcConfig: {
  }
 };
 lambda.createFunction(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    CodeSha256: "", 
    CodeSize: 123, 
    Description: "", 
    FunctionArn: "arn:aws:lambda:us-west-2:123456789012:function:MyFunction", 
    FunctionName: "MyFunction", 
    Handler: "source_file.handler_name", 
    LastModified: "2016-11-21T19:49:20.006+0000", 
    MemorySize: 128, 
    Role: "arn:aws:iam::123456789012:role/service-role/role-name", 
    Runtime: "nodejs8.10", 
    Timeout: 123, 
    Version: "1", 
    VpcConfig: {
    }
   }
   */
 });

Calling the createFunction operation

var params = {
  Code: { /* required */
    S3Bucket: 'STRING_VALUE',
    S3Key: 'STRING_VALUE',
    S3ObjectVersion: 'STRING_VALUE',
    ZipFile: new Buffer('...') || 'STRING_VALUE' /* Strings will be Base-64 encoded on your behalf */
  },
  FunctionName: 'STRING_VALUE', /* required */
  Handler: 'STRING_VALUE', /* required */
  Role: 'STRING_VALUE', /* required */
  Runtime: nodejs | nodejs4.3 | nodejs6.10 | nodejs8.10 | java8 | python2.7 | python3.6 | python3.7 | dotnetcore1.0 | dotnetcore2.0 | dotnetcore2.1 | nodejs4.3-edge | go1.x | ruby2.5 | provided, /* required */
  DeadLetterConfig: {
    TargetArn: 'STRING_VALUE'
  },
  Description: 'STRING_VALUE',
  Environment: {
    Variables: {
      '<EnvironmentVariableName>': 'STRING_VALUE',
      /* '<EnvironmentVariableName>': ... */
    }
  },
  KMSKeyArn: 'STRING_VALUE',
  Layers: [
    'STRING_VALUE',
    /* more items */
  ],
  MemorySize: 0,
  Publish: true || false,
  Tags: {
    '<TagKey>': 'STRING_VALUE',
    /* '<TagKey>': ... */
  },
  Timeout: 0,
  TracingConfig: {
    Mode: Active | PassThrough
  },
  VpcConfig: {
    SecurityGroupIds: [
      'STRING_VALUE',
      /* more items */
    ],
    SubnetIds: [
      'STRING_VALUE',
      /* more items */
    ]
  }
};
lambda.createFunction(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.

      Name formats

      • Function name - my-function.

      • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:my-function.

      • Partial ARN - 123456789012:function:my-function.

      The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

    • Runtime — (String)

      The identifier of the function's runtime.

      Possible values include:
      • "nodejs"
      • "nodejs4.3"
      • "nodejs6.10"
      • "nodejs8.10"
      • "java8"
      • "python2.7"
      • "python3.6"
      • "python3.7"
      • "dotnetcore1.0"
      • "dotnetcore2.0"
      • "dotnetcore2.1"
      • "nodejs4.3-edge"
      • "go1.x"
      • "ruby2.5"
      • "provided"
    • Role — (String)

      The Amazon Resource Name (ARN) of the function's execution role.

    • Handler — (String)

      The name of the method within your code that Lambda calls to execute your function. The format includes the filename and can also include namespaces and other qualifiers, depending on the runtime. For more information, see Programming Model.

    • Code — (map)

      The code for the function.

      • ZipFile — (Buffer, Typed Array, Blob, String)

        The base64-encoded contents of the deployment package. AWS SDK and AWS CLI clients handle the encoding for you.

      • S3Bucket — (String)

        An Amazon S3 bucket in the same region as your function. The bucket can be in a different AWS account.

      • S3Key — (String)

        The Amazon S3 key of the deployment package.

      • S3ObjectVersion — (String)

        For versioned objects, the version of the deployment package object to use.

    • Description — (String)

      A description of the function.

    • Timeout — (Integer)

      The amount of time that Lambda allows a function to run before terminating it. The default is 3 seconds. The maximum allowed value is 900 seconds.

    • MemorySize — (Integer)

      The amount of memory that your function has access to. Increasing the function's memory also increases it's CPU allocation. The default value is 128 MB. The value must be a multiple of 64 MB.

    • Publish — (Boolean)

      Set to true to publish the first version of the function during creation.

    • VpcConfig — (map)

      For network connectivity to AWS resources in a VPC, specify a list of security groups and subnets in the VPC. When you connect a function to a VPC, it can only access resources and the internet through that VPC. For more information, see VPC Settings.

      • SubnetIds — (Array<String>)

        A list of VPC subnet IDs.

      • SecurityGroupIds — (Array<String>)

        A list of VPC security groups IDs.

    • DeadLetterConfig — (map)

      A dead letter queue configuration that specifies the queue or topic where Lambda sends asynchronous events when they fail processing. For more information, see Dead Letter Queues.

      • TargetArn — (String)

        The Amazon Resource Name (ARN) of an Amazon SQS queue or Amazon SNS topic.

    • Environment — (map)

      Environment variables that are accessible from function code during execution.

      • Variables — (map<String>)

        Environment variable key-value pairs.

    • KMSKeyArn — (String)

      The ARN of the AWS Key Management Service key used to encrypt your function's environment variables. If not provided, AWS Lambda uses a default service key.

    • TracingConfig — (map)

      Set Mode to Active to sample and trace a subset of incoming requests with AWS X-Ray.

      • Mode — (String)

        The tracing mode.

        Possible values include:
        • "Active"
        • "PassThrough"
    • Tags — (map<String>)

      A list of tags to apply to the function.

    • Layers — (Array<String>)

      A list of function layers to add to the function's execution environment. Specify each layer by ARN, including the version.

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 function's Amazon Resource Name (ARN).

      • Runtime — (String)

        The runtime environment for the Lambda function.

        Possible values include:
        • "nodejs"
        • "nodejs4.3"
        • "nodejs6.10"
        • "nodejs8.10"
        • "java8"
        • "python2.7"
        • "python3.6"
        • "python3.7"
        • "dotnetcore1.0"
        • "dotnetcore2.0"
        • "dotnetcore2.1"
        • "nodejs4.3-edge"
        • "go1.x"
        • "ruby2.5"
        • "provided"
      • Role — (String)

        The function's execution role.

      • Handler — (String)

        The function Lambda calls to begin executing your function.

      • CodeSize — (Integer)

        The size of the function's deployment package in bytes.

      • Description — (String)

        The function's description.

      • Timeout — (Integer)

        The amount of time that Lambda allows a function to run before terminating it.

      • MemorySize — (Integer)

        The memory allocated to the function

      • LastModified — (String)

        The date and time that the function was last updated, in ISO-8601 format (YYYY-MM-DDThh:mm:ss.sTZD).

      • CodeSha256 — (String)

        The SHA256 hash of the function's deployment package.

      • Version — (String)

        The version of the Lambda function.

      • VpcConfig — (map)

        The function's networking configuration.

        • SubnetIds — (Array<String>)

          A list of VPC subnet IDs.

        • SecurityGroupIds — (Array<String>)

          A list of VPC security groups IDs.

        • VpcId — (String)

          The ID of the VPC.

      • DeadLetterConfig — (map)

        The function's dead letter queue.

        • TargetArn — (String)

          The Amazon Resource Name (ARN) of an Amazon SQS queue or Amazon SNS topic.

      • Environment — (map)

        The function's environment variables.

        • Variables — (map<String>)

          Environment variable key-value pairs.

        • Error — (map)

          Error messages for environment variables that could not be applied.

          • ErrorCode — (String)

            The error code.

          • Message — (String)

            The error message.

      • KMSKeyArn — (String)

        The KMS key used to encrypt the function's environment variables. Only returned if you've configured a customer managed CMK.

      • TracingConfig — (map)

        The function's AWS X-Ray tracing configuration.

        • Mode — (String)

          The tracing mode.

          Possible values include:
          • "Active"
          • "PassThrough"
      • MasterArn — (String)

        For Lambda@Edge functions, the ARN of the master function.

      • RevisionId — (String)

        Represents the latest updated revision of the function or alias.

      • Layers — (Array<map>)

        The function's layers

        • Arn — (String)

          The Amazon Resource Name (ARN) of the function layer.

        • CodeSize — (Integer)

          The size of the layer archive in bytes.

Returns:

  • (AWS.Request)

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

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

Deletes a Lambda function alias.

Service Reference:

Examples:

To delete a Lambda function alias


/* This operation deletes a Lambda function alias */

 var params = {
  FunctionName: "myFunction", 
  Name: "alias"
 };
 lambda.deleteAlias(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
 });

Calling the deleteAlias operation

var params = {
  FunctionName: 'STRING_VALUE', /* required */
  Name: 'STRING_VALUE' /* required */
};
lambda.deleteAlias(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.

      Name formats

      • Function name - MyFunction.

      • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction.

      • Partial ARN - 123456789012:function:MyFunction.

      The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

    • Name — (String)

      The name of the alias.

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.

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

Deletes an event source mapping. You can get the identifier of a mapping from the output of ListEventSourceMappings.

Service Reference:

Examples:

To delete a Lambda function event source mapping


/* This operation deletes a Lambda function event source mapping */

 var params = {
  UUID: "12345kxodurf3443"
 };
 lambda.deleteEventSourceMapping(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    BatchSize: 123, 
    EventSourceArn: "arn:aws:s3:::examplebucket/*", 
    FunctionArn: "arn:aws:lambda:us-west-2:123456789012:function:myFunction", 
    LastModified: <Date Representation>, 
    LastProcessingResult: "", 
    State: "", 
    StateTransitionReason: "", 
    UUID: "12345kxodurf3443"
   }
   */
 });

Calling the deleteEventSourceMapping operation

var params = {
  UUID: 'STRING_VALUE' /* required */
};
lambda.deleteEventSourceMapping(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 identifier 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 identifier of the event source mapping.

      • BatchSize — (Integer)

        The maximum number of items to retrieve in a single batch.

      • EventSourceArn — (String)

        The Amazon Resource Name (ARN) of the event source.

      • FunctionArn — (String)

        The ARN of the Lambda function.

      • LastModified — (Date)

        The date that the event source mapping was last updated.

      • LastProcessingResult — (String)

        The result of the last AWS Lambda invocation of your Lambda function.

      • State — (String)

        The state of the event source mapping. It can be one of the following: Creating, Enabling, Enabled, Disabling, Disabled, Updating, or Deleting.

      • StateTransitionReason — (String)

        The cause of the last state change, either User initiated or Lambda initiated.

Returns:

  • (AWS.Request)

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

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

Deletes a Lambda function. To delete a specific function version, use the Qualifier parameter. Otherwise, all versions and aliases are deleted.

To delete Lambda event source mappings that invoke a function, use DeleteEventSourceMapping. For AWS services and resources that invoke your function directly, delete the trigger in the service where you originally configured it.

Service Reference:

Examples:

To delete a Lambda function


/* This operation deletes a Lambda function */

 var params = {
  FunctionName: "myFunction", 
  Qualifier: "1"
 };
 lambda.deleteFunction(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
 });

Calling the deleteFunction operation

var params = {
  FunctionName: 'STRING_VALUE', /* required */
  Qualifier: 'STRING_VALUE'
};
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 name of the Lambda function or version.

      Name formats

      • Function name - my-function (name-only), my-function:1 (with version).

      • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:my-function.

      • Partial ARN - 123456789012:function:my-function.

      You can append a version number or alias to any of the formats. The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

    • Qualifier — (String)

      Specify a version to delete. You cannot delete a version that is referenced by an alias.

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.

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

Removes a concurrent execution limit from a function.

Service Reference:

Examples:

Calling the deleteFunctionConcurrency operation

var params = {
  FunctionName: 'STRING_VALUE' /* required */
};
lambda.deleteFunctionConcurrency(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.

      Name formats

      • Function name - my-function.

      • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:my-function.

      • Partial ARN - 123456789012:function:my-function.

      The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

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.

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

Deletes a version of an AWS Lambda layer. Deleted versions can no longer be viewed or added to functions. To avoid breaking functions, a copy of the version remains in Lambda until no functions refer to it.

Service Reference:

Examples:

Calling the deleteLayerVersion operation

var params = {
  LayerName: 'STRING_VALUE', /* required */
  VersionNumber: 0 /* required */
};
lambda.deleteLayerVersion(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: {})
    • LayerName — (String)

      The name or Amazon Resource Name (ARN) of the layer.

    • VersionNumber — (Integer)

      The version number.

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.

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

Retrieves details about your account's limits and usage in a region.

Service Reference:

Examples:

To retrieves a Lambda customer's account settings


/* This operation retrieves a Lambda customer's account settings */

 var params = {
 };
 lambda.getAccountSettings(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    AccountLimit: {
    }, 
    AccountUsage: {
    }
   }
   */
 });

Calling the getAccountSettings operation

var params = {
};
lambda.getAccountSettings(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: {})

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:

      • AccountLimit — (map)

        Limits related to concurrency and code storage.

        • TotalCodeSize — (Integer)

          The amount of storage space that you can use for all deployment packages and layer archives.

        • CodeSizeUnzipped — (Integer)

          The maximum size of your function's code and layers when extracted.

        • CodeSizeZipped — (Integer)

          The maximum size of a deployment package when uploaded direcly to AWS Lambda. Use Amazon S3 for larger files.

        • ConcurrentExecutions — (Integer)

          The maximum number of simultaneous function executions.

        • UnreservedConcurrentExecutions — (Integer)

          The maximum number of simultaneous function executions, less the concurrency reserved for individual functions with PutFunctionConcurrency.

      • AccountUsage — (map)

        The number of functions and amount of storage in use.

        • TotalCodeSize — (Integer)

          The amount of storage space, in bytes, in use by deployment packages and layer archives.

        • FunctionCount — (Integer)

          The number of Lambda functions.

Returns:

  • (AWS.Request)

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

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

Returns details about a Lambda function alias.

Service Reference:

Examples:

To retrieve a Lambda function alias


/* This operation retrieves a Lambda function alias */

 var params = {
  FunctionName: "myFunction", 
  Name: "myFunctionAlias"
 };
 lambda.getAlias(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    AliasArn: "arn:aws:lambda:us-west-2:123456789012:function:myFunctionAlias", 
    Description: "", 
    FunctionVersion: "1", 
    Name: "myFunctionAlias"
   }
   */
 });

Calling the getAlias operation

var params = {
  FunctionName: 'STRING_VALUE', /* required */
  Name: 'STRING_VALUE' /* required */
};
lambda.getAlias(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.

      Name formats

      • Function name - MyFunction.

      • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction.

      • Partial ARN - 123456789012:function:MyFunction.

      The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

    • Name — (String)

      The name of the alias.

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:

      • AliasArn — (String)

        The Amazon Resource Name (ARN) of the alias.

      • Name — (String)

        The name of the alias.

      • FunctionVersion — (String)

        The function version that the alias invokes.

      • Description — (String)

        A description of the alias.

      • RoutingConfig — (map)

        The routing configuration of the alias.

        • AdditionalVersionWeights — (map<Float>)

          The name of the second alias, and the percentage of traffic that is routed to it.

      • RevisionId — (String)

        A unique identifier that changes when you update the alias.

Returns:

  • (AWS.Request)

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

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

Returns details about an event source mapping. You can get the identifier of a mapping from the output of ListEventSourceMappings.

Service Reference:

Examples:

To retrieve a Lambda function's event source mapping


/* This operation retrieves a Lambda function's event source mapping */

 var params = {
  UUID: "123489-xxxxx-kdla8d89d7"
 };
 lambda.getEventSourceMapping(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    BatchSize: 123, 
    EventSourceArn: "arn:aws:iam::123456789012:eventsource", 
    FunctionArn: "arn:aws:lambda:us-west-2:123456789012:function:myFunction", 
    LastModified: <Date Representation>, 
    LastProcessingResult: "", 
    State: "", 
    StateTransitionReason: "", 
    UUID: "123489-xxxxx-kdla8d89d7"
   }
   */
 });

Calling the getEventSourceMapping operation

var params = {
  UUID: 'STRING_VALUE' /* required */
};
lambda.getEventSourceMapping(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 identifier 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 identifier of the event source mapping.

      • BatchSize — (Integer)

        The maximum number of items to retrieve in a single batch.

      • EventSourceArn — (String)

        The Amazon Resource Name (ARN) of the event source.

      • FunctionArn — (String)

        The ARN of the Lambda function.

      • LastModified — (Date)

        The date that the event source mapping was last updated.

      • LastProcessingResult — (String)

        The result of the last AWS Lambda invocation of your Lambda function.

      • State — (String)

        The state of the event source mapping. It can be one of the following: Creating, Enabling, Enabled, Disabling, Disabled, Updating, or Deleting.

      • StateTransitionReason — (String)

        The cause of the last state change, either User initiated or Lambda initiated.

Returns:

  • (AWS.Request)

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

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

Returns information about function or function version, with a link to download the deployment package that's valid for 10 minutes. If you specify a function version, only details specific to that version are returned.

Service Reference:

Examples:

To retrieve a Lambda function's event source mapping


/* This operation retrieves a Lambda function's event source mapping */

 var params = {
  FunctionName: "myFunction", 
  Qualifier: "1"
 };
 lambda.getFunction(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    Code: {
     Location: "somelocation", 
     RepositoryType: "S3"
    }, 
    Configuration: {
     CodeSha256: "LQT+0DHxxxxcfwLyQjzoEFKZtdqQjHXanlSdfXBlEW0VA=", 
     CodeSize: 262, 
     Description: "A starter AWS Lambda function.", 
     Environment: {
      Variables: {
       "S3_BUCKET": "test"
      }
     }, 
     FunctionArn: "arn:aws:lambda:us-west-2:123456789012:function:myFunction", 
     FunctionName: "myFunction", 
     Handler: "index.handler", 
     LastModified: "2016-11-21T19:49:20.006+0000", 
     MemorySize: 128, 
     Role: "arn:aws:iam::123456789012:role/lambda_basic_execution", 
     Runtime: "nodejs8.10", 
     Timeout: 3, 
     Version: "$LATEST", 
     VpcConfig: {
      SecurityGroupIds: [
      ], 
      SubnetIds: [
      ]
     }
    }
   }
   */
 });

Calling the getFunction operation

var params = {
  FunctionName: 'STRING_VALUE', /* required */
  Qualifier: 'STRING_VALUE'
};
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 name of the Lambda function, version, or alias.

      Name formats

      • Function name - my-function (name-only), my-function:v1 (with alias).

      • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:my-function.

      • Partial ARN - 123456789012:function:my-function.

      You can append a version number or alias to any of the formats. The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

    • Qualifier — (String)

      Specify a version or alias to get details about a published version of the function.

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)

        The configuration of the function or version.

        • FunctionName — (String)

          The name of the function.

        • FunctionArn — (String)

          The function's Amazon Resource Name (ARN).

        • Runtime — (String)

          The runtime environment for the Lambda function.

          Possible values include:
          • "nodejs"
          • "nodejs4.3"
          • "nodejs6.10"
          • "nodejs8.10"
          • "java8"
          • "python2.7"
          • "python3.6"
          • "python3.7"
          • "dotnetcore1.0"
          • "dotnetcore2.0"
          • "dotnetcore2.1"
          • "nodejs4.3-edge"
          • "go1.x"
          • "ruby2.5"
          • "provided"
        • Role — (String)

          The function's execution role.

        • Handler — (String)

          The function Lambda calls to begin executing your function.

        • CodeSize — (Integer)

          The size of the function's deployment package in bytes.

        • Description — (String)

          The function's description.

        • Timeout — (Integer)

          The amount of time that Lambda allows a function to run before terminating it.

        • MemorySize — (Integer)

          The memory allocated to the function

        • LastModified — (String)

          The date and time that the function was last updated, in ISO-8601 format (YYYY-MM-DDThh:mm:ss.sTZD).

        • CodeSha256 — (String)

          The SHA256 hash of the function's deployment package.

        • Version — (String)

          The version of the Lambda function.

        • VpcConfig — (map)

          The function's networking configuration.

          • SubnetIds — (Array<String>)

            A list of VPC subnet IDs.

          • SecurityGroupIds — (Array<String>)

            A list of VPC security groups IDs.

          • VpcId — (String)

            The ID of the VPC.

        • DeadLetterConfig — (map)

          The function's dead letter queue.

          • TargetArn — (String)

            The Amazon Resource Name (ARN) of an Amazon SQS queue or Amazon SNS topic.

        • Environment — (map)

          The function's environment variables.

          • Variables — (map<String>)

            Environment variable key-value pairs.

          • Error — (map)

            Error messages for environment variables that could not be applied.

            • ErrorCode — (String)

              The error code.

            • Message — (String)

              The error message.

        • KMSKeyArn — (String)

          The KMS key used to encrypt the function's environment variables. Only returned if you've configured a customer managed CMK.

        • TracingConfig — (map)

          The function's AWS X-Ray tracing configuration.

          • Mode — (String)

            The tracing mode.

            Possible values include:
            • "Active"
            • "PassThrough"
        • MasterArn — (String)

          For Lambda@Edge functions, the ARN of the master function.

        • RevisionId — (String)

          Represents the latest updated revision of the function or alias.

        • Layers — (Array<map>)

          The function's layers

          • Arn — (String)

            The Amazon Resource Name (ARN) of the function layer.

          • CodeSize — (Integer)

            The size of the layer archive in bytes.

      • Code — (map)

        The deployment package of the function or version.

        • RepositoryType — (String)

          The service hosting the file.

        • Location — (String)

          A pre-signed URL that you can use to download the deployment package.

      • Tags — (map<String>)

        The function's tags.

      • Concurrency — (map)

        The function's reserved concurrency.

        • ReservedConcurrentExecutions — (Integer)

          The number of concurrent executions reserved for this function. For more information, see Managing Concurrency.

Returns:

  • (AWS.Request)

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

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

Returns a the version-specific settings of a Lambda function or version. The output includes only options that can vary between versions of a function. To modify these settings, use UpdateFunctionConfiguration.

To get all of a function's details, including function-level settings, use GetFunction.

Service Reference:

Examples:

To retrieve a Lambda function's event source mapping


/* This operation retrieves a Lambda function's event source mapping */

 var params = {
  FunctionName: "myFunction", 
  Qualifier: "1"
 };
 lambda.getFunctionConfiguration(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    CodeSha256: "LQT+0DHxxxxcfwLyQjzoEFKZtdqQjHXanlSdfXBlEW0VA=", 
    CodeSize: 123, 
    DeadLetterConfig: {
    }, 
    Description: "", 
    Environment: {
    }, 
    FunctionArn: "arn:aws:lambda:us-west-2:123456789012:function:myFunction", 
    FunctionName: "myFunction", 
    Handler: "index.handler", 
    KMSKeyArn: "", 
    LastModified: "2016-11-21T19:49:20.006+0000", 
    MemorySize: 128, 
    Role: "arn:aws:iam::123456789012:role/lambda_basic_execution", 
    Runtime: "python2.7", 
    Timeout: 123, 
    Version: "1", 
    VpcConfig: {
    }
   }
   */
 });

Calling the getFunctionConfiguration operation

var params = {
  FunctionName: 'STRING_VALUE', /* required */
  Qualifier: 'STRING_VALUE'
};
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, version, or alias.

      Name formats

      • Function name - my-function (name-only), my-function:v1 (with alias).

      • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:my-function.

      • Partial ARN - 123456789012:function:my-function.

      You can append a version number or alias to any of the formats. The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

    • Qualifier — (String)

      Specify a version or alias to get details about a published version of the function.

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 function's Amazon Resource Name (ARN).

      • Runtime — (String)

        The runtime environment for the Lambda function.

        Possible values include:
        • "nodejs"
        • "nodejs4.3"
        • "nodejs6.10"
        • "nodejs8.10"
        • "java8"
        • "python2.7"
        • "python3.6"
        • "python3.7"
        • "dotnetcore1.0"
        • "dotnetcore2.0"
        • "dotnetcore2.1"
        • "nodejs4.3-edge"
        • "go1.x"
        • "ruby2.5"
        • "provided"
      • Role — (String)

        The function's execution role.

      • Handler — (String)

        The function Lambda calls to begin executing your function.

      • CodeSize — (Integer)

        The size of the function's deployment package in bytes.

      • Description — (String)

        The function's description.

      • Timeout — (Integer)

        The amount of time that Lambda allows a function to run before terminating it.

      • MemorySize — (Integer)

        The memory allocated to the function

      • LastModified — (String)

        The date and time that the function was last updated, in ISO-8601 format (YYYY-MM-DDThh:mm:ss.sTZD).

      • CodeSha256 — (String)

        The SHA256 hash of the function's deployment package.

      • Version — (String)

        The version of the Lambda function.

      • VpcConfig — (map)

        The function's networking configuration.

        • SubnetIds — (Array<String>)

          A list of VPC subnet IDs.

        • SecurityGroupIds — (Array<String>)

          A list of VPC security groups IDs.

        • VpcId — (String)

          The ID of the VPC.

      • DeadLetterConfig — (map)

        The function's dead letter queue.

        • TargetArn — (String)

          The Amazon Resource Name (ARN) of an Amazon SQS queue or Amazon SNS topic.

      • Environment — (map)

        The function's environment variables.

        • Variables — (map<String>)

          Environment variable key-value pairs.

        • Error — (map)

          Error messages for environment variables that could not be applied.

          • ErrorCode — (String)

            The error code.

          • Message — (String)

            The error message.

      • KMSKeyArn — (String)

        The KMS key used to encrypt the function's environment variables. Only returned if you've configured a customer managed CMK.

      • TracingConfig — (map)

        The function's AWS X-Ray tracing configuration.

        • Mode — (String)

          The tracing mode.

          Possible values include:
          • "Active"
          • "PassThrough"
      • MasterArn — (String)

        For Lambda@Edge functions, the ARN of the master function.

      • RevisionId — (String)

        Represents the latest updated revision of the function or alias.

      • Layers — (Array<map>)

        The function's layers

        • Arn — (String)

          The Amazon Resource Name (ARN) of the function layer.

        • CodeSize — (Integer)

          The size of the layer archive in bytes.

Returns:

  • (AWS.Request)

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

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

Returns information about a version of an AWS Lambda layer, with a link to download the layer archive that's valid for 10 minutes.

Service Reference:

Examples:

Calling the getLayerVersion operation

var params = {
  LayerName: 'STRING_VALUE', /* required */
  VersionNumber: 0 /* required */
};
lambda.getLayerVersion(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: {})
    • LayerName — (String)

      The name or Amazon Resource Name (ARN) of the layer.

    • VersionNumber — (Integer)

      The version number.

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:

      • Content — (map)

        Details about the layer version.

        • Location — (String)

          A link to the layer archive in Amazon S3 that is valid for 10 minutes.

        • CodeSha256 — (String)

          The SHA-256 hash of the layer archive.

        • CodeSize — (Integer)

          The size of the layer archive in bytes.

      • LayerArn — (String)

        The ARN of the layer.

      • LayerVersionArn — (String)

        The ARN of the layer version.

      • Description — (String)

        The description of the version.

      • CreatedDate — (String)

        The date that the layer version was created, in ISO-8601 format (YYYY-MM-DDThh:mm:ss.sTZD).

      • Version — (Integer)

        The version number.

      • CompatibleRuntimes — (Array<String>)

        The layer's compatible runtimes.

      • LicenseInfo — (String)

        The layer's software license.

Returns:

  • (AWS.Request)

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

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

Returns the permission policy for a version of an AWS Lambda layer. For more information, see AddLayerVersionPermission.

Service Reference:

Examples:

Calling the getLayerVersionPolicy operation

var params = {
  LayerName: 'STRING_VALUE', /* required */
  VersionNumber: 0 /* required */
};
lambda.getLayerVersionPolicy(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: {})
    • LayerName — (String)

      The name or Amazon Resource Name (ARN) of the layer.

    • VersionNumber — (Integer)

      The version number.

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:

      • Policy — (String)

        The policy document.

      • RevisionId — (String)

        A unique identifier for the current revision of the policy.

Returns:

  • (AWS.Request)

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

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

Returns the resource-based IAM policy for a function, version, or alias.

Service Reference:

Examples:

To retrieve a Lambda function policy


/* This operation retrieves a Lambda function policy */

 var params = {
  FunctionName: "myFunction", 
  Qualifier: "1"
 };
 lambda.getPolicy(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    Policy: ""
   }
   */
 });

Calling the getPolicy operation

var params = {
  FunctionName: 'STRING_VALUE', /* required */
  Qualifier: 'STRING_VALUE'
};
lambda.getPolicy(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, version, or alias.

      Name formats

      • Function name - my-function (name-only), my-function:v1 (with alias).

      • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:my-function.

      • Partial ARN - 123456789012:function:my-function.

      You can append a version number or alias to any of the formats. The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

    • Qualifier — (String)

      Specify a version or alias to get the policy for that resource.

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:

      • Policy — (String)

        The resource-based policy.

      • RevisionId — (String)

        A unique identifier for the current revision of the policy.

Returns:

  • (AWS.Request)

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

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

Invokes a Lambda function. You can invoke a function synchronously and wait for the response, or asynchronously. To invoke a function asynchronously, set InvocationType to Event.

For synchronous invocation, details about the function response, including errors, are included in the response body and headers. For either invocation type, you can find more information in the execution log and trace. To record function errors for asynchronous invocations, configure your function with a dead letter queue.

The status code in the API response does not reflect function errors. Error codes are reserved for errors that prevent your function from executing, such as permissions errors, limit errors, or issues with your function's code and configuration. For example, Lambda returns TooManyRequestsException if executing the function would cause you to exceed a concurrency limit at either the account level (ConcurrentInvocationLimitExceeded) or function level (ReservedFunctionConcurrentInvocationLimitExceeded).

For functions with a long timeout, your client may be disconnected during synchronous invocation while it waits for a response. Configure your HTTP client, SDK, firewall, proxy, or operating system to allow for long connections with timeout or keep-alive settings.

This operation requires permission for the lambda:InvokeFunction action.

Service Reference:

Examples:

To invoke a Lambda function


/* This operation invokes a Lambda function */

 var params = {
  ClientContext: "MyApp", 
  FunctionName: "MyFunction", 
  InvocationType: "Event", 
  LogType: "Tail", 
  Payload: <Binary String>, 
  Qualifier: "1"
 };
 lambda.invoke(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    FunctionError: "", 
    LogResult: "", 
    Payload: <Binary String>, 
    StatusCode: 123
   }
   */
 });

Calling the invoke operation

var params = {
  FunctionName: 'STRING_VALUE', /* required */
  ClientContext: 'STRING_VALUE',
  InvocationType: Event | RequestResponse | DryRun,
  LogType: None | Tail,
  Payload: new Buffer('...') || 'STRING_VALUE' /* Strings will be Base-64 encoded on your behalf */,
  Qualifier: 'STRING_VALUE'
};
lambda.invoke(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, version, or alias.

      Name formats

      • Function name - my-function (name-only), my-function:v1 (with alias).

      • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:my-function.

      • Partial ARN - 123456789012:function:my-function.

      You can append a version number or alias to any of the formats. The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

    • InvocationType — (String)

      Choose from the following options.

      • RequestResponse (default) - Invoke the function synchronously. Keep the connection open until the function returns a response or times out. The API response includes the function response and additional data.

      • Event - Invoke the function asynchronously. Send events that fail multiple times to the function's dead-letter queue (if configured). The API response only includes a status code.

      • DryRun - Validate parameter values and verify that the user or role has permission to invoke the function.

      Possible values include:
      • "Event"
      • "RequestResponse"
      • "DryRun"
    • LogType — (String)

      Set to Tail to include the execution log in the response.

      Possible values include:
      • "None"
      • "Tail"
    • ClientContext — (String)

      Up to 3583 bytes of base64-encoded data about the invoking client to pass to the function in the context object.

    • Payload — (Buffer, Typed Array, Blob, String)

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

    • Qualifier — (String)

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

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:

      • StatusCode — (Integer)

        The HTTP status code will be in the 200 range for successful request. For the RequestResponse invocation type this status code will be 200. For the Event invocation type this status code will be 202. For the DryRun invocation type the status code will be 204.

      • FunctionError — (String)

        If present, indicates that an error occured during function execution. Details about the error are included in the response payload.

        • Handled - The runtime caught an error thrown by the function and formatted it into a JSON document.

        • Unhandled - The runtime did not handle the error. For example, the function ran out of memory or timed out.

      • LogResult — (String)

        The last 4 KB of the execution log, base64 encoded.

      • Payload — (Buffer, Typed Array, Blob, String)

        The response from the function, or an error object.

      • ExecutedVersion — (String)

        The version of the function that executed. When you invoke a function with an alias, indicates which version the alias resolved to.

Returns:

  • (AWS.Request)

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

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

For asynchronous function invocation, use Invoke.

Invokes a function asynchronously.

Service Reference:

Examples:

To invoke a Lambda function asynchronously


/* This operation invokes a Lambda function asynchronously */

 var params = {
  FunctionName: "myFunction", 
  InvokeArgs: <Binary String>
 };
 lambda.invokeAsync(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    Status: 123
   }
   */
 });

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 name of the Lambda function.

      Name formats

      • Function name - my-function.

      • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:my-function.

      • Partial ARN - 123456789012:function:my-function.

      The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

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

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

Returns a list of aliases for a Lambda function.

Service Reference:

Examples:

To retrieve a Lambda function aliases


/* This operation retrieves a Lambda function's aliases */

 var params = {
  FunctionName: "myFunction", 
  FunctionVersion: "1", 
  Marker: "", 
  MaxItems: 123
 };
 lambda.listAliases(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    Aliases: [
    ], 
    NextMarker: ""
   }
   */
 });

Calling the listAliases operation

var params = {
  FunctionName: 'STRING_VALUE', /* required */
  FunctionVersion: 'STRING_VALUE',
  Marker: 'STRING_VALUE',
  MaxItems: 0
};
lambda.listAliases(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.

      Name formats

      • Function name - MyFunction.

      • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction.

      • Partial ARN - 123456789012:function:MyFunction.

      The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

    • FunctionVersion — (String)

      Specify a function version to only list aliases that invoke that version.

    • Marker — (String)

      Specify the pagination token returned by a previous request to retrieve the next page of results.

    • MaxItems — (Integer)

      Limit the number of aliases returned.

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)

        Pagination token included if more results are available.

      • Aliases — (Array<map>)

        A list of aliases.

        • AliasArn — (String)

          The Amazon Resource Name (ARN) of the alias.

        • Name — (String)

          The name of the alias.

        • FunctionVersion — (String)

          The function version that the alias invokes.

        • Description — (String)

          A description of the alias.

        • RoutingConfig — (map)

          The routing configuration of the alias.

          • AdditionalVersionWeights — (map<Float>)

            The name of the second alias, and the percentage of traffic that is routed to it.

        • RevisionId — (String)

          A unique identifier that changes when you update the alias.

Returns:

  • (AWS.Request)

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

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

Lists event source mappings. Specify an EventSourceArn to only show event source mappings for a single event source.

Service Reference:

Examples:

Calling the listEventSourceMappings operation

var params = {
  EventSourceArn: 'STRING_VALUE',
  FunctionName: 'STRING_VALUE',
  Marker: 'STRING_VALUE',
  MaxItems: 0
};
lambda.listEventSourceMappings(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 event source.

      • Amazon Kinesis - The ARN of the data stream or a stream consumer.

      • Amazon DynamoDB Streams - The ARN of the stream.

      • Amazon Simple Queue Service - The ARN of the queue.

    • FunctionName — (String)

      The name of the Lambda function.

      Name formats

      • Function name - MyFunction.

      • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction.

      • Version or Alias ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction:PROD.

      • Partial ARN - 123456789012:function:MyFunction.

      The length constraint applies only to the full ARN. If you specify only the function name, it's limited to 64 characters in length.

    • Marker — (String)

      A pagination token returned by a previous call.

    • MaxItems — (Integer)

      The maximum number of event source mappings to return.

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 pagination token that's returned when the response doesn't contain all event source mappings.

      • EventSourceMappings — (Array<map>)

        A list of event source mappings.

        • UUID — (String)

          The identifier of the event source mapping.

        • BatchSize — (Integer)

          The maximum number of items to retrieve in a single batch.

        • EventSourceArn — (String)

          The Amazon Resource Name (ARN) of the event source.

        • FunctionArn — (String)

          The ARN of the Lambda function.

        • LastModified — (Date)

          The date that the event source mapping was last updated.

        • LastProcessingResult — (String)

          The result of the last AWS Lambda invocation of your Lambda function.

        • State — (String)

          The state of the event source mapping. It can be one of the following: Creating, Enabling, Enabled, Disabling, Disabled, Updating, or Deleting.

        • StateTransitionReason — (String)

          The cause of the last state change, either User initiated or Lambda initiated.

Returns:

  • (AWS.Request)

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

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

Returns a list of Lambda functions, with the version-specific configuration of each.

Set FunctionVersion to ALL to include all published versions of each function in addition to the unpublished version. To get more information about a function or version, use GetFunction.

Service Reference:

Examples:

To retrieve a list of Lambda functions


/* This operation retrieves a Lambda functions */

 var params = {
  Marker: "", 
  MaxItems: 123
 };
 lambda.listFunctions(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    Functions: [
    ], 
    NextMarker: ""
   }
   */
 });

Calling the listFunctions operation

var params = {
  FunctionVersion: ALL,
  Marker: 'STRING_VALUE',
  MasterRegion: 'STRING_VALUE',
  MaxItems: 0
};
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: {})
    • MasterRegion — (String)

      For Lambda@Edge functions, the region of the master function. For example, us-east-2 or ALL. If specified, you must set FunctionVersion to ALL.

    • FunctionVersion — (String)

      Set to ALL to include entries for all published versions of each function.

      Possible values include:
      • "ALL"
    • Marker — (String)

      Specify the pagination token returned by a previous request to retrieve the next page of results.

    • MaxItems — (Integer)

      Specify a value between 1 and 50 to limit the number of functions in the response.

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)

        Pagination token included if more results are available.

      • Functions — (Array<map>)

        A list of Lambda functions.

        • FunctionName — (String)

          The name of the function.

        • FunctionArn — (String)

          The function's Amazon Resource Name (ARN).

        • Runtime — (String)

          The runtime environment for the Lambda function.

          Possible values include:
          • "nodejs"
          • "nodejs4.3"
          • "nodejs6.10"
          • "nodejs8.10"
          • "java8"
          • "python2.7"
          • "python3.6"
          • "python3.7"
          • "dotnetcore1.0"
          • "dotnetcore2.0"
          • "dotnetcore2.1"
          • "nodejs4.3-edge"
          • "go1.x"
          • "ruby2.5"
          • "provided"
        • Role — (String)

          The function's execution role.

        • Handler — (String)

          The function Lambda calls to begin executing your function.

        • CodeSize — (Integer)

          The size of the function's deployment package in bytes.

        • Description — (String)

          The function's description.

        • Timeout — (Integer)

          The amount of time that Lambda allows a function to run before terminating it.

        • MemorySize — (Integer)

          The memory allocated to the function

        • LastModified — (String)

          The date and time that the function was last updated, in ISO-8601 format (YYYY-MM-DDThh:mm:ss.sTZD).

        • CodeSha256 — (String)

          The SHA256 hash of the function's deployment package.

        • Version — (String)

          The version of the Lambda function.

        • VpcConfig — (map)

          The function's networking configuration.

          • SubnetIds — (Array<String>)

            A list of VPC subnet IDs.

          • SecurityGroupIds — (Array<String>)

            A list of VPC security groups IDs.

          • VpcId — (String)

            The ID of the VPC.

        • DeadLetterConfig — (map)

          The function's dead letter queue.

          • TargetArn — (String)

            The Amazon Resource Name (ARN) of an Amazon SQS queue or Amazon SNS topic.

        • Environment — (map)

          The function's environment variables.

          • Variables — (map<String>)

            Environment variable key-value pairs.

          • Error — (map)

            Error messages for environment variables that could not be applied.

            • ErrorCode — (String)

              The error code.

            • Message — (String)

              The error message.

        • KMSKeyArn — (String)

          The KMS key used to encrypt the function's environment variables. Only returned if you've configured a customer managed CMK.

        • TracingConfig — (map)

          The function's AWS X-Ray tracing configuration.

          • Mode — (String)

            The tracing mode.

            Possible values include:
            • "Active"
            • "PassThrough"
        • MasterArn — (String)

          For Lambda@Edge functions, the ARN of the master function.

        • RevisionId — (String)

          Represents the latest updated revision of the function or alias.

        • Layers — (Array<map>)

          The function's layers

          • Arn — (String)

            The Amazon Resource Name (ARN) of the function layer.

          • CodeSize — (Integer)

            The size of the layer archive in bytes.

Returns:

  • (AWS.Request)

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

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

Lists AWS Lambda layers and shows information about the latest version of each. Specify a runtime identifier to list only layers that indicate that they're compatible with that runtime.

Service Reference:

Examples:

Calling the listLayers operation

var params = {
  CompatibleRuntime: nodejs | nodejs4.3 | nodejs6.10 | nodejs8.10 | java8 | python2.7 | python3.6 | python3.7 | dotnetcore1.0 | dotnetcore2.0 | dotnetcore2.1 | nodejs4.3-edge | go1.x | ruby2.5 | provided,
  Marker: 'STRING_VALUE',
  MaxItems: 0
};
lambda.listLayers(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: {})
    • CompatibleRuntime — (String)

      A runtime identifier. For example, go1.x.

      Possible values include:
      • "nodejs"
      • "nodejs4.3"
      • "nodejs6.10"
      • "nodejs8.10"
      • "java8"
      • "python2.7"
      • "python3.6"
      • "python3.7"
      • "dotnetcore1.0"
      • "dotnetcore2.0"
      • "dotnetcore2.1"
      • "nodejs4.3-edge"
      • "go1.x"
      • "ruby2.5"
      • "provided"
    • Marker — (String)

      A pagination token returned by a previous call.

    • MaxItems — (Integer)

      The maximum number of layers to return.

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 pagination token returned when the response doesn't contain all layers.

      • Layers — (Array<map>)

        A list of function layers.

        • LayerName — (String)

          The name of the layer.

        • LayerArn — (String)

          The Amazon Resource Name (ARN) of the function layer.

        • LatestMatchingVersion — (map)

          The newest version of the layer.

          • LayerVersionArn — (String)

            The ARN of the layer version.

          • Version — (Integer)

            The version number.

          • Description — (String)

            The description of the version.

          • CreatedDate — (String)

            The date that the version was created, in ISO 8601 format. For example, 2018-11-27T15:10:45.123+0000.

          • CompatibleRuntimes — (Array<String>)

            The layer's compatible runtimes.

          • LicenseInfo — (String)

            The layer's open-source license.

Returns:

  • (AWS.Request)

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

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

Lists the versions of an AWS Lambda layer. Versions that have been deleted aren't listed. Specify a runtime identifier to list only versions that indicate that they're compatible with that runtime.

Service Reference:

Examples:

Calling the listLayerVersions operation

var params = {
  LayerName: 'STRING_VALUE', /* required */
  CompatibleRuntime: nodejs | nodejs4.3 | nodejs6.10 | nodejs8.10 | java8 | python2.7 | python3.6 | python3.7 | dotnetcore1.0 | dotnetcore2.0 | dotnetcore2.1 | nodejs4.3-edge | go1.x | ruby2.5 | provided,
  Marker: 'STRING_VALUE',
  MaxItems: 0
};
lambda.listLayerVersions(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: {})
    • CompatibleRuntime — (String)

      A runtime identifier. For example, go1.x.

      Possible values include:
      • "nodejs"
      • "nodejs4.3"
      • "nodejs6.10"
      • "nodejs8.10"
      • "java8"
      • "python2.7"
      • "python3.6"
      • "python3.7"
      • "dotnetcore1.0"
      • "dotnetcore2.0"
      • "dotnetcore2.1"
      • "nodejs4.3-edge"
      • "go1.x"
      • "ruby2.5"
      • "provided"
    • LayerName — (String)

      The name or Amazon Resource Name (ARN) of the layer.

    • Marker — (String)

      A pagination token returned by a previous call.

    • MaxItems — (Integer)

      The maximum number of versions to return.

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 pagination token returned when the response doesn't contain all versions.

      • LayerVersions — (Array<map>)

        A list of versions.

        • LayerVersionArn — (String)

          The ARN of the layer version.

        • Version — (Integer)

          The version number.

        • Description — (String)

          The description of the version.

        • CreatedDate — (String)

          The date that the version was created, in ISO 8601 format. For example, 2018-11-27T15:10:45.123+0000.

        • CompatibleRuntimes — (Array<String>)

          The layer's compatible runtimes.

        • LicenseInfo — (String)

          The layer's open-source license.

Returns:

  • (AWS.Request)

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

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

Returns a function's tags. You can also view tags with GetFunction.

Service Reference:

Examples:

Calling the listTags operation

var params = {
  Resource: 'STRING_VALUE' /* required */
};
lambda.listTags(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: {})
    • Resource — (String)

      The function's Amazon Resource Name (ARN).

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:

      • Tags — (map<String>)

        The function's tags.

Returns:

  • (AWS.Request)

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

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

Returns a list of versions, with the version-specific configuration of each.

Service Reference:

Examples:

To retrieve a list of Lambda function versions


/* This operation retrieves a Lambda function versions */

 var params = {
  FunctionName: "myFunction", 
  Marker: "", 
  MaxItems: 123
 };
 lambda.listVersionsByFunction(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    NextMarker: "", 
    Versions: [
    ]
   }
   */
 });

Calling the listVersionsByFunction operation

var params = {
  FunctionName: 'STRING_VALUE', /* required */
  Marker: 'STRING_VALUE',
  MaxItems: 0
};
lambda.listVersionsByFunction(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.

      Name formats

      • Function name - MyFunction.

      • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction.

      • Partial ARN - 123456789012:function:MyFunction.

      The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

    • Marker — (String)

      Specify the pagination token returned by a previous request to retrieve the next page of results.

    • MaxItems — (Integer)

      Limit the number of versions returned.

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)

        Pagination token included if more results are available.

      • Versions — (Array<map>)

        A list of Lambda function versions.

        • FunctionName — (String)

          The name of the function.

        • FunctionArn — (String)

          The function's Amazon Resource Name (ARN).

        • Runtime — (String)

          The runtime environment for the Lambda function.

          Possible values include:
          • "nodejs"
          • "nodejs4.3"
          • "nodejs6.10"
          • "nodejs8.10"
          • "java8"
          • "python2.7"
          • "python3.6"
          • "python3.7"
          • "dotnetcore1.0"
          • "dotnetcore2.0"
          • "dotnetcore2.1"
          • "nodejs4.3-edge"
          • "go1.x"
          • "ruby2.5"
          • "provided"
        • Role — (String)

          The function's execution role.

        • Handler — (String)

          The function Lambda calls to begin executing your function.

        • CodeSize — (Integer)

          The size of the function's deployment package in bytes.

        • Description — (String)

          The function's description.

        • Timeout — (Integer)

          The amount of time that Lambda allows a function to run before terminating it.

        • MemorySize — (Integer)

          The memory allocated to the function

        • LastModified — (String)

          The date and time that the function was last updated, in ISO-8601 format (YYYY-MM-DDThh:mm:ss.sTZD).

        • CodeSha256 — (String)

          The SHA256 hash of the function's deployment package.

        • Version — (String)

          The version of the Lambda function.

        • VpcConfig — (map)

          The function's networking configuration.

          • SubnetIds — (Array<String>)

            A list of VPC subnet IDs.

          • SecurityGroupIds — (Array<String>)

            A list of VPC security groups IDs.

          • VpcId — (String)

            The ID of the VPC.

        • DeadLetterConfig — (map)

          The function's dead letter queue.

          • TargetArn — (String)

            The Amazon Resource Name (ARN) of an Amazon SQS queue or Amazon SNS topic.

        • Environment — (map)

          The function's environment variables.

          • Variables — (map<String>)

            Environment variable key-value pairs.

          • Error — (map)

            Error messages for environment variables that could not be applied.

            • ErrorCode — (String)

              The error code.

            • Message — (String)

              The error message.

        • KMSKeyArn — (String)

          The KMS key used to encrypt the function's environment variables. Only returned if you've configured a customer managed CMK.

        • TracingConfig — (map)

          The function's AWS X-Ray tracing configuration.

          • Mode — (String)

            The tracing mode.

            Possible values include:
            • "Active"
            • "PassThrough"
        • MasterArn — (String)

          For Lambda@Edge functions, the ARN of the master function.

        • RevisionId — (String)

          Represents the latest updated revision of the function or alias.

        • Layers — (Array<map>)

          The function's layers

          • Arn — (String)

            The Amazon Resource Name (ARN) of the function layer.

          • CodeSize — (Integer)

            The size of the layer archive in bytes.

Returns:

  • (AWS.Request)

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

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

Creates an AWS Lambda layer from a ZIP archive. Each time you call PublishLayerVersion with the same version name, a new version is created.

Add layers to your function with CreateFunction or UpdateFunctionConfiguration.

Service Reference:

Examples:

Calling the publishLayerVersion operation

var params = {
  Content: { /* required */
    S3Bucket: 'STRING_VALUE',
    S3Key: 'STRING_VALUE',
    S3ObjectVersion: 'STRING_VALUE',
    ZipFile: new Buffer('...') || 'STRING_VALUE' /* Strings will be Base-64 encoded on your behalf */
  },
  LayerName: 'STRING_VALUE', /* required */
  CompatibleRuntimes: [
    nodejs | nodejs4.3 | nodejs6.10 | nodejs8.10 | java8 | python2.7 | python3.6 | python3.7 | dotnetcore1.0 | dotnetcore2.0 | dotnetcore2.1 | nodejs4.3-edge | go1.x | ruby2.5 | provided,
    /* more items */
  ],
  Description: 'STRING_VALUE',
  LicenseInfo: 'STRING_VALUE'
};
lambda.publishLayerVersion(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: {})
    • LayerName — (String)

      The name or Amazon Resource Name (ARN) of the layer.

    • Description — (String)

      The description of the version.

    • Content — (map)

      The function layer archive.

      • S3Bucket — (String)

        The Amazon S3 bucket of the layer archive.

      • S3Key — (String)

        The Amazon S3 key of the layer archive.

      • S3ObjectVersion — (String)

        For versioned objects, the version of the layer archive object to use.

      • ZipFile — (Buffer, Typed Array, Blob, String)

        The base64-encoded contents of the layer archive. AWS SDK and AWS CLI clients handle the encoding for you.

    • CompatibleRuntimes — (Array<String>)

      A list of compatible function runtimes. Used for filtering with ListLayers and ListLayerVersions.

    • LicenseInfo — (String)

      The layer's software license. It can be any of the following:

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:

      • Content — (map)

        Details about the layer version.

        • Location — (String)

          A link to the layer archive in Amazon S3 that is valid for 10 minutes.

        • CodeSha256 — (String)

          The SHA-256 hash of the layer archive.

        • CodeSize — (Integer)

          The size of the layer archive in bytes.

      • LayerArn — (String)

        The ARN of the layer.

      • LayerVersionArn — (String)

        The ARN of the layer version.

      • Description — (String)

        The description of the version.

      • CreatedDate — (String)

        The date that the layer version was created, in ISO-8601 format (YYYY-MM-DDThh:mm:ss.sTZD).

      • Version — (Integer)

        The version number.

      • CompatibleRuntimes — (Array<String>)

        The layer's compatible runtimes.

      • LicenseInfo — (String)

        The layer's software license.

Returns:

  • (AWS.Request)

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

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

Creates a version from the current code and configuration of a function. Use versions to create a snapshot of your function code and configuration that doesn't change.

AWS Lambda does not publish a version if the function's configuration and code hasn't changed since the last version. Use UpdateFunctionCode or UpdateFunctionConfiguration to update the function prior to publishing a version.

Clients can invoke versions directly or with an alias. To create an alias, use CreateAlias.

Service Reference:

Examples:

To publish a version of a Lambda function


/* This operation publishes a version of a Lambda function */

 var params = {
  CodeSha256: "", 
  Description: "", 
  FunctionName: "myFunction"
 };
 lambda.publishVersion(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    CodeSha256: "", 
    CodeSize: 123, 
    Description: "", 
    FunctionArn: "arn:aws:lambda:us-west-2:123456789012:function:myFunction", 
    FunctionName: "myFunction", 
    Handler: "index.handler", 
    LastModified: "2016-11-21T19:49:20.006+0000", 
    MemorySize: 128, 
    Role: "arn:aws:iam::123456789012:role/lambda_basic_execution", 
    Runtime: "python2.7", 
    Timeout: 123, 
    Version: "1", 
    VpcConfig: {
    }
   }
   */
 });

Calling the publishVersion operation

var params = {
  FunctionName: 'STRING_VALUE', /* required */
  CodeSha256: 'STRING_VALUE',
  Description: 'STRING_VALUE',
  RevisionId: 'STRING_VALUE'
};
lambda.publishVersion(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.

      Name formats

      • Function name - MyFunction.

      • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction.

      • Partial ARN - 123456789012:function:MyFunction.

      The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

    • CodeSha256 — (String)

      Only publish a version if the hash matches the value specified. Use this option to avoid publishing a version if the function code has changed since you last updated it. You can get the hash for the version you uploaded from the output of UpdateFunctionCode.

    • Description — (String)

      Specify a description for the version to override the description in the function configuration.

    • RevisionId — (String)

      Only update the function if the revision ID matches the ID specified. Use this option to avoid publishing a version if the function configuration has changed since you last updated it.

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 function's Amazon Resource Name (ARN).

      • Runtime — (String)

        The runtime environment for the Lambda function.

        Possible values include:
        • "nodejs"
        • "nodejs4.3"
        • "nodejs6.10"
        • "nodejs8.10"
        • "java8"
        • "python2.7"
        • "python3.6"
        • "python3.7"
        • "dotnetcore1.0"
        • "dotnetcore2.0"
        • "dotnetcore2.1"
        • "nodejs4.3-edge"
        • "go1.x"
        • "ruby2.5"
        • "provided"
      • Role — (String)

        The function's execution role.

      • Handler — (String)

        The function Lambda calls to begin executing your function.

      • CodeSize — (Integer)

        The size of the function's deployment package in bytes.

      • Description — (String)

        The function's description.

      • Timeout — (Integer)

        The amount of time that Lambda allows a function to run before terminating it.

      • MemorySize — (Integer)

        The memory allocated to the function

      • LastModified — (String)

        The date and time that the function was last updated, in ISO-8601 format (YYYY-MM-DDThh:mm:ss.sTZD).

      • CodeSha256 — (String)

        The SHA256 hash of the function's deployment package.

      • Version — (String)

        The version of the Lambda function.

      • VpcConfig — (map)

        The function's networking configuration.

        • SubnetIds — (Array<String>)

          A list of VPC subnet IDs.

        • SecurityGroupIds — (Array<String>)

          A list of VPC security groups IDs.

        • VpcId — (String)

          The ID of the VPC.

      • DeadLetterConfig — (map)

        The function's dead letter queue.

        • TargetArn — (String)

          The Amazon Resource Name (ARN) of an Amazon SQS queue or Amazon SNS topic.

      • Environment — (map)

        The function's environment variables.

        • Variables — (map<String>)

          Environment variable key-value pairs.

        • Error — (map)

          Error messages for environment variables that could not be applied.

          • ErrorCode — (String)

            The error code.

          • Message — (String)

            The error message.

      • KMSKeyArn — (String)

        The KMS key used to encrypt the function's environment variables. Only returned if you've configured a customer managed CMK.

      • TracingConfig — (map)

        The function's AWS X-Ray tracing configuration.

        • Mode — (String)

          The tracing mode.

          Possible values include:
          • "Active"
          • "PassThrough"
      • MasterArn — (String)

        For Lambda@Edge functions, the ARN of the master function.

      • RevisionId — (String)

        Represents the latest updated revision of the function or alias.

      • Layers — (Array<map>)

        The function's layers

        • Arn — (String)

          The Amazon Resource Name (ARN) of the function layer.

        • CodeSize — (Integer)

          The size of the layer archive in bytes.

Returns:

  • (AWS.Request)

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

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

Sets the maximum number of simultaneous executions for a function, and reserves capacity for that concurrency level.

Concurrency settings apply to the function as a whole, including all published versions and the unpublished version. Reserving concurrency both guarantees that your function has capacity to process the specified number of events simultaneously, and prevents it from scaling beyond that level. Use GetFunction to see the current setting for a function.

Use GetAccountSettings to see your regional concurrency limit. You can reserve concurrency for as many functions as you like, as long as you leave at least 100 simultaneous executions unreserved for functions that aren't configured with a per-function limit. For more information, see Managing Concurrency.

Service Reference:

Examples:

Calling the putFunctionConcurrency operation

var params = {
  FunctionName: 'STRING_VALUE', /* required */
  ReservedConcurrentExecutions: 0 /* required */
};
lambda.putFunctionConcurrency(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.

      Name formats

      • Function name - my-function.

      • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:my-function.

      • Partial ARN - 123456789012:function:my-function.

      The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

    • ReservedConcurrentExecutions — (Integer)

      The number of simultaneous executions to reserve for the function.

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:

      • ReservedConcurrentExecutions — (Integer)

        The number of concurrent executions reserved for this function. For more information, see Managing Concurrency.

Returns:

  • (AWS.Request)

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

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

Removes a statement from the permissions policy for a version of an AWS Lambda layer. For more information, see AddLayerVersionPermission.

Service Reference:

Examples:

Calling the removeLayerVersionPermission operation

var params = {
  LayerName: 'STRING_VALUE', /* required */
  StatementId: 'STRING_VALUE', /* required */
  VersionNumber: 0, /* required */
  RevisionId: 'STRING_VALUE'
};
lambda.removeLayerVersionPermission(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: {})
    • LayerName — (String)

      The name or Amazon Resource Name (ARN) of the layer.

    • VersionNumber — (Integer)

      The version number.

    • StatementId — (String)

      The identifier that was specified when the statement was added.

    • RevisionId — (String)

      Only update the policy if the revision ID matches the ID specified. Use this option to avoid modifying a policy that has changed since you last read it.

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.

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

Revokes function use permission from an AWS service or another account. You can get the ID of the statement from the output of GetPolicy.

Service Reference:

Examples:

To remove a Lambda function's permissions


/* This operation removes a Lambda function's permissions */

 var params = {
  FunctionName: "myFunction", 
  Qualifier: "1", 
  StatementId: "role-statement-id"
 };
 lambda.removePermission(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
 });

Calling the removePermission operation

var params = {
  FunctionName: 'STRING_VALUE', /* required */
  StatementId: 'STRING_VALUE', /* required */
  Qualifier: 'STRING_VALUE',
  RevisionId: 'STRING_VALUE'
};
lambda.removePermission(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, version, or alias.

      Name formats

      • Function name - my-function (name-only), my-function:v1 (with alias).

      • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:my-function.

      • Partial ARN - 123456789012:function:my-function.

      You can append a version number or alias to any of the formats. The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

    • StatementId — (String)

      Statement ID of the permission to remove.

    • Qualifier — (String)

      Specify a version or alias to remove permissions from a published version of the function.

    • RevisionId — (String)

      Only update the policy if the revision ID matches the ID specified. Use this option to avoid modifying a policy that has changed since you last read it.

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.

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

Adds tags to a function.

Service Reference:

Examples:

Calling the tagResource operation

var params = {
  Resource: 'STRING_VALUE', /* required */
  Tags: { /* required */
    '<TagKey>': 'STRING_VALUE',
    /* '<TagKey>': ... */
  }
};
lambda.tagResource(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: {})
    • Resource — (String)

      The function's Amazon Resource Name (ARN).

    • Tags — (map<String>)

      A list of tags to apply to the function.

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.

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

Removes tags from a function.

Service Reference:

Examples:

Calling the untagResource operation

var params = {
  Resource: 'STRING_VALUE', /* required */
  TagKeys: [ /* required */
    'STRING_VALUE',
    /* more items */
  ]
};
lambda.untagResource(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: {})
    • Resource — (String)

      The function's Amazon Resource Name (ARN).

    • TagKeys — (Array<String>)

      A list of tag keys to remove from the function.

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.

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

Updates the configuration of a Lambda function alias.

Service Reference:

Examples:

To update a Lambda function alias


/* This operation updates a Lambda function alias */

 var params = {
  Description: "", 
  FunctionName: "myFunction", 
  FunctionVersion: "1", 
  Name: "functionAlias"
 };
 lambda.updateAlias(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    AliasArn: "arn:aws:lambda:us-west-2:123456789012:function:functionAlias", 
    Description: "", 
    FunctionVersion: "1", 
    Name: "functionAlias"
   }
   */
 });

Calling the updateAlias operation

var params = {
  FunctionName: 'STRING_VALUE', /* required */
  Name: 'STRING_VALUE', /* required */
  Description: 'STRING_VALUE',
  FunctionVersion: 'STRING_VALUE',
  RevisionId: 'STRING_VALUE',
  RoutingConfig: {
    AdditionalVersionWeights: {
      '<AdditionalVersion>': 0.0,
      /* '<AdditionalVersion>': ... */
    }
  }
};
lambda.updateAlias(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.

      Name formats

      • Function name - MyFunction.

      • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction.

      • Partial ARN - 123456789012:function:MyFunction.

      The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

    • Name — (String)

      The name of the alias.

    • FunctionVersion — (String)

      The function version that the alias invokes.

    • Description — (String)

      A description of the alias.

    • RoutingConfig — (map)

      The routing configuration of the alias.

      • AdditionalVersionWeights — (map<Float>)

        The name of the second alias, and the percentage of traffic that is routed to it.

    • RevisionId — (String)

      Only update the alias if the revision ID matches the ID specified. Use this option to avoid modifying an alias that has changed since you last read it.

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:

      • AliasArn — (String)

        The Amazon Resource Name (ARN) of the alias.

      • Name — (String)

        The name of the alias.

      • FunctionVersion — (String)

        The function version that the alias invokes.

      • Description — (String)

        A description of the alias.

      • RoutingConfig — (map)

        The routing configuration of the alias.

        • AdditionalVersionWeights — (map<Float>)

          The name of the second alias, and the percentage of traffic that is routed to it.

      • RevisionId — (String)

        A unique identifier that changes when you update the alias.

Returns:

  • (AWS.Request)

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

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

Updates an event source mapping. You can change the function that AWS Lambda invokes, or pause invocation and resume later from the same location.

Service Reference:

Examples:

To update a Lambda function event source mapping


/* This operation updates a Lambda function event source mapping */

 var params = {
  BatchSize: 123, 
  Enabled: true, 
  FunctionName: "myFunction", 
  UUID: "1234xCy789012"
 };
 lambda.updateEventSourceMapping(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    BatchSize: 123, 
    EventSourceArn: "arn:aws:s3:::examplebucket/*", 
    FunctionArn: "arn:aws:lambda:us-west-2:123456789012:function:myFunction", 
    LastModified: <Date Representation>, 
    LastProcessingResult: "", 
    State: "", 
    StateTransitionReason: "", 
    UUID: "1234xCy789012"
   }
   */
 });

Calling the updateEventSourceMapping operation

var params = {
  UUID: 'STRING_VALUE', /* required */
  BatchSize: 0,
  Enabled: true || false,
  FunctionName: 'STRING_VALUE'
};
lambda.updateEventSourceMapping(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 identifier of the event source mapping.

    • FunctionName — (String)

      The name of the Lambda function.

      Name formats

      • Function name - MyFunction.

      • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction.

      • Version or Alias ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction:PROD.

      • Partial ARN - 123456789012:function:MyFunction.

      The length constraint applies only to the full ARN. If you specify only the function name, it's limited to 64 characters in length.

    • Enabled — (Boolean)

      Disables the event source mapping to pause polling and invocation.

    • BatchSize — (Integer)

      The maximum number of items to retrieve in a single batch.

      • Amazon Kinesis - Default 100. Max 10,000.

      • Amazon DynamoDB Streams - Default 100. Max 1,000.

      • Amazon Simple Queue Service - Default 10. Max 10.

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 identifier of the event source mapping.

      • BatchSize — (Integer)

        The maximum number of items to retrieve in a single batch.

      • EventSourceArn — (String)

        The Amazon Resource Name (ARN) of the event source.

      • FunctionArn — (String)

        The ARN of the Lambda function.

      • LastModified — (Date)

        The date that the event source mapping was last updated.

      • LastProcessingResult — (String)

        The result of the last AWS Lambda invocation of your Lambda function.

      • State — (String)

        The state of the event source mapping. It can be one of the following: Creating, Enabling, Enabled, Disabling, Disabled, Updating, or Deleting.

      • StateTransitionReason — (String)

        The cause of the last state change, either User initiated or Lambda initiated.

Returns:

  • (AWS.Request)

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

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

Updates a Lambda function's code.

The function's code is locked when you publish a version. You cannot modify the code of a published version, only the unpublished version.

Service Reference:

Examples:

To update a Lambda function's code


/* This operation updates a Lambda function's code */

 var params = {
  FunctionName: "myFunction", 
  Publish: true, 
  S3Bucket: "myBucket", 
  S3Key: "myKey", 
  S3ObjectVersion: "1", 
  ZipFile: <Binary String>
 };
 lambda.updateFunctionCode(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    CodeSha256: "LQT+0DHxxxxcfwLyQjzoEFKZtdqQjHXanlSdfXBlEW0VA=", 
    CodeSize: 123, 
    Description: "", 
    FunctionArn: "arn:aws:lambda:us-west-2:123456789012:function:myFunction", 
    FunctionName: "myFunction", 
    Handler: "index.handler", 
    LastModified: "2016-11-21T19:49:20.006+0000", 
    MemorySize: 128, 
    Role: "arn:aws:iam::123456789012:role/lambda_basic_execution", 
    Runtime: "python2.7", 
    Timeout: 123, 
    Version: "1", 
    VpcConfig: {
    }
   }
   */
 });

Calling the updateFunctionCode operation

var params = {
  FunctionName: 'STRING_VALUE', /* required */
  DryRun: true || false,
  Publish: true || false,
  RevisionId: 'STRING_VALUE',
  S3Bucket: 'STRING_VALUE',
  S3Key: 'STRING_VALUE',
  S3ObjectVersion: 'STRING_VALUE',
  ZipFile: new Buffer('...') || 'STRING_VALUE' /* Strings will be Base-64 encoded on your behalf */
};
lambda.updateFunctionCode(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.

      Name formats

      • Function name - my-function.

      • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:my-function.

      • Partial ARN - 123456789012:function:my-function.

      The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

    • ZipFile — (Buffer, Typed Array, Blob, String)

      The base64-encoded contents of the deployment package. AWS SDK and AWS CLI clients handle the encoding for you.

    • S3Bucket — (String)

      An Amazon S3 bucket in the same region as your function. The bucket can be in a different AWS account.

    • S3Key — (String)

      The Amazon S3 key of the deployment package.

    • S3ObjectVersion — (String)

      For versioned objects, the version of the deployment package object to use.

    • Publish — (Boolean)

      Set to true to publish a new version of the function after updating the code. This has the same effect as calling PublishVersion separately.

    • DryRun — (Boolean)

      Set to true to validate the request parameters and access permissions without modifying the function code.

    • RevisionId — (String)

      Only update the function if the revision ID matches the ID specified. Use this option to avoid modifying a function that has changed since you last read it.

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 function's Amazon Resource Name (ARN).

      • Runtime — (String)

        The runtime environment for the Lambda function.

        Possible values include:
        • "nodejs"
        • "nodejs4.3"
        • "nodejs6.10"
        • "nodejs8.10"
        • "java8"
        • "python2.7"
        • "python3.6"
        • "python3.7"
        • "dotnetcore1.0"
        • "dotnetcore2.0"
        • "dotnetcore2.1"
        • "nodejs4.3-edge"
        • "go1.x"
        • "ruby2.5"
        • "provided"
      • Role — (String)

        The function's execution role.

      • Handler — (String)

        The function Lambda calls to begin executing your function.

      • CodeSize — (Integer)

        The size of the function's deployment package in bytes.

      • Description — (String)

        The function's description.

      • Timeout — (Integer)

        The amount of time that Lambda allows a function to run before terminating it.

      • MemorySize — (Integer)

        The memory allocated to the function

      • LastModified — (String)

        The date and time that the function was last updated, in ISO-8601 format (YYYY-MM-DDThh:mm:ss.sTZD).

      • CodeSha256 — (String)

        The SHA256 hash of the function's deployment package.

      • Version — (String)

        The version of the Lambda function.

      • VpcConfig — (map)

        The function's networking configuration.

        • SubnetIds — (Array<String>)

          A list of VPC subnet IDs.

        • SecurityGroupIds — (Array<String>)

          A list of VPC security groups IDs.

        • VpcId — (String)

          The ID of the VPC.

      • DeadLetterConfig — (map)

        The function's dead letter queue.

        • TargetArn — (String)

          The Amazon Resource Name (ARN) of an Amazon SQS queue or Amazon SNS topic.

      • Environment — (map)

        The function's environment variables.

        • Variables — (map<String>)

          Environment variable key-value pairs.

        • Error — (map)

          Error messages for environment variables that could not be applied.

          • ErrorCode — (String)

            The error code.

          • Message — (String)

            The error message.

      • KMSKeyArn — (String)

        The KMS key used to encrypt the function's environment variables. Only returned if you've configured a customer managed CMK.

      • TracingConfig — (map)

        The function's AWS X-Ray tracing configuration.

        • Mode — (String)

          The tracing mode.

          Possible values include:
          • "Active"
          • "PassThrough"
      • MasterArn — (String)

        For Lambda@Edge functions, the ARN of the master function.

      • RevisionId — (String)

        Represents the latest updated revision of the function or alias.

      • Layers — (Array<map>)

        The function's layers

        • Arn — (String)

          The Amazon Resource Name (ARN) of the function layer.

        • CodeSize — (Integer)

          The size of the layer archive in bytes.

Returns:

  • (AWS.Request)

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

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

Modify the version-specifc settings of a Lambda function.

These settings can vary between versions of a function and are locked when you publish a version. You cannot modify the configuration of a published version, only the unpublished version.

To configure function concurrency, use PutFunctionConcurrency. To grant invoke permissions to an account or AWS service, use AddPermission.

Service Reference:

Examples:

To update a Lambda function's configuration


/* This operation updates a Lambda function's configuration */

 var params = {
  Description: "", 
  FunctionName: "myFunction", 
  Handler: "index.handler", 
  MemorySize: 128, 
  Role: "arn:aws:iam::123456789012:role/lambda_basic_execution", 
  Runtime: "python2.7", 
  Timeout: 123, 
  VpcConfig: {
  }
 };
 lambda.updateFunctionConfiguration(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    CodeSha256: "LQT+0DHxxxxcfwLyQjzoEFKZtdqQjHXanlSdfXBlEW0VA=", 
    CodeSize: 123, 
    Description: "", 
    FunctionArn: "arn:aws:lambda:us-west-2:123456789012:function:myFunction", 
    FunctionName: "myFunction", 
    Handler: "index.handler", 
    LastModified: "2016-11-21T19:49:20.006+0000", 
    MemorySize: 128, 
    Role: "arn:aws:iam::123456789012:role/lambda_basic_execution", 
    Runtime: "python2.7", 
    Timeout: 123, 
    Version: "1", 
    VpcConfig: {
    }
   }
   */
 });

Calling the updateFunctionConfiguration operation

var params = {
  FunctionName: 'STRING_VALUE', /* required */
  DeadLetterConfig: {
    TargetArn: 'STRING_VALUE'
  },
  Description: 'STRING_VALUE',
  Environment: {
    Variables: {
      '<EnvironmentVariableName>': 'STRING_VALUE',
      /* '<EnvironmentVariableName>': ... */
    }
  },
  Handler: 'STRING_VALUE',
  KMSKeyArn: 'STRING_VALUE',
  Layers: [
    'STRING_VALUE',
    /* more items */
  ],
  MemorySize: 0,
  RevisionId: 'STRING_VALUE',
  Role: 'STRING_VALUE',
  Runtime: nodejs | nodejs4.3 | nodejs6.10 | nodejs8.10 | java8 | python2.7 | python3.6 | python3.7 | dotnetcore1.0 | dotnetcore2.0 | dotnetcore2.1 | nodejs4.3-edge | go1.x | ruby2.5 | provided,
  Timeout: 0,
  TracingConfig: {
    Mode: Active | PassThrough
  },
  VpcConfig: {
    SecurityGroupIds: [
      'STRING_VALUE',
      /* more items */
    ],
    SubnetIds: [
      'STRING_VALUE',
      /* more items */
    ]
  }
};
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.

      Name formats

      • Function name - my-function.

      • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:my-function.

      • Partial ARN - 123456789012:function:my-function.

      The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

    • 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. AWS Lambda does not use this value. Assign a meaningful description as you see fit.

    • Timeout — (Integer)

      The amount of time that Lambda allows a function to run before terminating it. The default is 3 seconds. The maximum allowed value is 900 seconds.

    • MemorySize — (Integer)

      The amount of memory, in MB, your Lambda function is given. AWS 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.

    • VpcConfig — (map)

      Specify security groups and subnets in a VPC to which your Lambda function needs access.

      • SubnetIds — (Array<String>)

        A list of VPC subnet IDs.

      • SecurityGroupIds — (Array<String>)

        A list of VPC security groups IDs.

    • Environment — (map)

      The parent object that contains your environment's configuration settings.

      • Variables — (map<String>)

        Environment variable key-value pairs.

    • Runtime — (String)

      The runtime version for the function.

      Possible values include:
      • "nodejs"
      • "nodejs4.3"
      • "nodejs6.10"
      • "nodejs8.10"
      • "java8"
      • "python2.7"
      • "python3.6"
      • "python3.7"
      • "dotnetcore1.0"
      • "dotnetcore2.0"
      • "dotnetcore2.1"
      • "nodejs4.3-edge"
      • "go1.x"
      • "ruby2.5"
      • "provided"
    • DeadLetterConfig — (map)

      A dead letter queue configuration that specifies the queue or topic where Lambda sends asynchronous events when they fail processing. For more information, see Dead Letter Queues.

      • TargetArn — (String)

        The Amazon Resource Name (ARN) of an Amazon SQS queue or Amazon SNS topic.

    • KMSKeyArn — (String)

      The Amazon Resource Name (ARN) of the KMS key used to encrypt your function's environment variables. If you elect to use the AWS Lambda default service key, pass in an empty string ("") for this parameter.

    • TracingConfig — (map)

      Set Mode to Active to sample and trace a subset of incoming requests with AWS X-Ray.

      • Mode — (String)

        The tracing mode.

        Possible values include:
        • "Active"
        • "PassThrough"
    • RevisionId — (String)

      Only update the function if the revision ID matches the ID specified. Use this option to avoid modifying a function that has changed since you last read it.

    • Layers — (Array<String>)

      A list of function layers to add to the function's execution environment.

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 function's Amazon Resource Name (ARN).

      • Runtime — (String)

        The runtime environment for the Lambda function.

        Possible values include:
        • "nodejs"
        • "nodejs4.3"
        • "nodejs6.10"
        • "nodejs8.10"
        • "java8"
        • "python2.7"
        • "python3.6"
        • "python3.7"
        • "dotnetcore1.0"
        • "dotnetcore2.0"
        • "dotnetcore2.1"
        • "nodejs4.3-edge"
        • "go1.x"
        • "ruby2.5"
        • "provided"
      • Role — (String)

        The function's execution role.

      • Handler — (String)

        The function Lambda calls to begin executing your function.

      • CodeSize — (Integer)

        The size of the function's deployment package in bytes.

      • Description — (String)

        The function's description.

      • Timeout — (Integer)

        The amount of time that Lambda allows a function to run before terminating it.

      • MemorySize — (Integer)

        The memory allocated to the function

      • LastModified — (String)

        The date and time that the function was last updated, in ISO-8601 format (YYYY-MM-DDThh:mm:ss.sTZD).

      • CodeSha256 — (String)

        The SHA256 hash of the function's deployment package.

      • Version — (String)

        The version of the Lambda function.

      • VpcConfig — (map)

        The function's networking configuration.

        • SubnetIds — (Array<String>)

          A list of VPC subnet IDs.

        • SecurityGroupIds — (Array<String>)

          A list of VPC security groups IDs.

        • VpcId — (String)

          The ID of the VPC.

      • DeadLetterConfig — (map)

        The function's dead letter queue.

        • TargetArn — (String)

          The Amazon Resource Name (ARN) of an Amazon SQS queue or Amazon SNS topic.

      • Environment — (map)

        The function's environment variables.

        • Variables — (map<String>)

          Environment variable key-value pairs.

        • Error — (map)

          Error messages for environment variables that could not be applied.

          • ErrorCode — (String)

            The error code.

          • Message — (String)

            The error message.

      • KMSKeyArn — (String)

        The KMS key used to encrypt the function's environment variables. Only returned if you've configured a customer managed CMK.

      • TracingConfig — (map)

        The function's AWS X-Ray tracing configuration.

        • Mode — (String)

          The tracing mode.

          Possible values include:
          • "Active"
          • "PassThrough"
      • MasterArn — (String)

        For Lambda@Edge functions, the ARN of the master function.

      • RevisionId — (String)

        Represents the latest updated revision of the function or alias.

      • Layers — (Array<map>)

        The function's layers

        • Arn — (String)

          The Amazon Resource Name (ARN) of the function layer.

        • CodeSize — (Integer)

          The size of the layer archive in bytes.

Returns:

  • (AWS.Request)

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