How to use environment variables with a Lambda function? (and how to encrypt them with KMS)

  Рет қаралды 17,172

BiteSize Academy

BiteSize Academy

4 жыл бұрын

AWS Lambda: How to store a secret to an external API?
⚡️ Blog post and source code: www.undefinedapps.com/post/en...
In this video we take a look at how secrets, private keys and passwords should be stored in a lambda function. First, we extract hardcoded secrets into environment variables, then we learn how to encrypt these variables using a key from KMS (Key Management Service) and how to decrypt them in the lambda function.
⭐️ Subscribe for more content: newsletter.undefinedapps.com/
#lambda #kms #nodejs

Пікірлер: 30
@MiguelHernandez-dm5eu
@MiguelHernandez-dm5eu 3 жыл бұрын
Excellent video, Was not sure what environment variables with Lambda meant from text. I know now after watching this informative video. Thank you very much. Keep up the good work.
@EduardoBello7
@EduardoBello7 3 жыл бұрын
Awesome video, it helped me a lot. Good job my friend
@Gabhane123
@Gabhane123 4 жыл бұрын
Very helpful Video ! Keep it up !
@soulofangel1990
@soulofangel1990 3 жыл бұрын
I can't believe I just found your channel, I'm glad I did though!
@samitkapadia7414
@samitkapadia7414 3 жыл бұрын
Thanks this was great!
@kumarprmshvm565
@kumarprmshvm565 3 жыл бұрын
Awesome Explanation
@juanbg100
@juanbg100 2 жыл бұрын
thanks lot dude! super helpful video!
@rhinoreign1324
@rhinoreign1324 Жыл бұрын
Very helpful, thank you very much!
@danieljing9319
@danieljing9319 4 жыл бұрын
very useful content
@UdayShivamurthy
@UdayShivamurthy 3 жыл бұрын
Precious!!! thanks a lot
@kaushikdr
@kaushikdr 2 жыл бұрын
Thank you! You briefly mentioned that you could change the environment variables based on whether we are running testnet or mainnet. Do we need to create separate lambda functions?
@bugsbunny3354
@bugsbunny3354 Жыл бұрын
Thank you I need this video thanks a lot ❤
@kickerbm0821
@kickerbm0821 3 жыл бұрын
Good work. One question: If someone has access to this lambda function, he still can get the secret values by modifying the decrypt function and running the test. How to avoid that then?
@rakibulhasanofficial5057
@rakibulhasanofficial5057 Жыл бұрын
many many thanks
@lakshmikanthreddy2402
@lakshmikanthreddy2402 4 жыл бұрын
Very useful! Can you try to implement same in python as well.
@_auliayayan5887
@_auliayayan5887 2 жыл бұрын
That is a great tutorial with a clear explanation. Btw, I had a question about lambda services, and really appreciate it if you can address it, " The Question that I want to encrypt my Script / Code that I posted on top of Lambda as function, so not everyone can see access and copy the script . is it possible? if yes, how can I do that?? Thanks in advance
@firojsiddiki2750
@firojsiddiki2750 3 жыл бұрын
Can you please clarify me, if a hacker got access to the console, why would he bother to reading the encrypted string when he simply can just feed this encrypted strings(or secretName) to your github decryptSecret function to get the plain secrets.
@franciscageorgue2207
@franciscageorgue2207 2 жыл бұрын
Thank you for the clear explanation! a doubt, you mentioned that secrets saved in cache, this means that if the lambda is executed multiple times, the cost of kms will not exceed the free trial?
@sichoi6297
@sichoi6297 2 жыл бұрын
how can i set the environment variables that many functions use the same(commonly used)?
@ajayjayswal5335
@ajayjayswal5335 4 жыл бұрын
Hello sir nice tutorial . i need this requirement. but any code for decrypt function in JAVA
@georgelza
@georgelza Жыл бұрын
any chance you have a python example of this video ?
@utilisemedia
@utilisemedia 3 жыл бұрын
Thanks for the great vid. Do you have a Python example?
@BiteSizeAcademy
@BiteSizeAcademy 3 жыл бұрын
There are some Python examples for env variables in the aws docs: docs.aws.amazon.com/lambda/latest/dg/configuration-envvars.html I don't know Python but the api should be similar.
@utilisemedia
@utilisemedia 3 жыл бұрын
@@BiteSizeAcademy thanks but not like you’re fancy pants utils file 😉
@SreenathV
@SreenathV 4 жыл бұрын
Can we decrypt multiple keys in one API call?
@bpate1138
@bpate1138 Жыл бұрын
Is there a similar code in python?
@shivanishivu1692
@shivanishivu1692 3 жыл бұрын
I followed the whole process as explained in the video but still getting this error while decrypting >>> "errorType": "InvalidCiphertextException",
@parthasarathymurali3942
@parthasarathymurali3942 3 жыл бұрын
Add the EncryptionContext as your lambda function name as below: const req = { CiphertextBlob: Buffer.from(process.env[secretName], 'base64'), EncryptionContext: { LambdaFunctionName: "your lambda function name" }, };
@RicardoBoriba
@RicardoBoriba 3 жыл бұрын
@@parthasarathymurali3942 Thanks!!! Allmost 2h trying to solve this error..
@javascript_developer
@javascript_developer Жыл бұрын
KMS has min charge for 12$ a year for 1 single key. Why it is so expensive to store a key in KMS.
How to use layers with Lambda functions?
8:54
BiteSize Academy
Рет қаралды 40 М.
ПРОВЕРИЛ АРБУЗЫ #shorts
00:34
Паша Осадчий
Рет қаралды 7 МЛН
Comfortable 🤣 #comedy #funny
00:34
Micky Makeover
Рет қаралды 10 МЛН
НЫСАНА КОНЦЕРТ 2024
2:26:34
Нысана театры
Рет қаралды 1,6 МЛН
Smart Sigma Kid #funny #sigma #memes
00:26
CRAZY GREAPA
Рет қаралды 8 МЛН
Encrypt and Decrypt AWS Lambda Function Environment Variables using AWS KMS
23:54
AWS Secrets Manager Lambda Example Tutorial
8:32
Worn Off Keys
Рет қаралды 20 М.
How to use ImageMagick with a Lambda function on AWS?
11:15
BiteSize Academy
Рет қаралды 9 М.
How to use AWS parameter store with serverless
14:49
Krish Dinesh
Рет қаралды 2,8 М.
AWS API Gateway to Lambda Tutorial in Python | Build a REST API
11:17
Be A Better Dev
Рет қаралды 337 М.
How to test and develop AWS lambda functions locally with nodejs?
29:36
BiteSize Academy
Рет қаралды 16 М.
Опасность фирменной зарядки Apple
0:57
SuperCrastan
Рет қаралды 12 МЛН
Ba Travel Smart Phone Charger
0:42
Tech Official
Рет қаралды 1,2 МЛН
разбил телефон из-за видео
0:15
STANISLAVSKIY Hi
Рет қаралды 727 М.
$1 vs $100,000 Slow Motion Camera!
0:44
Hafu Go
Рет қаралды 29 МЛН