[{"data":1,"prerenderedAt":57},["ShallowReactive",2],{"pattern-lambda-layer":3},{"id":4,"title":5,"architectureURL":6,"cleanup":7,"contributors":10,"deploy":12,"description":15,"extension":16,"framework":17,"gitHub":18,"highlight":6,"introBox":24,"language":33,"level":34,"meta":35,"patternArch":36,"resources":41,"s3URL":49,"services":50,"stem":51,"testing":52,"videoId":55,"__hash__":56},"patterns\u002Fpatterns\u002Flambda-layer.json","An AWS Lambda function using a Lambda layer",null,{"text":8},[9],"Delete the stack: \u003Ccode>sam delete\u003C\u002Fcode>.",[11],"content\u002Fcontributors\u002Fglenn-chia-jin-wee.json",{"text":13},[14],"sam deploy","Create Lambda function with a Lambda layer","json","AWS SAM",{"template":19},{"repoURL":20,"templateURL":21,"projectFolder":22,"templateFile":23},"https:\u002F\u002Fgithub.com\u002Faws-samples\u002Fserverless-patterns\u002Ftree\u002Fmain\u002Flambda-layer","serverless-patterns\u002Flambda-layer","lambda-layer","template.yml",{"headline":25,"text":26},"How it works",[27,28,29,30,31,32],"This sample project demonstrates how to deploy a Lambda Function that has a layer added to it.","The SAM template provided deploys two Lambda functions. Both Lambda functions attempt to import the `PyMySQL` package.","However, only one of the Lambda functions has the `PyMySQL` layer which allows it to import the package successfully.","This pattern tests both Lambda functions to illustrate the difference when there is a layer added to a Lambda function.","One use case for Lambda layers is to have packages like `PyMySQL` shared across various Lambda functions that require connections to RDS MySQL.","Using layers reduces the size of uploaded deployment archives and makes it faster to deploy your code.","Python","100",{},{"icon1":37},{"x":38,"y":38,"service":39,"label":40},50,"lambda","AWS Lambda",{"bullets":42},[43,46],{"text":44,"link":45},"AWS Lambda Developer Guide - Creating and sharing Lambda layers","https:\u002F\u002Fdocs.aws.amazon.com\u002Flambda\u002Flatest\u002Fdg\u002Fconfiguration-layers.html",{"text":47,"link":48},"AWS Compute Blog - Working with AWS Lambda and Lambda Layers in AWS SAM","https:\u002F\u002Faws.amazon.com\u002Fblogs\u002Fcompute\u002Fworking-with-aws-lambda-and-lambda-layers-in-aws-sam\u002F","https:\u002F\u002Fda-public-assets.s3.amazonaws.com\u002Fpatterns\u002Flambda-layer\u002Fcloudformation.yml",{"from":39,"to":39},"patterns\u002Flambda-layer",{"text":53},[54],"See the GitHub repo for detailed testing instructions.","","wh88gJlpmsqH-Mh_PMICV1_gd1DkhysX3UXZXpNuQpU",1778927709643]