Issue creating Lambda function layer versions in parallel process

0

Hi

We are using Terraform (v0.13.5 with AWS provider "hashicorp/aws v3.38.0") to deploy AWS resources into our accounts. Some of these resources are Lambda functions with Lambda layers.

We make use of certain automated processes (Gitlab pipelines) to run those deployments. We can change several Lambda functions at the same time.

We use the same Lambda layer for ALL the Lambda functions, but create different versions of that layer with different code (ZIP files) and attach each version to a concrete Lambda function.

Lately we realized that when modifying several Lambda functions at the same time, the code in the different versions of the same layer is mixed!!! So the code that should go for a concrete layer version is also appearing in other versions created at the same time.

For example:

  • when we modify several Lambda functions at the same time (let's say L001 and L002), two new versions of layer MYLAY are created for each, and the corresponding version is linked to each of the modified Lambda functions. So we have L001 with MYLAY-001 and L002 with MYLAY-002. This is how we expect it, so fine so far
  • Each version of the layer should have its own code (different ZIP files)
  • We have detected that the code for MYLAY-001 is also appearing in MYLAY-002, even though the ZIP files used to create those versions are different!!!

So from my point of view, it seems that the way in which AWS is creating the layer versions for the same layer is not compatible with parallel creation.

Can anyone confirm of shed some light on how AWS is creating those versions?

I guess the best approach considering the previous is to use different layer for each Lambda function, indeed.

Thanks in advance and best regards Luis

已提问 2 年前741 查看次数
1 回答
0

That is odd behaviour. I'd strongly encourage you to raise a support ticket to investigate that particular issue.

Otherwise: I don't think your strategy of using Lambda Layers is quite right. Yes, it might work but storing different data in each Layer is probably a bad pattern to use. My guess is that you're doing it so that the Lambda function doesn't have to load anything externally at startup but it still seems a little wrong.

Please reach out to your local AWS Solutions Architect to talk about your requirements and the best way to achieve that. Or: Ask a question here on re:Post with what you're trying to achieve.

profile pictureAWS
专家
已回答 2 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则