4

我想从这个GitHub 存储库下载公共 arn 以获得更紧凑的 spacy 版本。

"arn:aws:lambda:us-west-2:113088814899:layer:Klayers-python37-spacy:27"

我怎样才能做到这一点?

4

1 回答 1

10

您可以使用CLI 中的get-layer-version-by-arn 函数从 Arn 获取它。

您可以运行以下命令来获取您请求的 Lambda 层的来源。

aws lambda get-layer-version-by-arn \
    --arn ""arn:aws:lambda:us-west-2:113088814899:layer:Klayers-python37-spacy:27"

您将收到的响应示例如下

{
    "LayerVersionArn": "arn:aws:lambda:us-west-2:123456789012:layer:AWSLambda-Python37-SciPy1x:2",
    "Description": "AWS Lambda SciPy layer for Python 3.7 (scipy-1.1.0, numpy-1.15.4) https://github.com/scipy/scipy/releases/tag/v1.1.0 https://github.com/numpy/numpy/releases/tag/v1.15.4",
    "CreatedDate": "2018-11-12T10:09:38.398+0000",
    "LayerArn": "arn:aws:lambda:us-west-2:123456789012:layer:AWSLambda-Python37-SciPy1x",
    "Content": {
        "CodeSize": 41784542,
        "CodeSha256": "GGmv8ocUw4cly0T8HL0Vx/f5V4RmSCGNjDIslY4VskM=",
        "Location": "https://awslambda-us-west-2-layers.s3.us-west-2.amazonaws.com/snapshots/123456789012/..."
    },
    "Version": 2,
    "CompatibleRuntimes": [
        "python3.7"
    ],
    "LicenseInfo": "SciPy: https://github.com/scipy/scipy/blob/master/LICENSE.txt, NumPy: https://github.com/numpy/numpy/blob/master/LICENSE.txt"
}

运行此命令后,您将收到一个返回键为 的响应"Content",其中包含一个子键,该子键"Location"引用 S3 路径以下载层内容。

您可以从此路径下载,然后需要在删除任何依赖项后再次将其配置为 Lambda 层。

于 2020-06-27T17:21:59.453 回答