publishLayerVersion
abstract suspend fun publishLayerVersion(input: PublishLayerVersionRequest): PublishLayerVersionResponse
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.
Samples
import aws.sdk.kotlin.services.lambda.model.LayerVersionContentInput
import aws.sdk.kotlin.services.lambda.model.Runtime
fun main() {
//sampleStart
// 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.
val resp = lambdaClient.publishLayerVersion {
layerName = "my-layer"
description = "My Python layer"
content = LayerVersionContentInput {
s3Bucket = "lambda-layers-us-west-2-123456789012"
s3Key = "layer.zip"
}
compatibleRuntimes = listOf<Runtime>(
Runtime.fromValue("python3.6"),
Runtime.fromValue("python3.7")
)
licenseInfo = "MIT"
}
//sampleEnd
}