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?

asked a year ago324 views
2 Answers
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.

answered a year ago
  • 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
EXPERT
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions