I want to deploy AWS lambda written in NODEJS. And I have sensitive variables that can't be disclosed in AWS lambda variables section. Is there a way to deploy lambda with an encrypted variable which no one can see and can't be decrypted from the machine which was used to deploy the lambda. Only some other user who has the key should be able to decrypt the variable.
As far as I'm aware. There is no way to encrypt the environment variable value in the variables section of the lambda function. And to be fair, even if there was, it wouldn't provide any benefit in terms of keeping the variable secret. If the variable could be hidden/encrypted in the variables sections to be decrypted later, a user could simply execute the lambda function and print the results of the decrypted variable to stdout.
One approach could be to use aws secrets manager to store and retrieve your secrets. You can then assign your lambda function a role to allow access to the secret store, and use AWS SDK to retrieve your value.