This is a very good question. I’d recommend reaching out to Dynatrace Support as a customer is waiting on a solution for this. They should be able to provide you with the best method for this.
Dynatrace provides you now with a dedicated AWS Lambda layer that contains the Dynatrace OneAgent extension for AWS Lambda. You can read more about it in this documentation article: