Simple project testing out AWS Lambda functions, API Gateway and the Serverless framework. Use url endpoints to perform basic operations on a DynamoDB table.
Install the Serverless framework.
npm install serverless -gRun this command to package up the service and deploy it to AWS servers.
serverless deployUse the curl command to access the database operations at each endpoint. The following database operations are available.
Save a new database item. Requires name and country values.
# Replace `xyz` with the unique id generated by Serverless.
curl -X POST https://xyz.execute-api.us-east-1.amazonaws.com/dev/api --data '{ "name": "Matthew", "country": "USA" }'Return a list of all current database items.
curl https://xyz.execute-api.us-east-1.amazonaws.com/dev/apiFetches a single item from the database.
# Replace <id> with the item's uuid number.
curl https://xyz.execute-api.us-east-1.amazonaws.com/dev/api/<id>Erases an item from the database.
curl -X DELETE https://xyz.execute-api.us-east-1.amazonaws.com/dev/api/<id>- Serverless examples
- Simple HTTP Endpoint
- Serverless Rest API
Excellent documentation on Serverless for AWS deployment found here.