[{"data":1,"prerenderedAt":77},["ShallowReactive",2],{"pattern-apigw-python-cdk-lambda-snapstart":3},{"id":4,"title":5,"architectureURL":6,"cleanup":7,"contributors":10,"deploy":12,"description":19,"extension":20,"framework":21,"gitHub":22,"highlight":6,"introBox":28,"language":35,"level":36,"meta":37,"patternArch":38,"resources":56,"s3URL":6,"services":6,"stem":67,"testing":68,"videoId":6,"__hash__":76},"patterns\u002Fpatterns\u002Fapigw-python-cdk-lambda-snapstart.json","Integrate AWS Lambda SnapStart function with Amazon API Gateway",null,{"text":8},[9],"Delete the stack: \u003Ccode>cdk destroy\u003C\u002Fcode>.",[11],"content\u002Fcontributors\u002Fmatia-rasetina.json",{"text":13},[14,15,16,17,18],"python3 -m venv .venv","source .venv\u002Fbin\u002Factivate","pip install -r requirements.txt","cdk bootstrap","cdk deploy","This pattern demonstrates how to create a REST API using Amazon API Gateway, AWS Lambda with SnapStart, and Amazon DynamoDB.","json","AWS CDK",{"template":23},{"repoURL":24,"templateURL":25,"projectFolder":26,"templateFile":27},"https:\u002F\u002Fgithub.com\u002Faws-samples\u002Fserverless-patterns\u002Ftree\u002Fmain\u002Fapigw-python-cdk-lambda-snapstart","serverless-patterns\u002Fapigw-python-cdk-lambda-snapstart","apigw-python-cdk-lambda-snapstart","app.py",{"headline":29,"text":30},"How it works",[31,32,33,34],"This pattern creates a REST API for managing car records using API Gateway and Lambda with SnapStart enabled.","The Lambda function is Python 3.12-based and includes a live alias that's integrated with API Gateway for seamless deployments.","Lambda SnapStart persists the initialized state of the Lambda runtime, significantly reducing cold start times for function initialization.","DynamoDB stores car records with a partition key of 'id', providing a scalable NoSQL database backend for the REST API.","Python","200",{},{"icon1":39,"icon2":44,"icon3":47,"line1":51,"line2":54},{"x":40,"y":41,"service":42,"label":43},20,50,"apigw","Amazon API Gateway REST API",{"x":41,"y":41,"service":45,"label":46},"lambda","AWS Lambda",{"x":48,"y":41,"service":49,"label":50},80,"dynamodb","Amazon DynamoDB",{"from":52,"to":53},"icon1","icon2",{"from":53,"to":55},"icon3",{"bullets":57},[58,61,64],{"text":59,"link":60},"AWS Lambda SnapStart","https:\u002F\u002Fdocs.aws.amazon.com\u002Flambda\u002Flatest\u002Fdg\u002Fsnapstart.html",{"text":62,"link":63},"API Gateway REST API","https:\u002F\u002Fdocs.aws.amazon.com\u002Fapigateway\u002Flatest\u002Fdeveloperguide\u002Fapigateway-rest-api.html",{"text":65,"link":66},"AWS CDK Python Reference","https:\u002F\u002Fdocs.aws.amazon.com\u002Fcdk\u002Fv2\u002Fguide\u002Fwork-with-cdk-python.html","patterns\u002Fapigw-python-cdk-lambda-snapstart",{"text":69},[70,71,72,73,74,75],"Get the CarEndpoint from stack outputs, then test the endpoint to create a new car record:","curl --location --request POST \"$ENDPOINT\u002Fcars\" --header 'Content-Type: application\u002Fjson' --data-raw '{\"make\":\"Porsche\",\"model\":\"992\",\"year\":\"2022\",\"color\":\"White\"}'","Change the endpoint and HTTP method to test other operations:","GET \u002Fcars\u002F{carId} - Retrieve a car","PUT \u002Fcars\u002F{carId} - Update a car","DELETE \u002Fcars\u002F{carId} - Delete a car","BntBdtF-mZp_b7fsT6dGlwdtNxH52XAmW3eILB1_SDg",1778846882535]