DaMaill
DaMaill

Reputation: 925

How to get the composition of a Lambda (AWS)

In AWS, is it possible to get the composition of a lambda ?

When the code is still small and in one file, the in-line editor gives it, but in the case the file is too large, or in the simple case there are more than one file, is there a way to know what is in the Lambda ?

Upvotes: 1

Views: 315

Answers (2)

DaMaill
DaMaill

Reputation: 925

The CLI answer works well. For those who use the AWS console there is also another way, in the lambda menu, with Actions > Export function.

Upvotes: 0

Dave Maple
Dave Maple

Reputation: 8412

If you run API_GetFunction it will return the presigned S3 location where you can download the actual artifact (.zip etc.). Then you could download and examine it.

CLI example:

aws lambda get-function --function-name yourFunctionName

Example response:

{
    "Code": {
        "RepositoryType": "S3",
        "Location": "https://prod-04-2014-tasks.s3.amazonaws.com/snapshots/59xxxxx/yourFunctionName..."
    },
    "Configuration": {
        "Version": "$LATEST",
        "CodeSha256": "kdDt+Nydl0mYgCqmXHgiTxaPbDRv5EjJ+gVH0kxxxxx",
        "FunctionName": "yourFunctionName",
        "VpcConfig": {
            "SubnetIds": [],
            "SecurityGroupIds": []
        },
        "MemorySize": 128,
        "CodeSize": 1060,
        "FunctionArn": "arn:aws:lambda:us-east-1:59xxxxx:function:yourFunctionName",
        "Handler": "index.handler",
        "Role": "arn:aws:iam::59xxxxxx:role/YourRoleName",
        "Timeout": 3,
        "LastModified": "2017-01-02T13:21:33.075+0000",
        "Runtime": "nodejs4.3",
        "Description": "Your Description"
    }
}

Here the "Code.Location" element contains the presigned url where you can download the artifact.

Upvotes: 1

Related Questions