AWS SDK Version 3 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.

Container for the parameters to the UpdateFunctionCode operation. 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.

Inheritance Hierarchy

System.Object
  Amazon.Runtime.AmazonWebServiceRequest
    Amazon.Lambda.AmazonLambdaRequest
      Amazon.Lambda.Model.UpdateFunctionCodeRequest

Namespace: Amazon.Lambda.Model
Assembly: AWSSDK.Lambda.dll
Version: 3.x.y.z

Syntax

C#
public class UpdateFunctionCodeRequest : AmazonLambdaRequest
         IAmazonWebServiceRequest

The UpdateFunctionCodeRequest type exposes the following members

Constructors

NameDescription
Public Method UpdateFunctionCodeRequest()

Properties

NameTypeDescription
Public Property DryRun System.Boolean

Gets and sets the property DryRun.

This boolean parameter can be used to test your request to AWS Lambda to update the Lambda function and publish a version as an atomic operation. It will do all necessary computation and validation of your code but will not upload it or a publish a version. Each time this operation is invoked, the CodeSha256 hash value the provided code will also be computed and returned in the response.

Public Property FunctionName System.String

Gets and sets the property FunctionName.

The existing Lambda function name whose code you want to replace.

You can specify a function name (for example, Thumbnail) or you can specify Amazon Resource Name (ARN) of the function (for example, arn:aws:lambda:us-west-2:account-id:function:ThumbNail). AWS Lambda also allows you to specify a partial ARN (for example, account-id:Thumbnail). Note that the length constraint applies only to the ARN. If you specify only the function name, it is limited to 64 characters in length.

Public Property Publish System.Boolean

Gets and sets the property Publish.

This boolean parameter can be used to request AWS Lambda to update the Lambda function and publish a version as an atomic operation.

Public Property S3Bucket System.String

Gets and sets the property S3Bucket.

Amazon S3 bucket name where the .zip file containing your deployment package is stored. This bucket must reside in the same AWS Region where you are creating the Lambda function.

Public Property S3Key System.String

Gets and sets the property S3Key.

The Amazon S3 object (the deployment package) key name you want to upload.

Public Property S3ObjectVersion System.String

Gets and sets the property S3ObjectVersion.

The Amazon S3 object (the deployment package) version you want to upload.

Public Property ZipFile System.IO.MemoryStream

Gets and sets the property ZipFile.

The contents of your zip file containing your deployment package. If you are using the web API directly, the contents of the zip file must be base64-encoded. If you are using the AWS SDKs or the AWS CLI, the SDKs or CLI will do the encoding for you. For more information about creating a .zip file, see Execution Permissions in the AWS Lambda Developer Guide.

Examples

This operation updates a Lambda function's code

To update a Lambda function's code


var response = client.UpdateFunctionCode(new UpdateFunctionCodeRequest 
{
    FunctionName = "myFunction",
    Publish = true,
    S3Bucket = "myBucket",
    S3Key = "myKey",
    S3ObjectVersion = "1",
    ZipFile = new MemoryStream(fileb://file-path/file.zip)
});

string codeSha256 = response.CodeSha256;
long codeSize = response.CodeSize;
string description = response.Description;
string functionArn = response.FunctionArn;
string functionName = response.FunctionName;
string handler = response.Handler;
string lastModified = response.LastModified;
integer memorySize = response.MemorySize;
string role = response.Role;
string runtime = response.Runtime;
integer timeout = response.Timeout;
string version = response.Version;
VpcConfigDetail vpcConfig = response.VpcConfig;

            

Version Information

.NET Standard:
Supported in: 1.3

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

Portable Class Library:
Supported in: Windows Store Apps
Supported in: Windows Phone 8.1
Supported in: Xamarin Android
Supported in: Xamarin iOS (Unified)
Supported in: Xamarin.Forms

Unity:
Supported Versions: 4.6 and above
Supported Platforms: Android, iOS, Standalone