Lambda layers with Serverless Framework and good practices | Serverless

  Рет қаралды 18,346

FooBar Serverless

FooBar Serverless

5 жыл бұрын

I will show you how to use lambda layers with Serverless Framework and some good practices on handling them.
★★ README / OPEN ME ★★
☆ SUBSCRIBE TO THIS CHANNEL: bit.ly/foobar-youtube
☆ SHARE THIS VIDEO: • Lambda layers with Ser...
☆☆ ABOUT THIS VIDEO ☆☆
I will show you how to use lambda layers with Serverless Framework and some good practices on handling them.
A lot of the questions asked in the comments are answer in this other video: • AWS Lambda Layers Q&A ...
Original project: github.com/mavi888/middy-para...
Middy video: • Using Middy in serverl...
Final code github: github.com/mavi888/layers-test
☆☆ FOLLOW ME ONLINE ☆☆
Twitter - mavi888uy - / mavi888uy
Instagram: foobar_codes
Facebook: / foobarcodes
Follow my blog at: bit.ly/foobar-blog
More info - marciavillalba.com
Check my Serverless course: bit.ly/serverless-apps-aws
☆☆ 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 :)
☆☆ SPONSORSHIP ☆☆
Does your company wants to sponsor a video? Contact me by twitter or by email (email address in the about page)
Thanks Gabrielle Marie for the lovely assets for my intro ❤️ (check her channel here: / glamsolutions )

Пікірлер: 46
@foobar_codes
@foobar_codes 5 жыл бұрын
I answer a lot of your questions in this video: kzfaq.info/get/bejne/l7F0bLmX2diamWg.html Go and check it out to see if it helps you out!
@chen-li
@chen-li 5 жыл бұрын
Thanks for the informative video! BTW, the link above seems to be pointing to this same video
@rsdraul
@rsdraul 4 жыл бұрын
@@chen-li Yup, these seems to be the one for those looking: kzfaq.info/get/bejne/fN9yY8ekut22g30.html
@ayami123
@ayami123 Жыл бұрын
is the new one the same ?
@thienphongvu2452
@thienphongvu2452 5 жыл бұрын
Can you make another video about how to create separate Lambda Layers (a serverless project) and integrate them to different Lambdas (other serverless projects)?
@juliansanchez5461
@juliansanchez5461 5 жыл бұрын
Geniales tus videos !! saludos desde Colombia
@codenjourney6656
@codenjourney6656 4 жыл бұрын
Thanks for the excellent lecture
@LoveMagic11
@LoveMagic11 4 жыл бұрын
Thank you foobar, Nice explanation! it helps me lot!
@foobar_codes
@foobar_codes 4 жыл бұрын
That is great to hear 😊
@jlu
@jlu 2 жыл бұрын
Doing package: patterns: - '!layers/**' - '!node_modules/**' Always returns 'No file matches include / exclude patterns' for me, any idea why?
@nikhilvaka8899
@nikhilvaka8899 3 жыл бұрын
Thank You ..Nice explanation. It helps me lot.. How we can customize lambda layer within account in serverless yml file using Pseudo parameters.
@youtubedemointegrator6836
@youtubedemointegrator6836 5 жыл бұрын
any idea how we can access FFmpeg in lambda function for extract image from s3 video
@thecloudfunction894
@thecloudfunction894 5 жыл бұрын
have u been able to access to files into layers? when I try to require('/opt/layerPath/file') it cannot find the route
@cortesbr8131
@cortesbr8131 Жыл бұрын
I did the process of creating a .zip with the contents of a chartjs-node-canvas lib, and uploading it to a layer. I took the ARN of that layer and put it in my function, but I always get the error "errorMessage": "ChartJSNodeCanvas is not define. what to do? please someone help me with this question...
@kiranmarati1201
@kiranmarati1201 5 жыл бұрын
When we update layer package, will my lambda function automatically picks latest version of layer or do we also need to update the latest version of layer in lambda function.?
@yankee-in-london
@yankee-in-london 5 жыл бұрын
Thanks Foo Bar. Was interested in if you had any additional info the the “don’t do the layers in the same repo” comment? I use the Serverless framework and being able to have automatic linking between layer and function is quite useful. Wondering how to work around this constraint if possible.
@foobar_codes
@foobar_codes 5 жыл бұрын
you can put the ARN of the layer in the serverless.yml and use two different serverless framework projects.
@orrlevinger
@orrlevinger 3 жыл бұрын
can i make just a node_modules layer that points to the node_modules directory as default layer and point all my lambdas to it until i create a more granular layer? and than all my lambdas will be small?
@tomding2789
@tomding2789 Ай бұрын
What if there are multiple projects using the same layer, and I want to develop under vscode, how to address with code intelligence? because the layer is up on aws, Thanks
@DiegoRFGonz88
@DiegoRFGonz88 5 жыл бұрын
Is there a way to make the lambda function to point to the lastest version of the layer? without having to make the same as you in this video? (I have them layer-service in different projects)
@TheMainCOW
@TheMainCOW 5 жыл бұрын
Hello! I am trying to run my Lambda function locally using AWS SAM and I have created TensorFlow Layer. But every time I try to run my function I get following error: error while loading shared libraries: libtensorflow.so: cannot open shared object file: No such file or directory. Any idea how can I fix this?
@DanielPereiraBP
@DanielPereiraBP 5 жыл бұрын
Is it possible to use "local invoke" working with layers?
@shacco6563
@shacco6563 4 жыл бұрын
thank you
@kristofferhaukaasberg6258
@kristofferhaukaasberg6258 5 жыл бұрын
Great explanation, thanks:) I ended up deploying functions individually instead of full deploy, and it worked great. So fast! Just a quick question: would a big library like Chrome puppeteer work in a layer like this you think? (haven't checked the size and howto, but I theory, would it work?).
@foobar_codes
@foobar_codes 5 жыл бұрын
I have not tried that but there is an layer for it, so i imagine it can work github.com/mthenw/awesome-layers
@codingexpedition4625
@codingexpedition4625 5 жыл бұрын
Nice video. Certainly something to explore. Did aws put the re:invent talk about layers online?
@foobar_codes
@foobar_codes 5 жыл бұрын
Yes SRV375 - [NEW LAUNCH!] Lambda Layers But its a chalk talk so it wont be in youtube :(
@nihas5264
@nihas5264 2 жыл бұрын
Doubt, can we use layers in a custom authoriser?
@user-rc1jv7dy5i
@user-rc1jv7dy5i 9 ай бұрын
Someone has this error when try execute sls package ? ERROR: Cannot read file node_moduñes/.. - EMFILE: too many open files
@benderino42
@benderino42 3 жыл бұрын
Hey. The link for serverless course does not work. Could you send me a new one?
@KevinToala96
@KevinToala96 5 жыл бұрын
Muy buen video. Gracias. Si quisiera hacer este mismo proceso pero con un proyecto Javen y Maven, como se deberia de hacer esto ?. No encuentro ejemplos de esto
@KevinToala96
@KevinToala96 5 жыл бұрын
Lo tengo. Las dependencias en maven deben de ser marcadas con el scope "provided" y generar una copia de todas las depedencias con mvn copy-dependencies, para asi generar un zip que se podra utilizar como lambda layer.
@fede_balderas
@fede_balderas 5 жыл бұрын
If we have another Serverless service just with the layers, is it possible to deploy just one layer (when it changes) or we have to deploy the all service everytime?
@SimpliCodeDev
@SimpliCodeDev 5 жыл бұрын
Yep! Layer can be managed as a completely separate project/folder and can have its own deployment life-cycle.
@fede_balderas
@fede_balderas 5 жыл бұрын
Nice!!! thanks @@SimpliCodeDev
@contractorwolf
@contractorwolf 5 жыл бұрын
if you are putting your layers in another project, how do you reference them from the project that contains your functions?
@fede_balderas
@fede_balderas 5 жыл бұрын
With the ARN of the layer: serverless.com/framework/docs/providers/aws/guide/layers#using-your-layers functions: hello: handler: handler.hello layers: - arn:aws:lambda:region:XXXXXX:layer:LayerName:Y
@contractorwolf
@contractorwolf 5 жыл бұрын
@@fede_balderas nice! thanks for the quick reply (and great content)
@angelcostales7022
@angelcostales7022 4 жыл бұрын
Hola Marcia!! estoy intentado combinar dos de tus videos en una sola prueba: el de multiples entornos video #4 (env-parameter-test) + lambda layers (este video sobre el que comento)... Por ponerte en contexto; tengo dos proyectos serverless, uno para el layer y otro para la lambda (como recomendaste de buena practica), la consulta es que no consigo que la lambda encuentre el modulo de middy. En el proyecto de la la función de hello le estoy referenciando el layer arn.. se despliega todo bien (y veo desde la consola de AWS que la lambda tiene la layer del otro proyecto). pero cuando pruebo la lambda me dice: estoy pensando que puede ser por el NODE_PATH que no lo he puesto en el proyecto de la función porque la variable provider.. "environment" ya tiene un valor (creo que para poder usar las variables desde el código) por eso no puedo usarla para mapearla con el NODE_PATH. ¿podrías ayudarme?
@angelcostales7022
@angelcostales7022 4 жыл бұрын
he quitado el valor de "environment" y he colocado "NODE_PATH: "./:/opt/node_modules"" y he probado de nuevo. Lo bueno es que ya no me sale el error de middy (lo que significa que si era esto).. pero ahora como la variable "environment" no se define bien.. lo que sucede es un nuevo error que dice: authorized bla bla.... to parameter/env-parameter-test/undefined/value1.... si te fijas en la ruta aparece "undefined" con lo cual significa que no se está generando bien la variable del "environment".. :( no se como puedo resolver esto, si se te ocurre algo ¿puedes ayudarme? Muchas gracias de antemano :D
@angelcostales7022
@angelcostales7022 4 жыл бұрын
Encontré la solución, simplemente coloque "environment" con el NODE_PATH dentro del contexto de la función y deje la otra variable "environment" tal cual dentro de provider. Entiendo que colocarla en el contexto de "provider" la hace común para el resto de funciones, por lo que si es necesario usar dicha layer en multiples funciones habrá que configurarle el environment con el NODE_PATH a cad una.
@angelcostales7022
@angelcostales7022 4 жыл бұрын
Y ya solo me queda agradecerte por los videos! para los que no habíamos tocado todo esto nos viene genial. Mil gracias.
@foobar_codes
@foobar_codes 4 жыл бұрын
Jaja! Gracias por poner la solucion a tu problema :) Asi si alguien tiene el mismo problema puede mirar aca. Saludos
@alexnguyen411
@alexnguyen411 2 жыл бұрын
Please code sample link in video 😍😍😍😍
@AbhijitSrivastava
@AbhijitSrivastava 5 жыл бұрын
I appreciate the effort but there are few mistakes. Example, you can wrap layers in nodejs folder, and avoid changing the node path.
@shacco6563
@shacco6563 4 жыл бұрын
it is not a mistake. yes you can do that but any time you deploy you create a new version. you wont be able to separate devdependencies from dependencies and you will have a huge layer probably so huge that will pass the limits. so listen to her and do separated projects ymls for your layers
Simple application with API Gateway Websockets  | Serverless
16:54
FooBar Serverless
Рет қаралды 22 М.
WHAT IS THE DIFFERENCE? - SQS / SNS / EVENTBRIDGE / KINESIS
20:57
FooBar Serverless
Рет қаралды 14 М.
Schoolboy - Часть 2
00:12
⚡️КАН АНДРЕЙ⚡️
Рет қаралды 9 МЛН
ЧУТЬ НЕ УТОНУЛ #shorts
00:27
Паша Осадчий
Рет қаралды 10 МЛН
Каха заблудился в горах
00:57
К-Media
Рет қаралды 10 МЛН
WORLD'S SHORTEST WOMAN
00:58
Stokes Twins
Рет қаралды 133 МЛН
That's It, I'm Done With Serverless*
23:58
Theo - t3․gg
Рет қаралды 199 М.
Writing unit tests in serverless applications | Hunting for errors
18:45
FooBar Serverless
Рет қаралды 7 М.
Triggering AWS Lambda with SQS message using Serverless Framework |  FooBar
10:22
AWS Lambda Layers - How to use them in Lambda Functions
19:18
Prasad Domala
Рет қаралды 29 М.
Advanced Step Functions Patterns with Ben Smith
39:48
FooBar Serverless
Рет қаралды 950
Lambda : Layers - How to add pymysql module as your function layer?
12:18
Saborni Bhattacharya
Рет қаралды 2,7 М.
Lambda Layers | Theory and Demo with Code
11:02
Cloud With Raj
Рет қаралды 20 М.
Managing dependencies using AWS Lambda Layers with NodeJS and AWS SAM
20:42
The moment we stopped understanding AI [AlexNet]
17:38
Welch Labs
Рет қаралды 863 М.
Ускоряем ваш TV🚀
0:44
ARTEM_CHIBA
Рет қаралды 484 М.
Мой новый мега монитор!🤯
1:00
Корнеич
Рет қаралды 3,6 МЛН