I’ve noticed in a couple of instances I was able to get features like rds-data and servicediscovery discover instance to work locally but when the code was ported to lambda neither worked.
Note rds-data is for working with serverless aurora without needing to build a connection pool. (see the June update show) the service discovery one is for being able to work with cloud map (one guess what that is).
Edit: Well looks like I should be rolling mine in a layer, that’s easy enough! Thanks all!
/u/Redditron-2000-4 's answer is the best approach, but to answer your question, it can be quite far since it’s baked into the AMI. Node8 and Python3.6 are running a version from their respective SDKs from August 2018. Info can be found here:
Sometimes it’s very hard to do though, like if you want to run pytorch inside lambda and you’re already stripping binaries and deleting unused files just to fit inside the max package size.
A function can use up to 5 layers at a time. The total unzipped size of the function and all layers can’t exceed the unzipped deployment package size limit of 250 MB. For more information, see AWS Lambda Limits.
Show stopper for sure. And you’re paying 8x for compute. I get serverless is easy, but so is managing an ec2 instance. (For certain use cases of course)
~~It is? Show me where it’s listed as a best practice to package provided packages. This believe it or not isn’t as confrontational as it sounds, but if I’m going to sell this line to my other developers I’m going to have to have it written down and I don’t remember seeing this in the aws lambda best practices.~~
~~I mean from my own personal point of view, boto3 is out of the box provided from amazon so wouldn’t there be a potential for a dependency conflict to occur?~~
Edit: Disregard on link, this is good enough, amz straight up telling you to package your own. (From below)
As others said, go for the layers for prepackaged libraries where you aren’t changing the source (or is 250mb still stretching it and can you split it over multiple layers?)
Best practices are more advices than rules, not finding one documented as a white paper doesn’t take away from them.
Also, don’t trust blindy on AWS advices, we already got burn a couple times at my workplace for sticking to what the said or what support said should be OK to do. Have in mind we pay a very good support fee to them. This is particularly true for new features / services that sometimes they release half baked, pourly documented and even not compatible with their other services.
Lambda layers for instance, where only released a bit more that 6 months ago, none surprising than they are not yet in their best practices.
The only issue with adding your own boto3 layer is your maintaining it yourself which is good and bad. I only tend to maintain stuff if I absolutely have to especially when things like https://github.com/keithrozario/Klayers exist.