alexcasalboni / aws-lambda-power-tuning

AWS Lambda Power Tuning is an open-source tool that can help you visualize and fine-tune the memory/power configuration of Lambda functions. It runs in your own AWS account - powered by AWS Step Functions - and it supports three optimization strategies: cost, speed, and balanced.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How can power tuning forward http request to lambda function?

usabe opened this issue · comments

commented

Hi, team,

Our lambda functions are only served through the apiGateway. When I directly send the lambda function test request with ARN to specify the target, it always gives result of "request unhandled". Is there any way I can send URL on top of the ARN for the tuning test? Like adding the URL inside the payload or somewhere so that I can power tune them as other regular lambda functions?

Thanks

Hi @usabe 👋 thanks for reaching out!

I've been thinking about implementing special support to power-tune Lambda functions behind an API Gateway endpoint.

The main challenge is that there are multiple integration types and the event your Lambda function expects is highly dependant on both integration type and any mapping template (Velocity) that your API Gateway is applying. An easy solution (or workaround) would be supporting only the default structure with a simple URL and METHOD mapping.

What payload structure are you using right now? Have you looked into the official payload structure for APIGW documentation?

commented

Hi, Alex,

Thank you for the explanation. Good to know that you have been thinking about supporting this. Indeed, to fully cover all those scenarios, there are a lot of work to do. For our case, I think the easy solution you mentioned to support the default structure with a simple URL and METHOD mapping should work. Could you please give it a quick update of this? Or how could we implement that?

I didn't check into the APIGW payload structure yet before this. Not very familiar with this. Do you mean we can add the http URL and METHOD into the payload and then apiGateway will pass this to the lambda function?

@usabe yes, you'd need to "manually" construct the full payload (including url, method, headers, etc.).

The fastest solution right now would be printing out the payload structure that your function expects, and then building your power-tuning payload based on that (changing the URL/METHOD based on your tuning needs).

Simply use the JSON input as your payload input for the power-tuning state machine.

commented

Great. Then I'll try that. Thank you, Alex. Your help is really appreciated.

Closing this for now. Please reopen if you need more help :)