How to add api gateway api key to lambda APM?

Kibana version: 8.4.1

Elasticsearch version: 8.4.1

APM Server version: 8.4.1

APM Agent language and version: nodejs, elastic-apm-extension-ver-1-1-0-x86_64, elastic-apm-node-ver-3-38-0

Browser version: /

Original install method (e.g. download page, yum, deb, from source, etc.) and version: lambda layers

Fresh install or upgraded from other version?

Is there anything special in your setup?

Description of the problem including expected versus actual behavior. Please include screenshots (if relevant): There is an AWS Api-gateway with API key placed between lambda and APM server. Is there any ways to add custom header (E.G. api-gateway key) on APM agent? So that every APM agent's request towards APM server will contain api-gateway key in the header.

Errors in browser console (if relevant): 403 return code from api-gateway

Provide logs and/or server output (if relevant):

Hello @alex_123123,

In Elastic's APM lambda architecture, the APM agent (Node.js in this case) talks to the local APM extension, which then talks to the APM server.

If I understand your setup correctly, you'd need a way to tell the APM extension to add x-api-key: $configuredValue to all requests to APM server. The Node.js APM agent does not expose a configuration option to set headers for requests to APM server. @lahsivjar Do you know if the Lambda Extension has any such configuration? My guess is that it does not.

@alex_123123 If that is the case, then the next best step is to add a feature request to the Elastic APM Lambda extension repo: Issues · elastic/apm-aws-lambda · GitHub

1 Like

@lahsivjar Do you know if the Lambda Extension has any such configuration? My guess is that it does not.

Thanks for the answer. You are correct, there is no such configuration in the lambda extension at the moment.

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.