Skip to content
Open
Show file tree
Hide file tree
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
1 change: 0 additions & 1 deletion stateless-mcp-on-lambda-python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ Before deploying, you need to configure the environment variables in `etc/enviro
```bash
make layer
```
After execution, copy the `outLayer` value and update the `O_LAYER_ARN` in `etc/environment.sh`.

2. Deploy the API Gateway and Lambda function:
```bash
Expand Down
2 changes: 1 addition & 1 deletion stateless-mcp-on-lambda-python/etc/environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ LAYER_STACK=samples-mcp-lambda-layer
LAYER_TEMPLATE=sam/layer.yaml
LAYER_OUTPUT=sam/layer_output.yaml
LAYER_PARAMS="ParameterKey=description,ParameterValue=${P_DESCRIPTION}"
O_LAYER_ARN=your-output-layer-arn
O_LAYER_ARN=will be populated by the script

# api gateway and lambdastack
P_API_STAGE=dev
Expand Down
23 changes: 16 additions & 7 deletions stateless-mcp-on-lambda-python/makefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,28 @@
include etc/environment.sh

# dependencies
layer: layer.build layer.package layer.deploy
layer: layer.build layer.package layer.deploy layer.get-arn
layer.build:
sam build -t ${LAYER_TEMPLATE} --parameter-overrides ${LAYER_PARAMS} --build-dir build --manifest src/dependencies/requirements.txt --use-container
sam build -t ${LAYER_TEMPLATE} --parameter-overrides ${LAYER_PARAMS} --build-dir build --manifest src/dependencies/requirements.txt --use-container --region ${REGION} --profile ${PROFILE}
layer.package:
sam package -t build/template.yaml --region ${REGION} --output-template-file ${LAYER_OUTPUT} --s3-bucket ${BUCKET} --s3-prefix ${LAYER_STACK}
sam package -t build/template.yaml --region ${REGION} --output-template-file ${LAYER_OUTPUT} --s3-bucket ${BUCKET} --s3-prefix ${LAYER_STACK} --profile ${PROFILE}
layer.deploy:
sam deploy -t ${LAYER_OUTPUT} --region ${REGION} --stack-name ${LAYER_STACK} --parameter-overrides ${LAYER_PARAMS} --capabilities CAPABILITY_NAMED_IAM
sam deploy -t ${LAYER_OUTPUT} --region ${REGION} --stack-name ${LAYER_STACK} --parameter-overrides ${LAYER_PARAMS} --profile ${PROFILE}
layer.get-arn:
@echo "Getting layer ARN and updating environment.sh..."
$(eval LAYER_ARN := $(shell aws cloudformation describe-stacks --stack-name ${LAYER_STACK} --region ${REGION} --profile ${PROFILE} --query 'Stacks[0].Outputs[?OutputKey==`outLayer`].OutputValue' --output text))
@sed -i 's|^O_LAYER_ARN=.*|O_LAYER_ARN=${LAYER_ARN}|' etc/environment.sh
@echo "Updated O_LAYER_ARN to: ${LAYER_ARN}"

# api gateway
apigw: apigw.package apigw.deploy
apigw.package:
sam package -t ${APIGW_TEMPLATE} --output-template-file ${APIGW_OUTPUT} --s3-bucket ${BUCKET} --s3-prefix ${APIGW_STACK}
sam package -t ${APIGW_TEMPLATE} --output-template-file ${APIGW_OUTPUT} --s3-bucket ${BUCKET} --s3-prefix ${APIGW_STACK} --region ${REGION} --profile ${PROFILE}
apigw.deploy:
sam deploy -t ${APIGW_OUTPUT} --region ${REGION} --stack-name ${APIGW_STACK} --parameter-overrides ${APIGW_PARAMS} --capabilities CAPABILITY_NAMED_IAM
sam deploy -t ${APIGW_OUTPUT} --region ${REGION} --stack-name ${APIGW_STACK} --parameter-overrides ${APIGW_PARAMS} --profile ${PROFILE}
apigw.delete:
sam delete --stack-name ${APIGW_STACK}
sam delete --stack-name ${APIGW_STACK} --region ${REGION} --profile ${PROFILE}

delete:
sam delete --stack-name ${APIGW_STACK} --region ${REGION} --profile ${PROFILE}
sam delete --stack-name ${LAYER_STACK} --region ${REGION} --profile ${PROFILE}