Lambda function -- lambda layer

0

Hello,

I have created a lambda function which is connected to a lambda layer that stores some packages. I have created a hosting environment connected to the github repository where the frontend of my application is. The issue is that whenever I push something to github and the hosting environment redeploys, it creates a new version for the lambda layer automatically and uses that, which breaks the application. After each push on github I have to manually go to the lambda function and switch back to my version of the lambda layer.

How can I prevent it from automatically updating the layer?

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

Hey, thanks for the answer. I don't think I'm using Github Actions. What I did is open the app from the Amazon Amplify page ( https://eu-west-3.console.aws.amazon.com/amplify/home) > Hosting Environments > Connect Branch, and there I connected my github repository. I didn't make any specific changes myself and the backend files are not even in that github branch; that branch only contains the front-end of the application.

已回答 1 年前
  • Ok. Understood. Then forget my proposal. Sorry for not being able to help further.

0

Hi, if I understand correctly, you are using Github Actions on Github to build your code each time you commit something new.

If this is correct, what you can do is to create a hook that takes different actions depending on the path of committed file.

For example, use this one: https://github.com/dorny/paths-filter

If you want to do it all by yourself, read https://www.techielass.com/trigger-a-github-action-workflow-when-a-folder-changes/ section "GitHub Actions triggers" will explain how to distinguish paths of updated file,

Then, you can

  1. launch and build the lambda if one of its files get modified
  2. build lambda layer and push it only if one of its files get modified. In that case, you may also want to build and push the lambda.

I hope that my initial guess about GitHub Actions was correct (you did not give details). Otherwise you can forget the above... ;-)

Didier

profile pictureAWS
专家
已回答 1 年前

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

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

回答问题的准则