- Language:
- Python
- Framework:
- AWS CDK
Download this pattern (.zip)
View this pattern on GitHub
Clone repo
git clone https://github.com/aws-samples/serverless-patterns/cd serverless-patterns/apigw-python-cdk-lambda-snapstart
Deploy
python3 -m venv .venvsource .venv/bin/activatepip install -r requirements.txtcdk bootstrapcdk deploy
Testing
Get the CarEndpoint from stack outputs, then test the endpoint to create a new car record:
curl --location --request POST "$ENDPOINT/cars" --header 'Content-Type: application/json' --data-raw '{"make":"Porsche","model":"992","year":"2022","color":"White"}'
Change the endpoint and HTTP method to test other operations:
GET /cars/{carId} - Retrieve a car
PUT /cars/{carId} - Update a car
DELETE /cars/{carId} - Delete a car
Cleanup
Delete the stack: cdk destroy.