How to hide code in AWS Lambda function?

0

I have created AWS Lambda functions using CI/CD through GitHub+CodePipeline+CloudFormation but my code is visible in AWS Lambda console but I want to hide it. Because I don't want anyone to make changes in my function and that's the reason for which I have implemented it by CI/CD. I want my code to show in this way like Enter image description here

3개 답변
4

Hello.

This is not recommended because the size of the Lambda function must be at least 3 MB to display the same as the image.
https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-limits.html

Therefore, I think it is a good idea to control Lambda functions using IAM policies so that IAM users cannot update them.
I think it would be better to control the IAM user policy to deny "UpdateFunctionCode".
https://docs.aws.amazon.com/service-authorization/latest/reference/list_awslambda.html

profile picture
전문가
답변함 5달 전
profile picture
전문가
검토됨 5달 전
  • My lambda size is greater than 3 MB (5.65MB) but it's visible.

0

You could make most of your code not directly visible in the console by abstracting it into a Lambda Layer, which also help you with code reuse by allowing you share code/libraries between lambda functions

However this is really just security through obscurity, so you would still need to implement an IAM policy to limit access.

AWS
답변함 5달 전
profile picture
전문가
검토됨 5달 전
profile picture
전문가
검토됨 5달 전
0

There is a way to hide environment variables for lambdas: https://repost.aws/knowledge-center/lambda-environment-variables-iam-access

But to hide lambda code you will you probably need to place them in separate account and manage access to it.

Another mechanism is to provide an SCP which doesn’t hide the code but does not allow a user to update the code. A good video here: https://youtu.be/FqGzuh7jCAo?feature=shared

profile picture
전문가
답변함 5달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠