Skip to content

Dynamically load AWS lambda code from an open source repository

0

I want to create a lambda function which always download the code from open source repository and execute that code whenever it is invoked. This lambda function might be resided in many AWS accounts which only the respective root users have access to it.

Hence, any changes in the repository should reflect in the lambda function. How to do this?

  • please accept the answer if it was useful

2 Answers
2

Why would you want to do that? By doing that you are exposing yourself to different security issues, as well as exploiting your account to run malicious code. Also, downloading the code dynamically will add to the function's cold start and latency.

Why not create a new function every time there is a code in the repo (using CI/CD pipelines)? This way you can include different scanning and testing tools as part of the build process.

AWS
EXPERT
answered 2 years ago
  • I want to make it in a decentralized way so that if some new user wants to test our code which is changing time to time. This code needs the input as some sensitive information of user. They just need to do some initial setup and run the lambda function in their respective AWS accounts. Even though organization is built, the root user is only responsible for paying the bill. They shouldn't have any other control over the other accounts.

  • If this is what you need, create a Lambda function that the code loads the custom code dynamically (in can do it into /tmp) and then calls the entry point. Implementation will be language dependant.

0
EXPERT
answered 2 years 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.