You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/aws-lambda/lambdas/README.md
+11-2Lines changed: 11 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -3,10 +3,19 @@ Example Lambdas
3
3
4
4
Contains a few trivial example lambdas, mainly used to set up quick experiments.
5
5
6
+
Manually creating the empty Lambda function
7
+
-------------------------------------------
8
+
9
+
First, you need to manually create the lambda function in the target region.
10
+
The name of the new function and the name of the zip file needs to match.
11
+
6
12
7
13
Building The Lambda Zip Files
8
14
-----------------------------
9
15
16
+
Add `.dont-add-npm-instana` file to the target folder to avoid adding the Instana npm packages and to use the layer instead.
17
+
18
+
Go to `cd packages/aws-lambda`.
10
19
Run `bin/create-zip.sh <lambda-folder-name>` to create deployment zip files for one of Lambda functions in this folder. The resulting zip files can be found in the `zip` subfolder. They can be uploaded to AWS as Lambda functions. There is also a script to deploy the resulting zip file via the `aws` command line tool.
11
20
12
21
The environment variable `BUILD_LAMBDAS_WITH` controls how the Lambda zip files are being built:
@@ -21,11 +30,11 @@ Deploying Lambda Zip Files
21
30
22
31
Before you deploy zip files, you need to actually build them, see above.
23
32
24
-
Use `bin/deploy-zip.sh <lambda-folder-name>` to deploy a Lambda zip files. They will be deployed to region `us-east-2` by default. You can repeat that step as often as you like if the Lambda code has changed or you want to deploy zip files with a more recent npm package/local package/Lambda layer.
33
+
Use `bin/deploy-zip.sh <zip-file>` to deploy a Lambda zip files. They will be deployed to region `us-east-2` by default. You can repeat that step as often as you like if the Lambda code has changed or you want to deploy zip files with a more recent npm package/local package/Lambda layer.
25
34
26
35
If you have built the zip files with `BUILD_LAMBDAS_WITH=layer`, the script will try to add the Lambda layer "instana-nodejs" to the deployed Lambda function. The script will try to figure out the latest version of the Instana Node.js Lambda layer. Alternatively, you can also use `LAYER_VERSION` and `LAYER_ARN` to specifiy which layer you want to have added. Checkout the latest layers here: https://www.ibm.com/docs/en/instana-observability/current?topic=lambda-aws-native-tracing-nodejs
27
36
28
-
E.g. run something like `LAYER_VERSION=167 LAYER_ARN=arn:aws:lambda:ap-southeast-1:767398002385:layer:instana-nodejs:167 bin/deploy-zip.sh`.
37
+
E.g. run something like `LAYER_VERSION=167 LAYER_ARN=arn:aws:lambda:ap-southeast-1:767398002385:layer:instana-nodejs:167 bin/deploy-zip.sh <zip-file>`.
29
38
30
39
Note that if you have use `BUILD_LAMBDAS_WITH=npm` or `BUILD_LAMBDAS_WITH=local` and the function already has the Instana Lambda layer, the deploy script will try to remove it and revert the handler back to `index.handler`.
# Note: ${BUILD_LAMBDAS_WITH-xyz} -> default expansion with default xyz, to avoid bash error "unbound variable"
31
-
# when set -u is active.
32
-
33
30
echo
34
31
echo NOTE: When switching between BUILD_LAMBDAS_WITH=layer on one hand and BUILD_LAMBDAS_WITH=npm or BUILD_LAMBDAS_WITH=local on the other hand, you might need to add \(or remove\) instana.wrap\(\) to \(from\) the individual Lambda handler functions!
35
32
echo
36
33
37
34
echo Building all local tar.gz files.
38
35
39
-
if [[ -z"${BUILD_LAMBDAS_WITH-}" ]];then
40
-
echo"Environmant variable BUILD_LAMBDAS_WITH has not been provided, assuming \"npm\" (build with latest npm package)."
36
+
if [[ -z"${BUILD_LAMBDAS_WITH}" ]];then
37
+
echo"Environment variable BUILD_LAMBDAS_WITH has not been provided, assuming \"local\"."
38
+
BUILD_LAMBDAS_WITH=local
41
39
fi
42
40
43
41
# We will want to install/uninstall local npm package tar files, which means we need to build them first. Note: Even for
44
42
# options BUILD_LAMBDAS_WITH=layer or BUILD_LAMBDAS_WITH=npm, we need to build the packages, because we for all three
45
43
# packages we will call "npm uninstall -S $package-name" and if the package.json points to the tar file it needs
46
44
# to exist so npm can uninstall it and all its transitive dependencies.
45
+
46
+
version=$(jq -r '.version' package.json)
47
+
47
48
echo"Building local tar.gz for @instana/serverless."
0 commit comments