Skip to content

Commit b8e11aa

Browse files
committed
Refine Java and Python sample
1 parent 6fb66d0 commit b8e11aa

File tree

5 files changed

+11
-12
lines changed

5 files changed

+11
-12
lines changed

lambda-debugging-sam-java/Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@ SAM ?= AWS_ENDPOINT_URL=$(AWS_ENDPOINT_URL) \
1212
AWS_DEFAULT_REGION=us-east-1 \
1313
sam
1414
FUNCTION_NAME ?= HelloWorldFunctionJava
15+
LAMBDA_RUNTIME ?= java21
1516

1617
# Changing architecture (arm64 or x86_64) requires rebuilding the Java package in Docker
1718
ARCH ?= x86_64
1819
DOCKER_PLATFORM ?= linux/$(ARCH)
19-
IMAGE ?= public.ecr.aws/sam/build-java21:latest-$(ARCH)
20+
IMAGE ?= public.ecr.aws/sam/build-$(LAMBDA_RUNTIME):latest-$(ARCH)
2021

2122
all: usage
2223

@@ -46,7 +47,7 @@ deploy: deploy-aws ## Deploy the Lambda function (default AWS CLI)
4647
deploy-aws: ## Deploy the Lambda function via AWS CLI
4748
$(AWS) lambda create-function \
4849
--function-name $(FUNCTION_NAME) \
49-
--runtime java21 \
50+
--runtime $(LAMBDA_RUNTIME) \
5051
--role arn:aws:iam::000000000000:role/lambda-role \
5152
--handler helloworld.App::handleRequest \
5253
--zip-file fileb://HelloWorldFunction/build/distributions/HelloWorldFunction.zip \

lambda-debugging-sam-java/samconfig.toml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,3 @@ resolve_s3 = true
2222

2323
[default.sync.parameters]
2424
watch = true
25-
26-
[default.local_start_api.parameters]
27-
warm_containers = "EAGER"
28-
29-
[default.local_start_lambda.parameters]
30-
warm_containers = "EAGER"

lambda-debugging-sam-python/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Lambda function response
22
response.json
33

4+
# Lambda function package
5+
hello_world/hello_world_python.zip
6+
47
# Created by https://www.toptal.com/developers/gitignore/api/python,sam
58
# Edit at https://www.toptal.com/developers/gitignore?templates=python,sam
69

lambda-debugging-sam-python/Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@ SAM ?= AWS_ENDPOINT_URL=$(AWS_ENDPOINT_URL) \
1212
AWS_DEFAULT_REGION=us-east-1 \
1313
sam
1414
FUNCTION_NAME ?= HelloWorldFunctionPython
15+
LAMBDA_RUNTIME ?= python3.13
1516

1617
# Changing architecture (arm64 or x86_64) requires rebuilding the Java package in Docker
1718
ARCH ?= x86_64
1819
DOCKER_PLATFORM ?= linux/$(ARCH)
19-
IMAGE ?= public.ecr.aws/sam/build-python3.13:latest-$(ARCH)
20+
IMAGE ?= public.ecr.aws/sam/build-$(LAMBDA_RUNTIME):latest-$(ARCH)
2021

2122
all: usage
2223

@@ -36,7 +37,7 @@ build-docker: ## Build the Lambda function zip in Docker
3637

3738
# TODO: package dependencies in requirements.txt
3839
# TODO: run tests before build
39-
build-local: ## Build the Lambda function zip locally (JDK required)
40+
build-local: ## Build the Lambda function zip locally (Python required)
4041
cd hello_world && zip -r hello_world_python.zip .
4142

4243
build-sam: ## Build the Lambda function via AWS SAM
@@ -50,7 +51,7 @@ deploy: deploy-aws ## Deploy the Lambda function (default AWS CLI)
5051
deploy-aws: ## Deploy the Lambda function via AWS CLI
5152
$(AWS) lambda create-function \
5253
--function-name $(FUNCTION_NAME) \
53-
--runtime python3.13 \
54+
--runtime $(LAMBDA_RUNTIME) \
5455
--role arn:aws:iam::000000000000:role/lambda-role \
5556
--handler app.lambda_handler \
5657
--zip-file fileb://hello_world/hello_world_python.zip \

lambda-debugging-sam-python/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ We recommend the one-click setup using the AWS Toolkit for VS Code unless your a
6464
### Debugging
6565

6666
1. Open the sample folder in VS Code to auto-detect `.vscode/launch.json`
67-
2. Set a breakpoint in the handler file `HelloWorldFunction/app.py` by clicking in the gutter-margin
67+
2. Set a breakpoint in the handler file `hello_world/app.py` by clicking in the gutter-margin
6868
3. Open the **Run and Debug** view in VS Code
6969
4. Run the **Python: Remote Attach** task
7070
5. Run `make invoke` to invoke the Lambda function

0 commit comments

Comments
 (0)