Skip to content

Commit 47ea0d2

Browse files
AlexanderWertbmorelli25
authored andcommitted
Updated AWS lambda docs to use ARN for layer installation (elastic#2467)
1 parent b38bf37 commit 47ea0d2

File tree

1 file changed

+28
-37
lines changed

1 file changed

+28
-37
lines changed

docs/setup-aws-lambda.asciidoc

Lines changed: 28 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,6 @@ and there are various ways you can tweak it to fit your needs.
99
NOTE: In order to get the full AWS Lambda tracing capabilities, use with APM Server 7.16 or higher. Using
1010
older versions provides most value, but some relevant metadata fields will not be indexed.
1111

12-
[float]
13-
[[aws-lambda-installation]]
14-
==== Installation
15-
16-
Setting up your Lambda function is a three-step process.
17-
18-
1. Check <<aws-lambda-runtimes>>
19-
2. <<aws-lambda-extension>>
20-
3. <<aws-lambda-instrumenting>>
21-
2212
[float]
2313
[[aws-lambda-runtimes]]
2414
==== Supported runtimes
@@ -49,41 +39,42 @@ explicitly.
4939

5040
|===
5141

42+
[float]
43+
[[aws-lambda-installation]]
44+
==== Installation
45+
46+
Setting up APM for your Java Lambda function is a two-step process. Make sure to follow _both_ of the following steps:
47+
48+
1. <<aws-lambda-extension>>
49+
2. <<aws-lambda-instrumenting>>
50+
5251
[float]
5352
[[aws-lambda-extension]]
5453
==== Install the Elastic APM Lambda extension
5554

56-
Elastic uses a Lambda extension to forward data to APM Server in a way that does not interfere with the
57-
execution of your Lambda function.
58-
59-
See the https://www.elastic.co/guide/en/apm/guide/current/aws-lambda-extension.html[installation documentation] to get started.
55+
Elastic uses a Lambda extension to forward data to an APM Server in a way that does not interfere with the execution of your Lambda function.
6056

61-
NOTE: Not all environment variables specified within https://www.elastic.co/guide/en/apm/guide/current/aws-lambda-extension.html#aws-lambda-variables[The Necessary Variables]
62-
section of the extension documentation need to be configured. The Java agent utilizes a https://docs.aws.amazon.com/lambda/latest/dg/runtimes-modify.html[wrapper script]
63-
to set some of these up, so follow the next section to see which are required.
57+
Follow the https://www.elastic.co/guide/en/apm/guide/current/aws-lambda-extension.html[installation documentation for the extension] to setup the Elastic APM Lambda extension for your Lambda function.
6458

6559
[float]
6660
[[aws-lambda-instrumenting]]
67-
==== Installing the Elastic APM Java Agent layer
68-
69-
The Java Agent is installed as an AWS Layer as well. It is distributed as a ZIP archive containing two files:
70-
71-
- The Java Agent jar file
72-
- A wrapper script that sets up the runtime to enable automatic attachment of the agent
73-
74-
Follow these steps to ensure proper Java Agent attachment to your Lambda function:
75-
76-
1. Download the `elastic-apm-java-aws-lambda-layer-<VERSION>.zip` archive from our
77-
https://github.com/elastic/apm-agent-java/releases[GitHub Releases page].
78-
2. Publish the downloaded ZIP archive as an https://docs.aws.amazon.com/lambda/latest/dg/invocation-layers.html?icmpid=docs_lambda_help[AWS Lambda Layer].
79-
3. Configure your function to use the Java Agent layer.
80-
4. Within your Function configuration, configure the following environment variables:
81-
a. `AWS_LAMBDA_EXEC_WRAPPER` (required): set this variable's value to `/opt/elastic-apm-handler`, so that Lambda starts the runtime with this script.
82-
b. `ELASTIC_APM_LAMBDA_APM_SERVER` (required): this will tell the Elastic APM Extension where to send data to.
83-
c. <<config-secret-token, `ELASTIC_APM_SECRET_TOKEN`>> or <<config-api-key, `ELASTIC_APM_API_KEY`>> (required): one of these needs to be set
84-
as the authentication method that the extension uses when sending data to the URL configured via `ELASTIC_APM_LAMBDA_APM_SERVER`
85-
d. <<config-application-packages, `ELASTIC_APM_APPLICATION_PACKAGES`>> (recommended): setting this may improve cold start times.
86-
5. Fine-tune the Java agent with any of the available <<configuration, configuration options>>.
61+
==== Install the Elastic APM Java Agent Layer
62+
63+
The Java Agent is installed as an AWS Layer.
64+
65+
1. Pick the right ARN from the https://github.com/elastic/apm-agent-java/releases[ARN table for the APM Java Agent Lambda Layer]. Note: The APM Java Agent Layer needs to be in the _same region_ as your Lambda function.
66+
2. Navigate to your function in the AWS Console
67+
3. Scroll to the Layers section and click the _Add a layer_ button
68+
4. Choose the _Specify an ARN_ radio button
69+
5. Enter the Version ARN of the APM Java Agent Layer in the _Specify an ARN_ text input
70+
6. Click the _Add_ button
71+
72+
Once the APM Java Agent Layer is in place, you'll need to configure some environment variables _in addition_ to the environment variables you already configured for the APM Lambda extension.
73+
Configure the following environment variables for the APM Java Agent Layer:
74+
75+
1. (required) `AWS_LAMBDA_EXEC_WRAPPER`: set this variable's value to `/opt/elastic-apm-handler`, so that Lambda starts the runtime with an attached APM Java agent.
76+
2. (recommended) <<config-application-packages, `ELASTIC_APM_APPLICATION_PACKAGES`>>: setting this may improve cold start times.
77+
3. (optional) Fine-tune the Java agent with any of the available <<configuration, configuration options>>.
8778

8879
That's it, if you've done all of the above you are set to go!
8980
Your Lambda function invocations should be traced from now on.

0 commit comments

Comments
 (0)