- Create a REST API and resources (paths)
- Add methods (GET, POST, PATCH/PUT, DELETE)
- Integrate methods with Lambda functions (using Lambda proxy integration)
- Deploy and invoke the API

cars), choose the endpoint type (Regional), and click Create API.

/cars resource — this will be the base path clients call. You can enable CORS here if your clients require cross-origin access; for this demo it’s left unchecked. Click Create Resource.

/cars to Lambda functions. First, review the read-only Lambda that returns a static list of cars.

get-cars Lambda (returns a fixed list):
GET method on the /cars resource and integrate it with the Get-cars Lambda function. When creating the integration, enable Lambda proxy integration (recommended) so the Lambda receives the full request event (headers, pathParameters, queryStringParameters, body, etc.). The API Gateway console usually adds the necessary invoke permission on the Lambda automatically. If you configure integrations manually or with Infrastructure as Code, remember to grant API Gateway permission to invoke the function (lambda:AddPermission).

development) via Deploy API and add an optional description.

https://q2ns69dn0b.execute-api.us-east-1.amazonaws.com/development
To call the GET method for our cars list:
https://q2ns69dn0b.execute-api.us-east-1.amazonaws.com/development/cars
When using Lambda proxy integration, API Gateway builds the HTTP response from the Lambda’s return object. For the get-cars handler above, the Lambda returns:
body as the HTTP response body to the client (clients should parse that JSON).
Next, add the remaining CRUD endpoints. This demo includes Lambda functions: create-car, update-cars, and delete-car.

POST method on /cars and integrate it with the create-car Lambda. After adding the method, deploy the API again.

create-car Lambda that echoes the created car and returns a 201:
If your Lambda code calls
JSON.parse(event.body) and you get a SyntaxError complaining about “Unexpected token u”, that usually means event.body is undefined. This typically happens when API Gateway is not passing the request body—enable Lambda proxy integration and redeploy the API so the full request event is forwarded to your function.event object containing body, headers, pathParameters, queryStringParameters, etc.
A successful response for the POST above might be:
Request body:
/cars create a new resource named {id} (enter {id} into the console resource name). This creates a variable path segment accessible in Lambda as event.pathParameters.id.

/cars/{id} create a PATCH (or PUT) method and integrate it with the update-cars Lambda. Enable proxy integration so body and pathParameters are forwarded. Deploy the API after creating the method.
Example update-cars handler:
PATCH https://q2ns69dn0b.execute-api.us-east-1.amazonaws.com/development/cars/5 with a JSON body you can also log or return the entire event to see what API Gateway supplies. A typical event includes keys such as resource, path, httpMethod, headers, pathParameters, queryStringParameters, body, and requestContext.
Example event (abridged):
DELETE method on /cars/{id} and integrating it with the delete-car Lambda. The console panel to create the DELETE method and choose Lambda integration is shown below.

- Create an API and define resources (for example,
/carsand/cars/{id}) - Add methods (GET/POST/PATCH/DELETE) and set Lambda integration
- Prefer Lambda proxy integration to receive the full event (
body,pathParameters,headers, etc.) - Deploy the API to a stage after each change
- Test GET in a browser, and use curl/Postman for POST, PATCH, DELETE
Links and references
- API Gateway REST APIs (AWS Docs)
- Lambda function handler in Node.js (AWS Docs)
- Granting API Gateway permission to invoke a Lambda function (
lambda:AddPermission)
If you configure integrations via IaC or the CLI, remember to add the Lambda permission that allows API Gateway to invoke the function. Without it you’ll receive 500/403 errors when the method is invoked.