AWS SDK Version 2 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

.NET Framework 4.5
 
Implementation for accessing Lambda AWS Lambda

Overview

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

Inheritance Hierarchy

System.Object
  Amazon.Runtime.AmazonServiceClient
    Amazon.Lambda.AmazonLambdaClient

Namespace: Amazon.Lambda
Assembly: AWSSDK.dll
Version: (assembly version)

Syntax

C#
public class AmazonLambdaClient : AmazonServiceClient
         IAmazonLambda, IDisposable

The AmazonLambdaClient type exposes the following members

Constructors

NameDescription
Public Method AmazonLambdaClient() Constructs AmazonLambdaClient with the credentials loaded from the application's default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance. Example App.config with credentials set.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <appSettings>
        <add key="AWSProfileName" value="AWS Default"/>
    </appSettings>
</configuration>
             
Public Method AmazonLambdaClient(RegionEndpoint) Constructs AmazonLambdaClient with the credentials loaded from the application's default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance. Example App.config with credentials set.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <appSettings>
        <add key="AWSProfileName" value="AWS Default"/>
    </appSettings>
</configuration>
             
Public Method AmazonLambdaClient(AmazonLambdaConfig) Constructs AmazonLambdaClient with the credentials loaded from the application's default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance. Example App.config with credentials set.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <appSettings>
        <add key="AWSProfileName" value="AWS Default"/>
    </appSettings>
</configuration>
             
Public Method AmazonLambdaClient(AWSCredentials) Constructs AmazonLambdaClient with AWS Credentials
Public Method AmazonLambdaClient(AWSCredentials, RegionEndpoint) Constructs AmazonLambdaClient with AWS Credentials
Public Method AmazonLambdaClient(AWSCredentials, AmazonLambdaConfig) Constructs AmazonLambdaClient with AWS Credentials and an AmazonLambdaClient Configuration object.
Public Method AmazonLambdaClient(string, string) Constructs AmazonLambdaClient with AWS Access Key ID and AWS Secret Key
Public Method AmazonLambdaClient(string, string, RegionEndpoint) Constructs AmazonLambdaClient with AWS Access Key ID and AWS Secret Key
Public Method AmazonLambdaClient(string, string, AmazonLambdaConfig) Constructs AmazonLambdaClient with AWS Access Key ID, AWS Secret Key and an AmazonLambdaClient Configuration object.
Public Method AmazonLambdaClient(string, string, string) Constructs AmazonLambdaClient with AWS Access Key ID and AWS Secret Key
Public Method AmazonLambdaClient(string, string, string, RegionEndpoint) Constructs AmazonLambdaClient with AWS Access Key ID and AWS Secret Key
Public Method AmazonLambdaClient(string, string, string, AmazonLambdaConfig) Constructs AmazonLambdaClient with AWS Access Key ID, AWS Secret Key and an AmazonLambdaClient Configuration object.

Methods

NameDescription
Public Method AddPermission(AddPermissionRequest) Adds a permission to the resource policy associated with the specified AWS Lambda function. You use resource policies to grant permissions to event sources that use push model. In a push model, event sources (such as Amazon S3 and custom applications) invoke your Lambda function. Each permission you add to the resource policy allows an event source, permission to invoke the Lambda function.

For information about the push model, see AWS Lambda: How it Works.

If you are using versioning, the permissions you add are specific to the Lambda function version or alias you specify in the AddPermission request via the Qualifier parameter. For more information about versioning, see AWS Lambda Function Versioning and Aliases.

This operation requires permission for the lambda:AddPermission action.

Public Method AddPermissionAsync(AddPermissionRequest, CancellationToken) Initiates the asynchronous execution of the AddPermission operation.
Public Method CreateAlias(CreateAliasRequest) Creates an alias that points to the specified Lambda function version. For more information, see Introduction to AWS Lambda Aliases. Alias names are unique for a given function.

This requires permission for the lambda:CreateAlias action.

Public Method CreateAliasAsync(CreateAliasRequest, CancellationToken) Initiates the asynchronous execution of the CreateAlias operation.
Public Method CreateEventSourceMapping(CreateEventSourceMappingRequest) Identifies a stream as an event source for a Lambda function. It can be either an Amazon Kinesis stream or an Amazon DynamoDB stream. AWS Lambda invokes the specified function when records are posted to the stream.

This association between a stream source and a Lambda function is called the event source mapping.

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

You provide mapping information (for example, which stream to read from and which Lambda function to invoke) in the request body.

Each event source, such as an Amazon Kinesis or a DynamoDB stream, can be associated with multiple AWS Lambda function. A given Lambda function can be associated with multiple AWS event sources.

If you are using versioning, you can specify a specific function version or an alias via the function name parameter. For more information about versioning, see AWS Lambda Function Versioning and Aliases.

This operation requires permission for the lambda:CreateEventSourceMapping action.

Public Method CreateEventSourceMappingAsync(CreateEventSourceMappingRequest, CancellationToken) Initiates the asynchronous execution of the CreateEventSourceMapping operation.
Public Method CreateFunction(CreateFunctionRequest) Creates a new Lambda function. The function metadata is created from the request parameters, and the code for the function is provided by a .zip file in the request body. If the function name already exists, the operation will fail. Note that the function name is case-sensitive.

If you are using versioning, you can also publish a version of the Lambda function you are creating using the Publish parameter. For more information about versioning, see AWS Lambda Function Versioning and Aliases.

This operation requires permission for the lambda:CreateFunction action.

Public Method CreateFunctionAsync(CreateFunctionRequest, CancellationToken) Initiates the asynchronous execution of the CreateFunction operation.
Public Method DeleteAlias(DeleteAliasRequest) Deletes the specified Lambda function alias. For more information, see Introduction to AWS Lambda Aliases.

This requires permission for the lambda:DeleteAlias action.

Public Method DeleteAliasAsync(DeleteAliasRequest, CancellationToken) Initiates the asynchronous execution of the DeleteAlias operation.
Public Method DeleteEventSourceMapping(DeleteEventSourceMappingRequest) Removes an event source mapping. This means AWS Lambda will no longer invoke the function for events in the associated source.

This operation requires permission for the lambda:DeleteEventSourceMapping action.

Public Method DeleteEventSourceMappingAsync(DeleteEventSourceMappingRequest, CancellationToken) Initiates the asynchronous execution of the DeleteEventSourceMapping operation.
Public Method DeleteFunction(string) Deletes the specified Lambda function code and configuration.

If you are using the versioning feature and you don't specify a function version in your DeleteFunction request, AWS Lambda will delete the function, including all its versions, and any aliases pointing to the function versions. To delete a specific function version, you must provide the function version via the Qualifier parameter. For information about function versioning, see AWS Lambda Function Versioning and Aliases.

When you delete a function the associated resource policy is also deleted. You will need to delete the event source mappings explicitly.

This operation requires permission for the lambda:DeleteFunction action.

Public Method DeleteFunction(DeleteFunctionRequest) Deletes the specified Lambda function code and configuration.

If you are using the versioning feature and you don't specify a function version in your DeleteFunction request, AWS Lambda will delete the function, including all its versions, and any aliases pointing to the function versions. To delete a specific function version, you must provide the function version via the Qualifier parameter. For information about function versioning, see AWS Lambda Function Versioning and Aliases.

When you delete a function the associated resource policy is also deleted. You will need to delete the event source mappings explicitly.

This operation requires permission for the lambda:DeleteFunction action.

Public Method DeleteFunctionAsync(DeleteFunctionRequest, CancellationToken) Initiates the asynchronous execution of the DeleteFunction operation.
Public Method Dispose() Inherited from Amazon.Runtime.AmazonServiceClient.
Public Method GetAlias(GetAliasRequest) Returns the specified alias information such as the alias ARN, description, and function version it is pointing to. For more information, see Introduction to AWS Lambda Aliases.

This requires permission for the lambda:GetAlias action.

Public Method GetAliasAsync(GetAliasRequest, CancellationToken) Initiates the asynchronous execution of the GetAlias operation.
Public Method GetEventSourceMapping(GetEventSourceMappingRequest) Returns configuration information for the specified event source mapping (see CreateEventSourceMapping).

This operation requires permission for the lambda:GetEventSourceMapping action.

Public Method GetEventSourceMappingAsync(GetEventSourceMappingRequest, CancellationToken) Initiates the asynchronous execution of the GetEventSourceMapping operation.
Public Method GetFunction(string) Returns the configuration information of the Lambda function and a presigned URL link to the .zip file you uploaded with CreateFunction so you can download the .zip file. Note that the URL is valid for up to 10 minutes. The configuration information is the same information you provided as parameters when uploading the function.

Using the optional Qualifier parameter, you can specify a specific function version for which you want this information. If you don't specify this parameter, the API uses unqualified function ARN which return information about the $LATEST version of the Lambda function. For more information, see AWS Lambda Function Versioning and Aliases.

This operation requires permission for the lambda:GetFunction action.

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

Using the optional Qualifier parameter, you can specify a specific function version for which you want this information. If you don't specify this parameter, the API uses unqualified function ARN which return information about the $LATEST version of the Lambda function. For more information, see AWS Lambda Function Versioning and Aliases.

This operation requires permission for the lambda:GetFunction action.

Public Method GetFunctionAsync(GetFunctionRequest, CancellationToken) Initiates the asynchronous execution of the GetFunction operation.
Public Method GetFunctionConfiguration(string) Returns the configuration information of the Lambda function. This the same information you provided as parameters when uploading the function by using CreateFunction.

If you are using the versioning feature, you can retrieve this information for a specific function version by using the optional Qualifier parameter and specifying the function version or alias that points to it. If you don't provide it, the API returns information about the $LATEST version of the function. For more information about versioning, see AWS Lambda Function Versioning and Aliases.

This operation requires permission for the lambda:GetFunctionConfiguration operation.

Public Method GetFunctionConfiguration(GetFunctionConfigurationRequest) Returns the configuration information of the Lambda function. This the same information you provided as parameters when uploading the function by using CreateFunction.

If you are using the versioning feature, you can retrieve this information for a specific function version by using the optional Qualifier parameter and specifying the function version or alias that points to it. If you don't provide it, the API returns information about the $LATEST version of the function. For more information about versioning, see AWS Lambda Function Versioning and Aliases.

This operation requires permission for the lambda:GetFunctionConfiguration operation.

Public Method GetFunctionConfigurationAsync(GetFunctionConfigurationRequest, CancellationToken) Initiates the asynchronous execution of the GetFunctionConfiguration operation.
Public Method GetPolicy(GetPolicyRequest) Returns the resource policy associated with the specified Lambda function.

If you are using the versioning feature, you can get the resource policy associated with the specific Lambda function version or alias by specifying the version or alias name using the Qualifier parameter. For more information about versioning, see AWS Lambda Function Versioning and Aliases.

For information about adding permissions, see AddPermission.

You need permission for the lambda:GetPolicy action.

Public Method GetPolicyAsync(GetPolicyRequest, CancellationToken) Initiates the asynchronous execution of the GetPolicy operation.
Public Method Invoke(InvokeRequest) Invokes a specific Lambda function.

If you are using the versioning feature, you can invoke the specific function version by providing function version or alias name that is pointing to the function version using the Qualifier parameter in the request. If you don't provide the Qualifier parameter, the $LATEST version of the Lambda function is invoked. For information about the versioning feature, see AWS Lambda Function Versioning and Aliases.

This operation requires permission for the lambda:InvokeFunction action.

Public Method InvokeAsync(InvokeRequest, CancellationToken) Initiates the asynchronous execution of the Invoke operation.
Public Method InvokeAsync(InvokeAsyncRequest) This API is deprecated. We recommend you use Invoke API (see Invoke).

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

This operation requires permission for the lambda:InvokeFunction action.

Public Method InvokeAsync(string) Submits an invocation request to Lambda. Upon receiving the request, Lambda executes the specified cloud function asynchronously. To see the logs generated by the cloud function execution, see the CloudWatch logs console.

This operation requires permission for the lambda:InvokeAsync action.

The InvokeArgs will be set to an empty json document.

Public Method InvokeAsync(string, string) Submits an invocation request to Lambda. Upon receiving the request, Lambda executes the specified cloud function asynchronously. To see the logs generated by the cloud function execution, see the CloudWatch logs console.

This operation requires permission for the lambda:InvokeAsync action.

Public Method InvokeAsyncAsync(InvokeAsyncRequest, CancellationToken) Initiates the asynchronous execution of the InvokeAsync operation.
Public Method ListAliases(ListAliasesRequest) Returns list of aliases created for a Lambda function. For each alias, the response includes information such as the alias ARN, description, alias name, and the function version to which it points. For more information, see Introduction to AWS Lambda Aliases.

This requires permission for the lambda:ListAliases action.

Public Method ListAliasesAsync(ListAliasesRequest, CancellationToken) Initiates the asynchronous execution of the ListAliases operation.
Public Method ListEventSourceMappings(ListEventSourceMappingsRequest) Returns a list of event source mappings you created using the CreateEventSourceMapping (see CreateEventSourceMapping).

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

If you are using the versioning feature, you can get list of event source mappings for a specific Lambda function version or an alias as described in the FunctionName parameter. For information about the versioning feature, see AWS Lambda Function Versioning and Aliases.

This operation requires permission for the lambda:ListEventSourceMappings action.

Public Method ListEventSourceMappingsAsync(ListEventSourceMappingsRequest, CancellationToken) Initiates the asynchronous execution of the ListEventSourceMappings operation.
Public Method ListFunctions() Returns a list of your Lambda functions. For each function, the response includes the function configuration information. You must use GetFunction to retrieve the code for your function.

This operation requires permission for the lambda:ListFunctions action.

If you are using versioning feature, the response returns list of $LATEST versions of your functions. For information about the versioning feature, see AWS Lambda Function Versioning and Aliases.

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

This operation requires permission for the lambda:ListFunctions action.

If you are using versioning feature, the response returns list of $LATEST versions of your functions. For information about the versioning feature, see AWS Lambda Function Versioning and Aliases.

Public Method ListFunctionsAsync(ListFunctionsRequest, CancellationToken) Initiates the asynchronous execution of the ListFunctions operation.
Public Method ListVersionsByFunction(ListVersionsByFunctionRequest) List all versions of a function. For information about the versioning feature, see AWS Lambda Function Versioning and Aliases.
Public Method ListVersionsByFunctionAsync(ListVersionsByFunctionRequest, CancellationToken) Initiates the asynchronous execution of the ListVersionsByFunction operation.
Public Method PublishVersion(PublishVersionRequest) Publishes a version of your function from the current snapshot of $LATEST. That is, AWS Lambda takes a snapshot of the function code and configuration information from $LATEST and publishes a new version. The code and configuration cannot be modified after publication. For information about the versioning feature, see AWS Lambda Function Versioning and Aliases.
Public Method PublishVersionAsync(PublishVersionRequest, CancellationToken) Initiates the asynchronous execution of the PublishVersion operation.
Public Method RemovePermission(RemovePermissionRequest) You can remove individual permissions from an resource policy associated with a Lambda function by providing a statement ID that you provided when you added the permission.

If you are using versioning, the permissions you remove are specific to the Lambda function version or alias you specify in the AddPermission request via the Qualifier parameter. For more information about versioning, see AWS Lambda Function Versioning and Aliases.

Note that removal of a permission will cause an active event source to lose permission to the function.

You need permission for the lambda:RemovePermission action.

Public Method RemovePermissionAsync(RemovePermissionRequest, CancellationToken) Initiates the asynchronous execution of the RemovePermission operation.
Public Method UpdateAlias(UpdateAliasRequest) Using this API you can update the function version to which the alias points and the alias description. For more information, see Introduction to AWS Lambda Aliases.

This requires permission for the lambda:UpdateAlias action.

Public Method UpdateAliasAsync(UpdateAliasRequest, CancellationToken) Initiates the asynchronous execution of the UpdateAlias operation.
Public Method UpdateEventSourceMapping(UpdateEventSourceMappingRequest) You can update an event source mapping. This is useful if you want to change the parameters of the existing mapping without losing your position in the stream. You can change which function will receive the stream records, but to change the stream itself, you must create a new mapping.

If you are using the versioning feature, you can update the event source mapping to map to a specific Lambda function version or alias as described in the FunctionName parameter. For information about the versioning feature, see AWS Lambda Function Versioning and Aliases.

If you disable the event source mapping, AWS Lambda stops polling. If you enable again, it will resume polling from the time it had stopped polling, so you don't lose processing of any records. However, if you delete event source mapping and create it again, it will reset.

This operation requires permission for the lambda:UpdateEventSourceMapping action.

Public Method UpdateEventSourceMappingAsync(UpdateEventSourceMappingRequest, CancellationToken) Initiates the asynchronous execution of the UpdateEventSourceMapping operation.
Public Method UpdateFunctionCode(UpdateFunctionCodeRequest) Updates the code for the specified Lambda function. This operation must only be used on an existing Lambda function and cannot be used to update the function configuration.

If you are using the versioning feature, note this API will always update the $LATEST version of your Lambda function. For information about the versioning feature, see AWS Lambda Function Versioning and Aliases.

This operation requires permission for the lambda:UpdateFunctionCode action.

Public Method UpdateFunctionCodeAsync(UpdateFunctionCodeRequest, CancellationToken) Initiates the asynchronous execution of the UpdateFunctionCode operation.
Public Method UpdateFunctionConfiguration(UpdateFunctionConfigurationRequest) Updates the configuration parameters for the specified Lambda function by using the values provided in the request. You provide only the parameters you want to change. This operation must only be used on an existing Lambda function and cannot be used to update the function's code.

If you are using the versioning feature, note this API will always update the $LATEST version of your Lambda function. For information about the versioning feature, see AWS Lambda Function Versioning and Aliases.

This operation requires permission for the lambda:UpdateFunctionConfiguration action.

Public Method UpdateFunctionConfigurationAsync(UpdateFunctionConfigurationRequest, CancellationToken) Initiates the asynchronous execution of the UpdateFunctionConfiguration operation.

Events

NameDescription
Event AfterResponseEvent Inherited from Amazon.Runtime.AmazonServiceClient.
Event BeforeRequestEvent Inherited from Amazon.Runtime.AmazonServiceClient.
Event ExceptionEvent Inherited from Amazon.Runtime.AmazonServiceClient.

Version Information

.NET Framework:
Supported in: 4.5, 4.0, 3.5

.NET for Windows Store apps:
Supported in: Windows 8.1, Windows 8

.NET for Windows Phone:
Supported in: Windows Phone 8.1, Windows Phone 8