Company
Date Published
Author
Arun Gupta, VP, Developer Advocacy, Couchbase
Word count
1090
Language
English
Hacker News points
None

Summary

Amazon Web Services (AWS) introduced the Serverless Application Model (SAM) to simplify the creation and management of serverless resources by extending AWS CloudFormation to support API Gateway, AWS Lambda, and Amazon DynamoDB. This blog post describes how to create a microservice using SAM, substituting Couchbase for DynamoDB, and demonstrates the ease of deploying and managing an entire microservice stack. The architecture involves using AWS API Gateway to provision APIs, with HTTP GET and POST methods available at the path /books, each triggering a respective Lambda function to list or create books. The microservice uses Couchbase as a persistence store, with JSON documents stored and retrieved from this database, and the functions are implemented using Java 8, utilizing Couchbase Java SDK for database interactions. The SAM template, which defines the serverless resources, is deployed as a CloudFormation stack, with the code uploaded to an S3 bucket. The post also provides a walkthrough of deploying the SAM template, followed by testing the deployed API using the AWS Console to invoke the REST API published by API Gateway.