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.

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

Add layers to your function with CreateFunction or UpdateFunctionConfiguration.

Note:

For .NET Core this operation is only available in asynchronous form. Please refer to PublishLayerVersionAsync.

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

Syntax

C#
public abstract PublishLayerVersionResponse PublishLayerVersion(
         PublishLayerVersionRequest request
)

Parameters

request
Type: Amazon.Lambda.Model.PublishLayerVersionRequest

Container for the necessary parameters to execute the PublishLayerVersion service method.

Return Value


The response from the PublishLayerVersion service method, as returned by Lambda.

Exceptions

ExceptionCondition
CodeStorageExceededException Your Amazon Web Services account has exceeded its maximum total code size. For more information, see Lambda quotas.
InvalidParameterValueException One of the parameters in the request is not valid.
ResourceNotFoundException The resource specified in the request does not exist.
ServiceException The Lambda service encountered an internal error.
TooManyRequestsException The request throughput limit was exceeded. For more information, see Lambda quotas.

Examples

The following example creates a new Python library layer version. The command retrieves the layer content a file named layer.zip in the specified S3 bucket.

To create a Lambda layer version


var response = client.PublishLayerVersion(new PublishLayerVersionRequest 
{
    CompatibleRuntimes = new List<string> {
        "python3.6",
        "python3.7"
    },
    Content = new LayerVersionContentInput {
        S3Bucket = "lambda-layers-us-west-2-123456789012",
        S3Key = "layer.zip"
    },
    Description = "My Python layer",
    LayerName = "my-layer",
    LicenseInfo = "MIT"
});

List<string> compatibleRuntimes = response.CompatibleRuntimes;
LayerVersionContentOutput content = response.Content;
string createdDate = response.CreatedDate;
string description = response.Description;
string layerArn = response.LayerArn;
string layerVersionArn = response.LayerVersionArn;
string licenseInfo = response.LicenseInfo;
long version = response.Version;

            

Version Information

.NET Framework:
Supported in: 4.5 and newer, 3.5

See Also