Тёмный

Managing dependencies using AWS Lambda Layers with NodeJS and AWS SAM 

FooBar Serverless
Подписаться 37 тыс.
Просмотров 14 тыс.
50% 1

In this video, we will talk about AWS Lambda layers. What those are? How they help you out? And how to get started using them with your Nodejs Lambda functions and AWS SAM.
You will see 2 demos, one adding a third party dependency and another one creating your own library to share code between your functions.
Code: github.com/mav...
Specific names for the layer folders: docs.aws.amazo...
#foobar #serverless
⭐ SUBSCRIBE TO THIS CHANNEL: bit.ly/foobar-y...
⭐SHARE THIS VIDEO: • Managing dependencies ...
☆☆ FOLLOW ME ONLINE ☆☆
🐦 Twitter: / mavi888uy
📺 AWS Spanish RU-vid Channel: bit.ly/aws-esp-yt
📷 Instagram: foobar_codes
📚 All my Serverless Courses: marcia.dev/cou...
✍️ My blog - blog.marcia.dev
☆☆ ABOUT FOOBAR ☆☆
In this channel, you can find mostly coding tutorials related to cloud and serverless.
In addition, I like also talking about architecture, software design, motivation, and leadership.
There is a new video every Tuesday, so stay tuned :)
🎥 Recording equipment: blog.marcia.de...
📚 My favorite books: blog.marcia.de...

Опубликовано:

 

5 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 50   
@lucaseliabecruzrodrigues1100
@lucaseliabecruzrodrigues1100 24 дня назад
OMG!! I love this video! It was exactly what I was looking for! Thanks!!!
@BG-eq6gy
@BG-eq6gy 2 года назад
Qué grande eres! Un placer ver cada uno de tus videos. Cada vez que quiero descubrir un nuevo servicio en aws. Lo primero es buscar un video tuyo. Haces un trabajo magnífico!
@kushprof
@kushprof 2 года назад
THANK YOU!!! I've been struggling with local testing (with SAM) of a project that has a lambda with a layer!
@abbyriggenbach9535
@abbyriggenbach9535 Год назад
Can you please show us how to unit test layers and lambdas using layers?
@joerideveloper
@joerideveloper 5 месяцев назад
Very good tutorial and thanks a lot for demoing how to deploy your own code to a layer. Many other tutorials only show how to deploy an existing third party module as a layer, but that stuff is common knowledge, making it really frustrating while looking for a decent tutorial. I'd say: Look no further, you found the answers you need! It really bothered me that I was copy pasting a lot, glad I found a solution to that problem. Due to a different setup (I'm using terraform and ES6) I had to do a few things differently: My imports look like: import {testFn} from "test1", where one of my helper modules is named test1 I also had to add "type":"module" to my package.json files I had to use export const testFn = () => {} instead of module.exports Also terraform did not detect any changes made to my lambda layer code, so I had to enforce replacement of the layer using terraform apply -replace="aws_lambda_layer_version.name_of_resource" Hope that information could help others struggling like me.
@foobar_codes
@foobar_codes 5 месяцев назад
Thanks for sharing 😸
@marceloaraujo4257
@marceloaraujo4257 Год назад
thanks so much you saved me xD we are starting a new projetct based on AWS here on the company using the SAM to manage the resources and i spend 2 days trying to solving it and you take the response to solve my problems i just found that the module just use the aws-sdk i dont need to use the npm i aws-sdk on module and it made me dont spend more space xD and again thanks so much
@sebastianvillarpando3109
@sebastianvillarpando3109 5 месяцев назад
You saved my life 🙏, thank you
@michaplutecki5124
@michaplutecki5124 Год назад
Great video! Found all the info I was looking for :)
@foobar_codes
@foobar_codes Год назад
Great
@InterviewDOT
@InterviewDOT 2 года назад
Excellent presentation, requesting for a help, the clarity of your video is good, could you please share camera and other tools that you used to make these videos, it will be more helpful - thanks a lot
@foobar_codes
@foobar_codes 2 года назад
There are in the video description blog.marcia.dev/my-recording-equipment
@InterviewDOT
@InterviewDOT 2 года назад
@@foobar_codes wow great thank you so much have fun
@deepak3303
@deepak3303 2 года назад
Exactly what I am looking for. Thank you
@foobar_codes
@foobar_codes 2 года назад
You're welcome!
@deepak3303
@deepak3303 2 года назад
@@foobar_codes rather tha making a new npm package under node modules, isnt it a better pattern if package is referenced "mongo-handler" : "file:../package-mongo-handler"
@vnymachado
@vnymachado 2 года назад
That's awesome! Thank you!
@MK-ef9iu
@MK-ef9iu Год назад
we would love to see a video with sam and step functions locally (with dynamo and sqs). Thanks
@emadiga
@emadiga 2 года назад
Very nice video, layers are something useful, But I think adding your own code inside "node_module" may as you mentioned delete them by mistake Also, I add to gitignore all files for "node_modules" I used layers but when I need to call own code I import it using const dbConnection = require('/opt/dbconnection') for 3rd party libraries in layer const uuid = require('/opt/node_modules/uuid')
@foobar_codes
@foobar_codes 2 года назад
Thanks for the tip!
@TrevoZnaniy
@TrevoZnaniy 2 года назад
Had a little problem with these links, here how it worked for me: const dbConnection = require('/opt/nodejs/dbconnection') for 3rd party libraries in layer const uuid = require('/opt/nodejs/node_modules/uuid') Thank you all!
@nicoladorazio1345
@nicoladorazio1345 Год назад
Could you please do a video where you create your own layer with your own code and then you reference it into a lambda?
@foobar_codes
@foobar_codes Год назад
have you watched this video? In the second half i show you that
@marceloaraujo4257
@marceloaraujo4257 Год назад
now im trying to understand how to create and run unit tests with this configuration considering my own libs on a shared layer between the lambdas
@richardjansingaaliaga7733
@richardjansingaaliaga7733 2 года назад
How would I install the dependencies from a Makefile, and how would the configuration be, thank you very much!
@Gjacolby83
@Gjacolby83 Год назад
Thanks for this video! We have a pipeline stage that runs unit tests before deploying to the different environments. I wonder if moving our dependencies to a layer is going to cause an issue there. Have you had a similar experience?
@rakshakr
@rakshakr 2 года назад
That was awesome. Can we get a CDK version of this?
@foobar_codes
@foobar_codes 2 года назад
Noted!
@sujatachandaragi7965
@sujatachandaragi7965 2 года назад
Thanks!! is there any example for chalice project to use layers?
@foobar_codes
@foobar_codes Год назад
No, sorry
@diegolacerda5288
@diegolacerda5288 2 года назад
Hi there! Nice explanation!! Do you know how to build a layer with typescript project? I'm facing some issues in that :(
@foobar_codes
@foobar_codes Год назад
noted :) i havent tried it yet
@yuvalyacoby2483
@yuvalyacoby2483 2 года назад
Thanks for the great video! It is a bit problematic if we use some common local packages as common layer across 100+ lambdas, we need to redeploy all with new layer version… Is there a plan for a video on lambda extensions? You touched it a bit in the feature flags video, but would love to see how to write custom extensions and some use cases to integrate with lambda life cycle (other than tracing/logs)
@foobar_codes
@foobar_codes 2 года назад
Lambda extensions - noted! For using shared dependencies without redeploy one option is to use EFS. Also nows lambda console allows for bulk update of your layers. aws.amazon.com/about-aws/whats-new/2022/03/aws-lambda-console-bulk-update-layers/
@yuvalyacoby2483
@yuvalyacoby2483 2 года назад
Wow this is really new! Cool. Is it only in the console ? No cli/api?
@SportsX-z8n
@SportsX-z8n Месяц назад
Hello thanks for information. I have below question i have anoter folder inside layers rahter than node_modules , like i have some common code files that is shred to each lambda function like utils and other So how can i include them in local SAM and also it should work same with aws cloud when upload lambda function to use layers
@gustavovalmana5360
@gustavovalmana5360 3 месяца назад
Hello I have a problem, is possible to share the code of a Layer with a Fargate Container? and if is possible where can I search doc about that?
@lowzyyy
@lowzyyy 2 месяца назад
So how does this work with typescript and local invoke? Typescript cannot imoport modules that does not exist? How do i import from layer that is not on my PC? Nothing is described, you just showed some files with zero descriptions why what where.
@davidchoqueluqueroman623
@davidchoqueluqueroman623 2 года назад
Thank for the video, maybe you have an alternative to Update Cross-Stack AWS Lambda Layers? To overcome this error: "Export EXPORT_NAME cannot be updated as it is in use by STACK_NAME"
@alvaroortiz3488
@alvaroortiz3488 2 года назад
Not a question for this video, but through EventBridge, how do you trigger a Lambda when 2 different previous events have both been sent?
@slopez93
@slopez93 2 года назад
Thanks for the video Marcia ! But is not better to share domain or helpers code create a npm package and not depend from AWS ? What are the differences? Thanks again ! Regards
@JohnBrosan
@JohnBrosan 2 года назад
I'm using AWS SAM and Golang. I have structs that I would like to have in a layer that are common to several lambdas I am setting up. Is there anything special that needs to be done like the directory you mentioned? Any chance you have examples of this?
@foobar_codes
@foobar_codes 2 года назад
you need to check the docs for Golang and layers, they work more o less the same but you need to put your code in the layer in a different path. in the description box you can find the docs.
@JohnBrosan
@JohnBrosan 2 года назад
@@foobar_codes Thank you, Ill give that a go. Keep up the awesome work. Love the channel
@mikeyinger4204
@mikeyinger4204 Год назад
When I implement HelpersLayer in my project with the same dir structure for dynamoHandler, I get "errorType":"Error","errorMessage":"Cannot find package 'dynamoHandler'. I used mkdir assuming that SAM would build the package. My question is, after 'npm init -y' in the nodejs dir, did you use the commands 'sam package' or 'npm pack'?
@mikeyinger4204
@mikeyinger4204 Год назад
I found something on StackOverflow and changing from nodejs16 to 18 did the trick.
@jrhager84
@jrhager84 2 года назад
How do you async/await a layer? I have a lambda that needs to wait for a return, but it will just return null. I've tried wrapping the layer in a promise, convert to ESModule, and I can't seem to get it to work. Any ideas?
@fjrbh
@fjrbh 2 года назад
Thanks for share.... I'm getting the same error after "sam deploy -g": "Error: Unable to upload artifact EventStoreFunction referenced by CodeUri parameter of EventStoreFunction resource." and "S3 Bucket does not exist.". I have created some other Serverless architecture with sam successfully.... any idea what can happen?? (I scrupulously follow the steps in the Readme file)
@fjrbh
@fjrbh 2 года назад
Solved!... I had to delete some CloudFormation stack created some time ago ;)
@joebazooks
@joebazooks 5 месяцев назад
my ears, that intro...
Далее
🆕 Feature Flags for Lambda, using AWS AppConfig
22:30
How to Run a Python Docker Image on AWS Lambda
13:08
Просмотров 33 тыс.
Developing AWS Lambda Functions Locally in VS Code
20:22
Understanding AWS Lambda scaling and throughput
1:08:39
Lambda Layers | Theory and Demo with Code
11:02
Просмотров 21 тыс.