-
Couldn't load subscription status.
- Fork 238
Improved getting started guide for AWS Lambda #2630
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
428a2de
Update Lambda docs
trentm 94da363
some formatting, order and grammar suggestions from Brandon and Alan
trentm 89440b2
restore some content I'd unintentionally removed from the current doc
trentm 4c01aa5
uncomment out a part that was waiting for the node.js AWS console env…
trentm c009820
update build_docs script to 'npm run docs:open' works (per Brandon)
trentm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| ++++ | ||
| <div class="tabs" data-tab-group="os"> | ||
| <div role="tablist" aria-label="dependency"> | ||
| <button role="tab" | ||
| aria-selected="true" | ||
| aria-controls="console-tab-lambda-nodejs-config" | ||
| id="console-lambda-nodejs-config"> | ||
| AWS Web Console | ||
| </button> | ||
| <button role="tab" | ||
| aria-selected="false" | ||
| aria-controls="cli-tab-lambda-nodejs-config" | ||
| id="cli-lambda-nodejs-config" | ||
| tabindex="-1"> | ||
| AWS CLI | ||
| </button> | ||
| <button role="tab" | ||
| aria-selected="false" | ||
| aria-controls="sam-tab-lambda-nodejs-config" | ||
| id="sam-lambda-nodejs-config" | ||
| tabindex="-1"> | ||
| SAM | ||
| </button> | ||
| <button role="tab" | ||
| aria-selected="false" | ||
| aria-controls="serverless-tab-lambda-nodejs-config" | ||
| id="serverless-lambda-nodejs-config" | ||
| tabindex="-1"> | ||
| Serverless | ||
| </button> | ||
| <button role="tab" | ||
| aria-selected="false" | ||
| aria-controls="terraform-tab-lambda-nodejs-config" | ||
| id="terraform-lambda-nodejs-config" | ||
| tabindex="-1"> | ||
| Terraform | ||
| </button> | ||
| </div> | ||
| <div tabindex="0" | ||
| role="tabpanel" | ||
| id="console-tab-lambda-nodejs-config" | ||
| name="lambda-tabpanel" | ||
| aria-labelledby="console-lambda-nodejs-config"> | ||
| ++++ | ||
|
|
||
| include::configure-lambda.asciidoc[tag=console-{layer-section-type}] | ||
|
|
||
| ++++ | ||
| </div> | ||
| <div tabindex="0" | ||
| role="tabpanel" | ||
| id="cli-tab-lambda-nodejs-config" | ||
| name="lambda-tabpanel" | ||
| aria-labelledby="cli-lambda-nodejs-config" | ||
| hidden=""> | ||
| ++++ | ||
|
|
||
| include::configure-lambda.asciidoc[tag=cli-{layer-section-type}] | ||
|
|
||
| ++++ | ||
| </div> | ||
| <div tabindex="0" | ||
| role="tabpanel" | ||
| id="sam-tab-lambda-nodejs-config" | ||
| name="lambda-tabpanel" | ||
| aria-labelledby="sam-lambda-nodejs-config" | ||
| hidden=""> | ||
| ++++ | ||
|
|
||
| include::configure-lambda.asciidoc[tag=sam-{layer-section-type}] | ||
|
|
||
| ++++ | ||
| </div> | ||
| <div tabindex="0" | ||
| role="tabpanel" | ||
| id="serverless-tab-lambda-nodejs-config" | ||
| name="lambda-tabpanel" | ||
| aria-labelledby="serverless-lambda-nodejs-config" | ||
| hidden=""> | ||
| ++++ | ||
|
|
||
| include::configure-lambda.asciidoc[tag=serverless-{layer-section-type}] | ||
|
|
||
| ++++ | ||
| </div> | ||
| <div tabindex="0" | ||
| role="tabpanel" | ||
| id="terraform-tab-lambda-nodejs-config" | ||
| name="lambda-tabpanel" | ||
| aria-labelledby="terraform-lambda-nodejs-config" | ||
| hidden=""> | ||
| ++++ | ||
|
|
||
| include::configure-lambda.asciidoc[tag=terraform-{layer-section-type}] | ||
|
|
||
| ++++ | ||
| </div> | ||
| </div> | ||
| ++++ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| // tag::console-with-agent[] | ||
|
|
||
| To configure APM through the AWS Management Console: | ||
|
|
||
| 1. Navigate to your function in the AWS Management Console | ||
| 2. Click on the _Configuration_ tab | ||
| 3. Click on _Environment variables_ | ||
| 4. Add the following required variables: | ||
|
|
||
| [source,bash] | ||
| ---- | ||
| NODE_OPTIONS = -r elastic-apm-node/start # use this exact fixed value | ||
| ELASTIC_APM_LAMBDA_APM_SERVER = <YOUR-APM-SERVER-URL> # this is your APM Server URL | ||
| ELASTIC_APM_SECRET_TOKEN = <YOUR-APM-SECRET-TOKEN> # this is your APM secret token | ||
| ---- | ||
|
|
||
| -- | ||
| include::{apm-aws-lambda-root}/docs/images/images.asciidoc[tag=nodejs-env-vars] | ||
| -- | ||
|
|
||
| // end::console-with-agent[] | ||
|
|
||
| // tag::cli-with-agent[] | ||
|
|
||
| To configure APM through the AWS command line interface execute the following command: | ||
|
|
||
| [source,bash] | ||
| ---- | ||
| aws lambda update-function-configuration --function-name yourLambdaFunctionName \ | ||
| --environment "Variables={NODE_OPTIONS=-r elastic-apm-node/start,ELASTIC_APM_LAMBDA_APM_SERVER=<YOUR-APM-SERVER-URL>,ELASTIC_APM_SECRET_TOKEN=<YOUR-APM-SECRET-TOKEN>}" | ||
| ---- | ||
|
|
||
| // end::cli-with-agent[] | ||
|
|
||
| // tag::sam-with-agent[] | ||
|
|
||
| In your SAM `template.yml` file add the Layer ARNs of the APM Extension and the APM Agent as follows: | ||
|
|
||
| [source,yml] | ||
| ---- | ||
| ... | ||
| Resources: | ||
| yourLambdaFunction: | ||
| Type: AWS::Serverless::Function | ||
| Properties: | ||
| ... | ||
| Environment: | ||
| Variables: | ||
| NODE_OPTIONS: -r elastic-apm-node/start | ||
| ELASTIC_APM_LAMBDA_APM_SERVER: <YOUR-APM-SERVER-URL> | ||
| ELASTIC_APM_SECRET_TOKEN: <YOUR-APM-SECRET-TOKEN> | ||
| ... | ||
| ---- | ||
|
|
||
| // end::sam-with-agent[] | ||
|
|
||
| // tag::serverless-with-agent[] | ||
|
|
||
| In your `serverless.yml` file add the Layer ARNs of the APM Extension and the APM Agent to your function as follows: | ||
|
|
||
| [source,yml] | ||
| ---- | ||
| ... | ||
| functions: | ||
| yourLambdaFunction: | ||
| ... | ||
| environment: | ||
| NODE_OPTIONS: -r elastic-apm-node/start | ||
| ELASTIC_APM_LAMBDA_APM_SERVER: <YOUR-APM-SERVER-URL> | ||
| ELASTIC_APM_SECRET_TOKEN: <YOUR-APM-SECRET-TOKEN> | ||
| ... | ||
| ---- | ||
|
|
||
| // end::serverless-with-agent[] | ||
|
|
||
| // tag::terraform-with-agent[] | ||
| To add the APM Extension and the APM Agent to your function add the ARNs to the `layers` property in your Terraform file: | ||
|
|
||
| [source,terraform] | ||
| ---- | ||
| ... | ||
| resource "aws_lambda_function" "your_lambda_function" { | ||
| ... | ||
| environment { | ||
| variables = { | ||
| NODE_OPTIONS = "-r elastic-apm-node/start" | ||
| ELASTIC_APM_LAMBDA_APM_SERVER = "<YOUR-APM-SERVER-URL>" | ||
| ELASTIC_APM_SECRET_TOKEN = "<YOUR-APM-SECRET-TOKEN>" | ||
| } | ||
| } | ||
| } | ||
| ... | ||
| ---- | ||
|
|
||
| // end::terraform-with-agent[] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| ++++ | ||
| <script> | ||
| window.addEventListener("DOMContentLoaded", async () => { | ||
| addArnGenerator('agent', 'apm-agent-nodejs', 'arn:aws:lambda:${region}:267093732750:layer:elastic-apm-node-${version}'); | ||
| }); | ||
| </script> | ||
| ++++ |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@trentm @bmorelli25 First -- this widget looks super cool. I didn't realize this sort of thing was possible with ASCII Doc. 💯
Second -- A couple of questions about the widget (apologies if these are retreads of discussions had elsewhere) --
Is this using an authenticated or unauthenticated request to
api.github.com? It looks like the later to me -- if so, do we have any concerns about hitting GitHub's API limits for public requests? Per the docs -- For unauthenticated requests, the rate limit allows for up to 60 requests per hour. Unauthenticated requests are associated with the originating IP address, and not the person making requests.?If there anything special we need to do/maintain in order to make sure this continues to work with future releases? (It looks like all we need to do is make sure the full ARNs are posted to the releases tab in GitHub as part of the release body text -- is there more to it than that?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All credit to @AlexanderWert and Brandon.
It'll be limited by the IP of the personal reading the docs... so not super concerned. However, yah, I think the templating could perhaps improve to have reasonable content for if/when that request fails. Currently it'll look a little confusing. I opened elastic/apm-aws-lambda#171 for this.
My understanding is just that: full ARNs in the releases content.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ARN generator was all Alex—a really neat use of Asciidoc's HTML passthrough blocks.