Create a simple API using AWS Lambda (Node/TypeScript) + AWS DynamoDb OR Node/MongoDb to create then retrieve a vehicle record. Be creative in what data is stored but we want to see the API allowing someone to save a vehicle record, then retrieve it from the database. Consider validation and unit testing.The AWS free tier should make this a no cost process if available in your region.
by vehicle record we simply mean a database entry about a vehicle i.e.
Make: Ford
Model FiestaReg: AB22 ABC
RegistrationDate: 23/12/22Create/Read/ and possibly Update/Delete via an API.
REST API Development using AWS CDK, TypeScript, AWS Serverless, API Gateway with Custom Authorizer and CI/CD Pipelines with DynamoDB data storage
The aim of this project is to develop a REST API for saving cars with various attributes. This API will be built using AWS CDK, TypeScript, AWS Serverless, API Gateway with Custom Authorizer and CI/CD Pipelines with DynamoDB data storage. The API will provide endpoints for GET, POST, PUT and DELETE operations.
Zod is used for request validation and Jest as a testing library.
The following attributes will be saved for each car:
- Registration number
- Dealer
- Make
- Model
- Year
- Color
- Price
- Mileage
- Description
- RegisteredAt
- Status
- UpdatedAt
The following data access patterns will be considered while planning the API:
- Get car details by Registration number
- Get cars in the database in the order of created date
- Get cars of a particular dealer
- Get cars in the database of make and model
- Get cars which have registration date in a particular range
- Get cars which has make, model and price-wise sorting
- GET /cars: Search cars we can provide dealer, make, model, registeredAfter, registeredBefore, limit, nextPageOffset, sortBy as parameters
- GET /cars/{id}: Get a specific car details
- POST /cars: Create a new car to the inventory
- PUT /cars/{id}: Update an existing car inventory
- DELETE /cars/{id}: Delete a specific car
All endpoints except GET /cars are secured using the token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
. This token will be added as an Authorization header.
The CI/CD pipeline will be set up to automatically fetch the code from the CodeCommit repository and deploy it using AWS CDK.
The REST API for car inventory management will be developed using AWS CDK, TypeScript, AWS Serverless, API Gateway with Custom Authorizer and CI/CD Pipelines. The API will provide various endpoints for GET, POST, PUT and DELETE operations to manage cars. The data will be stored in DynamoDB with proper data access patterns. The endpoints will be secured using a custom authorizer and CI/CD pipelines will be set up for automatic deployment.
npm run build
compile typescript to jsnpm run watch
watch for changes and compilenpm run test
perform the jest unit testscdk deploy
deploy this stack to your default AWS account/regioncdk diff
compare deployed stack with current statecdk synth
emits the synthesized CloudFormation template