Hey everyone,
I'm having some issues with Lambda layers. My current setup involves a Lambda function that uses an image type instead of a zip file, and I'm trying to add a Dynatrace layer to it. However, I'm unsure if it's possible to incorporate a layer into a Lambda function that's set up this way. I'm running into an error that says including a handler, runtime, or layer isn't allowed when using a package type of 'Image'. Has anyone experienced this or know how to proceed?
5 Answers
The correct approach is to include everything in your base image and push it to Amazon ECR. Image-based Lambdas don’t utilize layers like zip-based ones do.
As others have pointed out, and as the Lambda API error indicates, layers aren't applicable when you're running from a container image. Just install Dynatrace within the container. Just a heads up, it may need internet access to transmit data unless you've set up a private link with Dynatrace, so keep an eye on the VPC subnet where you're deploying your function.
To use Lambda layers with container images, you actually have to include the layer in your container image itself. Check out the AWS blog for details on working with Lambda layers in this context.
You don't really need a layer for this; it's better to just bake the Dynatrace dependency directly into your container image instead of trying to add a layer. That's how it works with image-based Lambdas.
Layers are only compatible with zip archives, not images. You should build the necessary packages into your image instead.

Related Questions
How To: Running Codex CLI on Windows with Azure OpenAI
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically