Skip to content
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

Improve AWS Lambda Layer build script #673

Merged
merged 2 commits into from
Nov 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 29 additions & 9 deletions bin/aws-lambda/build_and_publish_lambda_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import json
import shutil
import time
import distutils.spawn
from subprocess import call, check_call, check_output, CalledProcessError, DEVNULL

for profile in ("china", "non-china"):
Expand All @@ -33,7 +32,7 @@

# Check requirements first
for cmd in ["pip", "zip"]:
if distutils.spawn.find_executable(cmd) is None:
if not shutil.which(cmd):
print(f"Can't find required tool: {cmd}")
exit(1)

Expand Down Expand Up @@ -129,13 +128,34 @@
print(f"===> Uploading layer to AWS {region} ")
profile = "china" if region in cn_regions else "non-china"

response = check_output(["aws", "--region", region, "lambda", "publish-layer-version",
"--description",
"Provides Instana tracing and monitoring of AWS Lambda functions built with Python",
"--license-info", "MIT", "--output", "json",
"--layer-name", LAYER_NAME, "--zip-file", aws_zip_filename,
"--compatible-runtimes", "python3.8", "python3.9", "python3.10", "python3.11", "python3.12",
"--profile", profile])
response = check_output(
[
"aws",
"lambda",
"publish-layer-version",
"--layer-name",
LAYER_NAME,
"--description",
"Provides Instana tracing and monitoring of AWS Lambda functions built with Python",
"--license-info",
"MIT",
"--output",
"json",
"--zip-file",
aws_zip_filename,
"--compatible-runtimes",
"python3.8",
"python3.9",
"python3.10",
"python3.11",
"python3.12",
"python3.13",
"--region",
region,
"--profile",
profile,
]
)

json_data = json.loads(response)
version = json_data["Version"]
Expand Down
Loading