{"id":2488,"date":"2017-01-19T22:05:21","date_gmt":"2017-01-19T22:05:20","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/?p=2488"},"modified":"2023-06-21T05:47:49","modified_gmt":"2023-06-21T12:47:49","slug":"microservice-aws-serverless-application-model-couchbase","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/microservice-aws-serverless-application-model-couchbase\/","title":{"rendered":"Microservice using AWS Serverless Application Model and Couchbase"},"content":{"rendered":"<p>Amazon Web Services introduced <a href=\"https:\/\/aws.amazon.com\/about-aws\/whats-new\/2016\/11\/introducing-the-aws-serverless-application-model\/\">Serverless Application Model<\/a>, or SAM, a couple of months ago. It defines simplified syntax for expressing<br \/>\nserverless resources. SAM extends\u00a0<a href=\"https:\/\/aws.amazon.com\/cloudformation\/\">AWS CloudFormation<\/a>\u00a0to add support for API Gateway, AWS Lambda and Amazon DynamoDB.\u00a0This blog will show how to create a simple microservice using<br \/>\nSAM. Of course, we&#8217;ll use <a href=\"https:\/\/developer.couchbase.com\/server\">Couchbase<\/a> instead of DynamoDB! This blog will also use the basic concepts explained in <a href=\"https:\/\/www.couchbase.com\/blog\/microservice-aws-api-gateway-lambda-couchbase\/\">Microservice using AWS API Gateway,\u00a0AWS Lambda and Couchbase<\/a>.\u00a0SAM<br \/>\nwill show the ease with which the entire stack for microservice can be\u00a0deployed and\u00a0managed.<\/p>\n<p>As a refresher, here are key components in the architecture:<\/p>\n<p><a href=\"\/wp-content\/original-assets\/january-2017\/microservice-aws-serverless-application-model-couchbase\/serverless-microservice-1024x193.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-14518\" src=\"\/wp-content\/original-assets\/january-2017\/microservice-aws-serverless-application-model-couchbase\/serverless-microservice-1024x193.png\" alt=\"serverless-microservice\" width=\"604\" height=\"114\" \/><\/a><\/p>\n<ul>\n<li>Client could be curl, AWS CLI\/Console, Postman client or any other tool\/API that can invoke a REST endpoint.<\/li>\n<li>AWS API Gateway is used to provision APIs. The top level resource is available at path <code>\/books<\/code>.\u00a0HTTP <code>GET<\/code> and <code>POST<\/code> methods are\u00a0published for the resource.<\/li>\n<li>Each API triggers a Lambda function. Two Lambda functions are created,\u00a0<code>book-list<\/code>\u00a0function for listing all the books available and <code>book-create<\/code>\u00a0function to create a new book.<\/li>\n<li>Couchbase is used as a persistence store in EC2. All the\u00a0JSON documents are stored and retrieved from this database.<\/li>\n<\/ul>\n<p>Other blogs on serverless:<\/p>\n<ul>\n<li><a href=\"https:\/\/www.couchbase.com\/blog\/microservice-aws-api-gateway-lambda-couchbase\/\">Microservice using AWS API Gateway, AWS Lambda and Couchbase<\/a><\/li>\n<li><a href=\"https:\/\/www.couchbase.com\/blog\/aws-iot-button-lambda-couchbase\/\">AWS IoT Button, Lambda and Couchbase<\/a><\/li>\n<li><a href=\"https:\/\/www.couchbase.com\/blog\/serverless-faas-aws-lambda-java\/\">Serverless FaaS with Lambda and Java<\/a><\/li>\n<\/ul>\n<p>Let&#8217;s get started!<\/p>\n<h2>Serverless Application Model (SAM) Template<\/h2>\n<p>An AWS CloudFormation template with serverless resources conforming to the <a href=\"https:\/\/github.com\/awslabs\/serverless-application-model\/blob\/master\/versions\/2016-10-31.md\">AWS SAM model<\/a> is referred to as a SAM file or template. It is deployed<br \/>\nas a CloudFormation stack. Let&#8217;s take a look at our SAM template: This template is available at\u00a0<a href=\"https:\/\/github.com\/arun-gupta\/serverless\/blob\/master\/aws\/microservice\/template.yml\">github.com\/arun-gupta\/serverless\/blob\/master\/aws\/microservice\/template.yml<\/a>.<\/p>\n<pre class=\"lang:yaml decode:true\">AWSTemplateFormatVersion : '2010-09-09'\r\nTransform: AWS::Serverless-2016-10-31\r\nDescription: Microservice using API Gateway, Lambda and Couchbase\r\nResources:\r\n  MicroserviceGetAllGateway:\r\n    Type: AWS::Serverless::Function\r\n    Properties:\r\n      Handler: org.sample.serverless.aws.couchbase.gateway.BucketGetAll\r\n      Runtime: java8\r\n      CodeUri: s3:\/\/serverless-microservice\/microservice-http-endpoint-1.0-SNAPSHOT.jar\r\n      Timeout: 30\r\n      MemorySize: 1024\r\n      Environment:\r\n        Variables:\r\n          COUCHBASE_HOST: ec2-35-163-21-104.us-west-2.compute.amazonaws.com\r\n      Role: arn:aws:iam::598307997273:role\/microserviceRole\r\n      Events:\r\n        GetResource:\r\n          Type: Api\r\n          Properties:\r\n            Path: \/books\r\n            Method: get\r\n  MicroservicePostGateway:\r\n    Type: AWS::Serverless::Function\r\n    Properties:\r\n      Handler: org.sample.serverless.aws.couchbase.gateway.BucketPost\r\n      Runtime: java8\r\n      CodeUri: s3:\/\/serverless-microservice\/microservice-http-endpoint-1.0-SNAPSHOT.jar\r\n      Timeout: 30\r\n      MemorySize: 1024\r\n      Environment:\r\n        Variables:\r\n          COUCHBASE_HOST: ec2-35-163-21-104.us-west-2.compute.amazonaws.com\r\n      Role: arn:aws:iam::598307997273:role\/microserviceRole\r\n      Events:\r\n        GetResource:\r\n          Type: Api\r\n          Properties:\r\n            Path: \/books\r\n            Method: post<\/pre>\n<p><a href=\"https:\/\/github.com\/awslabs\/serverless-application-model\/blob\/master\/versions\/2016-10-31.md\">SAM template Specification<\/a>\u00a0provide complete details about contents in the template. The key parts of the template are:<\/p>\n<ul>\n<li>Defines two resources, both of\u00a0Lambda Function type identified by <code>AWS::Serverless::Function<\/code> attribute. Name of the Lambda function is defined by <code>Resources.<\/code>.<\/li>\n<li>Class for each handler is defined by the value of <code>Resources..Properties.Handler<\/code> attribute<\/li>\n<li>Java 8 runtime is used to run the Function defined by <code>Resources..Properties.Runtime<\/code> attribute<\/li>\n<li>Code for the class is uploaded to an S3 bucket, in our case to <code>s3:\/\/serverless-microservice\/microservice-http-endpoint-1.0-SNAPSHOT.jar<\/code><\/li>\n<li><code>Resources..Properties.Environment.Variables.COUCHBASE_HOST<\/code> attribute value defines the host where Couchbase is running. This can be easily deployed on EC2 as explained at <a href=\"https:\/\/github.com\/arun-gupta\/serverless\/tree\/master\/aws\/microservice#setup-couchbase\">Setup Couchbase<\/a>.<\/li>\n<li>Each Lambda function is triggered by an API. It is deployed using AWS API Gateway. The path is defined by <code>Events.GetResource.Properties.Path<\/code>. HTTP method is defined using <code>Events.GetResource.Properties.Method<\/code> attribute.<\/li>\n<\/ul>\n<h2>Java\u00a0Application<\/h2>\n<p>The Java application that contains the Lambda functions is at\u00a0<a href=\"https:\/\/github.com\/arun-gupta\/serverless\/tree\/master\/aws\/microservice\/microservice-http-endpoint\">github.com\/arun-gupta\/serverless\/tree\/master\/aws\/microservice\/microservice-http-endpoint<\/a>.<br \/>\nLambda function that\u00a0is triggered by <code>HTTP GET<\/code>\u00a0method is shown:<\/p>\n<pre class=\"lang:default decode:true\">public class BucketGetAll implements RequestHandler&lt;GatewayRequest, GatewayResponse&gt; {\r\n\r\n    @Override\r\n    public GatewayResponse handleRequest(GatewayRequest request, Context context) {\r\n        try {\r\n            N1qlQuery query = N1qlQuery\r\n                    .simple(select(\"*\")\r\n                            .from(i(CouchbaseUtil.getBucketName()))\r\n                            .limit(10));\r\n\r\n            String result = CouchbaseUtil.getBucket().query(query).allRows().toString();\r\n\r\n            return new GatewayResponse(200, result, GatewayResponse.HEADERS_JSON);\r\n        } catch (ConfigurationException e) {\r\n            return new GatewayResponse(400, e.getMessage(), GatewayResponse.HEADERS_TEXT);\r\n        }\r\n    }\r\n}<\/pre>\n<p>A little bit of explanation:<\/p>\n<ul>\n<li>Each Lambda function needs to implement the interface\u00a0<code>com.amazonaws.services.lambda.runtime.RequestHandler<\/code>.<\/li>\n<li>API Gateway and Lambda\u00a0integration\u00a0require a specific <a href=\"https:\/\/docs.aws.amazon.com\/apigateway\/latest\/developerguide\/api-gateway-set-up-simple-proxy.html#api-gateway-simple-proxy-for-lambda-input-format\">input format<\/a> and <a href=\"https:\/\/docs.aws.amazon.com\/apigateway\/latest\/developerguide\/api-gateway-set-up-simple-proxy.html#api-gateway-simple-proxy-for-lambda-output-format\">output format<\/a>.<br \/>\nThese formats are\u00a0defined as <code><a href=\"https:\/\/github.com\/arun-gupta\/serverless\/blob\/master\/aws\/microservice\/microservice-http-endpoint\/src\/main\/java\/org\/sample\/serverless\/aws\/couchbase\/gateway\/GatewayRequest.java\">GatewayRequest<\/a><\/code> and <code><a href=\"https:\/\/github.com\/arun-gupta\/serverless\/blob\/master\/aws\/microservice\/microservice-http-endpoint\/src\/main\/java\/org\/sample\/serverless\/aws\/couchbase\/gateway\/GatewayResponse.java\">GatewayResponse<\/a><\/code> classes.<\/li>\n<li>Function logic uses <a href=\"https:\/\/developer.couchbase.com\/documentation\/server\/current\/sdk\/java\/start-using-sdk.html\">Couchbase Java SDK<\/a>\u00a0to query the Couchbase database. <a href=\"https:\/\/couchbase.com\/n1ql\/\">N1QL<\/a> query is used to query<br \/>\nthe database. The results and exception are then wrapped in <code>GatewayRequest<\/code> and <code>GatewayResponse<\/code>.<\/li>\n<\/ul>\n<p>Lambda function triggered by HTTP POST method is pretty straightforward as well:<\/p>\n<pre class=\"lang:default decode:true\">public class BucketPost implements RequestHandler&lt;GatewayRequest, GatewayResponse&gt; {\r\n\r\n    @Override\r\n    public GatewayResponse handleRequest(GatewayRequest request, Context context) {\r\n\r\n        try {\r\n            JsonDocument document = CouchbaseUtil.getBucket().upsert(Book.fromStringToJson(request.getBody()));\r\n            return new GatewayResponse(200, document.content().toString(), GatewayResponse.HEADERS_JSON);\r\n        } catch (Exception ex) {\r\n            return new GatewayResponse(400, ex.getMessage(), GatewayResponse.HEADERS_TEXT);\r\n        }\r\n    }\r\n}<\/pre>\n<p>A bit of explanation:<\/p>\n<ul>\n<li>Incoming request payload is retrieved from <code>GatewayRequest<\/code><\/li>\n<li>Document inserted in Couchbase is returned as response.<\/li>\n<li>Like the previous method,\u00a0Function logic uses <a href=\"https:\/\/developer.couchbase.com\/documentation\/server\/current\/sdk\/java\/start-using-sdk.html\">Couchbase Java SDK<\/a>\u00a0to query the Couchbase database. The results and exception are then<br \/>\nwrapped in <code>GatewayRequest<\/code> and <code>GatewayResponse<\/code>.<\/li>\n<\/ul>\n<p>Build the Java application as:<\/p>\n<pre class=\"lang:default decode:true\">mvn -f microservice-http-endpoint\/pom.xml clean package<\/pre>\n<h2>Upload Lambda Function to S3<\/h2>\n<p>SAM template reads the code from an S3 bucket. Let&#8217;s create a S3 bucket:<\/p>\n<pre class=\"lang:default decode:true\">aws s3 mb s3:\/\/serverless-microservice --region us-west-2<\/pre>\n<p><code>us-west-2<\/code> region is one of the <a href=\"https:\/\/aws.amazon.com\/about-aws\/global-infrastructure\/regional-product-services\/\">supported regions for API Gateway<\/a>. S3 bucket names are globally unique but their location is region specific. Upload<br \/>\nthe code to S3 bucket:<\/p>\n<pre class=\"lang:default decode:true\">aws s3 cp microservice-http-endpoint\/target\/microservice-http-endpoint-1.0-SNAPSHOT.jar s3:\/\/serverless-microservice\/microservice-http-endpoint-1.0-SNAPSHOT.jar<\/pre>\n<p>The code is now uploaded to S3 bucket. SAM template is ready to be deployed!<\/p>\n<h2>Deploy SAM Template<\/h2>\n<p>Deploy the SAM template:<\/p>\n<pre class=\"lang:default decode:true\">aws cloudformation deploy \r\n--template-file template.yml \r\n--stack-name microservice-gateway \r\n--region us-west-2<\/pre>\n<p>It shows the output:<\/p>\n<pre class=\"lang:default decode:true\">Waiting for changeset to be created..\r\nWaiting for stack create\/update to complete\r\nSuccessfully created\/updated stack - microservice-gateway<\/pre>\n<p>This\u00a0one command deploys Lambda functions\u00a0and REST Resource\/APIs that trigger these Lambda functions.<\/p>\n<h2>Invoke the Microservice<\/h2>\n<p>API Gateway publishes a REST API that can be invoked by curl, wget, AWS CLI\/Console, Postman or any other app that can call a REST API. This blog will use AWS Console to show the interaction. API Gateway home at\u00a0<a href=\"https:\/\/us-west-2.console.aws.amazon.com\/apigateway\/home?region=us-west-2#\/apis\">us-west-2.console.aws.amazon.com\/apigateway\/home?region=us-west-2#\/apis<\/a> shows:<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-14532\" src=\"\/wp-content\/original-assets\/january-2017\/microservice-aws-serverless-application-model-couchbase\/aws-sam-microservice-api.png\" alt=\"AWS SAM Microservice API\" width=\"604\" height=\"331\" \/><br \/>\nClick on the API to see all the APIs in this resource:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-14538\" src=\"\/wp-content\/original-assets\/january-2017\/microservice-aws-serverless-application-model-couchbase\/aws-sam-microservice-api-resources.png\" alt=\"AWS SAM Microservice API Resources\" width=\"604\" height=\"362\" \/><\/p>\n<p>Click on POST to see the default page for POST method execution:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-14535\" src=\"\/wp-content\/original-assets\/january-2017\/microservice-aws-serverless-application-model-couchbase\/aws-sam-microservice-api-post-1024x492.png\" alt=\"AWS SAM Microservice API POST\" width=\"604\" height=\"290\" \/><\/p>\n<p>Click on Test to test the API:<\/p>\n<p><a href=\"\/wp-content\/original-assets\/january-2017\/microservice-aws-serverless-application-model-couchbase\/aws-sam-microservice-api-post-input.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-14531\" src=\"\/wp-content\/original-assets\/january-2017\/microservice-aws-serverless-application-model-couchbase\/aws-sam-microservice-api-post-input.png\" alt=\"AWS SAM Microservice API POST Input\" width=\"611\" height=\"969\" \/><\/a><\/p>\n<p>Add the payload in Request Body and click on <code>Test<\/code> to invoke\u00a0the API. The results are shown as below:<\/p>\n<p><a href=\"\/wp-content\/original-assets\/january-2017\/microservice-aws-serverless-application-model-couchbase\/aws-sam-microservice-api-post-output.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-14534\" src=\"\/wp-content\/original-assets\/january-2017\/microservice-aws-serverless-application-model-couchbase\/aws-sam-microservice-api-post-output.png\" alt=\"AWS SAM Microservice API POST Output\" width=\"604\" height=\"568\" \/><\/a><\/p>\n<p>Now\u00a0click on GET to see the default execution page:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-14536\" src=\"\/wp-content\/original-assets\/january-2017\/microservice-aws-serverless-application-model-couchbase\/aws-sam-microservice-api-get-1024x570.png\" alt=\"AWS SAM Microservice API GET\" width=\"604\" height=\"336\" \/><\/p>\n<p>Click on Test to test\u00a0the API:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-14537\" src=\"\/wp-content\/original-assets\/january-2017\/microservice-aws-serverless-application-model-couchbase\/aws-sam-microservice-api-get-input.png\" alt=\"AWS SAM Microservice API GET Input\" width=\"604\" height=\"713\" \/><\/p>\n<p>No request body is needed, just click on Test the invoke the API.\u00a0The results are as shown:<\/p>\n<p><a href=\"\/wp-content\/original-assets\/january-2017\/microservice-aws-serverless-application-model-couchbase\/aws-sam-microservice-api-get-output.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-14533\" src=\"\/wp-content\/original-assets\/january-2017\/microservice-aws-serverless-application-model-couchbase\/aws-sam-microservice-api-get-output.png\" alt=\"AWS SAM Microservice API GET Output\" width=\"604\" height=\"601\" \/><\/a><\/p>\n<p>Output from the Couchbase database is shown in the Response Body.<\/p>\n<h2>References<\/h2>\n<ul>\n<li><a href=\"https:\/\/docs.aws.amazon.com\/lambda\/latest\/dg\/deploying-lambda-apps.html\">Deploying Lambda-based Applications<\/a><\/li>\n<li><a href=\"https:\/\/martinfowler.com\/articles\/serverless.html\">Serverless Architectures<\/a><\/li>\n<li><a href=\"https:\/\/aws.amazon.com\/api-gateway\/\">AWS API Gateway<\/a><\/li>\n<li><a href=\"https:\/\/docs.aws.amazon.com\/lambda\/latest\/dg\/with-on-demand-https-example-configure-event-source_1.html\">Creating a simple Microservice using Lambda and API Gateway<\/a><\/li>\n<li><a href=\"https:\/\/developer.couchbase.com\/server\">Couchbase Server Docs<\/a><\/li>\n<li><a href=\"https:\/\/www.couchbase.com\/forums\/\">Couchbase Forums<\/a><\/li>\n<li>Follow us at <a href=\"https:\/\/twitter.com\/couchbasedev\">@couchbasedev<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Amazon Web Services introduced Serverless Application Model, or SAM, a couple of months ago. It defines simplified syntax for expressing serverless resources. SAM extends\u00a0AWS CloudFormation\u00a0to add support for API Gateway, AWS Lambda and Amazon DynamoDB.\u00a0This blog will show how to [&hellip;]<\/p>\n","protected":false},"author":58,"featured_media":13873,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[1],"tags":[],"ppma_author":[8933],"class_list":["post-2488","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.2 (Yoast SEO v26.2) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Microservice using serverless Application Model + Couchbase<\/title>\n<meta name=\"description\" content=\"Learn how to create a microservice using AWS Serverless Application Model and Couchbase. SAM helps to ease deployment and management for the entire stack.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.couchbase.com\/blog\/microservice-aws-serverless-application-model-couchbase\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Microservice using AWS Serverless Application Model and Couchbase\" \/>\n<meta property=\"og:description\" content=\"Learn how to create a microservice using AWS Serverless Application Model and Couchbase. SAM helps to ease deployment and management for the entire stack.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/microservice-aws-serverless-application-model-couchbase\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:published_time\" content=\"2017-01-19T22:05:20+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-06-21T12:47:49+00:00\" \/>\n<meta name=\"author\" content=\"Arun Gupta, VP, Developer Advocacy, Couchbase\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@arungupta\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Arun Gupta, VP, Developer Advocacy, Couchbase\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/microservice-aws-serverless-application-model-couchbase\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/microservice-aws-serverless-application-model-couchbase\/\"},\"author\":{\"name\":\"Arun Gupta, VP, Developer Advocacy, Couchbase\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/39d8caed0f536489b6aa6e8d31ee631f\"},\"headline\":\"Microservice using AWS Serverless Application Model and Couchbase\",\"datePublished\":\"2017-01-19T22:05:20+00:00\",\"dateModified\":\"2023-06-21T12:47:49+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/microservice-aws-serverless-application-model-couchbase\/\"},\"wordCount\":826,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/microservice-aws-serverless-application-model-couchbase\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/microservice-aws-serverless-application-model-couchbase\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/microservice-aws-serverless-application-model-couchbase\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/microservice-aws-serverless-application-model-couchbase\/\",\"name\":\"Microservice using serverless Application Model + Couchbase\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/microservice-aws-serverless-application-model-couchbase\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/microservice-aws-serverless-application-model-couchbase\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"datePublished\":\"2017-01-19T22:05:20+00:00\",\"dateModified\":\"2023-06-21T12:47:49+00:00\",\"description\":\"Learn how to create a microservice using AWS Serverless Application Model and Couchbase. SAM helps to ease deployment and management for the entire stack.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/microservice-aws-serverless-application-model-couchbase\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/microservice-aws-serverless-application-model-couchbase\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/microservice-aws-serverless-application-model-couchbase\/#primaryimage\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"width\":1800,\"height\":630},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/microservice-aws-serverless-application-model-couchbase\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.couchbase.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Microservice using AWS Serverless Application Model and Couchbase\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"name\":\"The Couchbase Blog\",\"description\":\"Couchbase, the NoSQL Database\",\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\",\"name\":\"The Couchbase Blog\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"width\":218,\"height\":34,\"caption\":\"The Couchbase Blog\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/39d8caed0f536489b6aa6e8d31ee631f\",\"name\":\"Arun Gupta, VP, Developer Advocacy, Couchbase\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/8900a75409c646948fe0bd80f6240337\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/f912e10b5f39748ee4f1a0b0da6f42747f0b3a94fe7acb511791468656f5e726?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/f912e10b5f39748ee4f1a0b0da6f42747f0b3a94fe7acb511791468656f5e726?s=96&d=mm&r=g\",\"caption\":\"Arun Gupta, VP, Developer Advocacy, Couchbase\"},\"description\":\"Arun Gupta is the vice president of developer advocacy at Couchbase. He has built and led developer communities for 10+ years at Sun, Oracle, and Red Hat. He has deep expertise in leading cross-functional teams to develop and execute strategy, planning and execution of content, marketing campaigns, and programs. Prior to that he led engineering teams at Sun and is a founding member of the Java EE team. Gupta has authored more than 2,000 blog posts on technology. He has extensive speaking experience in more than 40 countries on myriad topics and is a JavaOne Rock Star for three years in a row. Gupta also founded the Devoxx4Kids chapter in the US and continues to promote technology education among children. An author of several books on technology, an avid runner, a globe trotter, a Java Champion, a JUG leader, NetBeans Dream Team member, and a Docker Captain, he is easily accessible at @arungupta.\",\"sameAs\":[\"https:\/\/x.com\/arungupta\"],\"url\":\"https:\/\/www.couchbase.com\/blog\/author\/arun-gupta\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Microservice using serverless Application Model + Couchbase","description":"Learn how to create a microservice using AWS Serverless Application Model and Couchbase. SAM helps to ease deployment and management for the entire stack.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.couchbase.com\/blog\/microservice-aws-serverless-application-model-couchbase\/","og_locale":"en_US","og_type":"article","og_title":"Microservice using AWS Serverless Application Model and Couchbase","og_description":"Learn how to create a microservice using AWS Serverless Application Model and Couchbase. SAM helps to ease deployment and management for the entire stack.","og_url":"https:\/\/www.couchbase.com\/blog\/microservice-aws-serverless-application-model-couchbase\/","og_site_name":"The Couchbase Blog","article_published_time":"2017-01-19T22:05:20+00:00","article_modified_time":"2023-06-21T12:47:49+00:00","author":"Arun Gupta, VP, Developer Advocacy, Couchbase","twitter_card":"summary_large_image","twitter_creator":"@arungupta","twitter_misc":{"Written by":"Arun Gupta, VP, Developer Advocacy, Couchbase","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.couchbase.com\/blog\/microservice-aws-serverless-application-model-couchbase\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/microservice-aws-serverless-application-model-couchbase\/"},"author":{"name":"Arun Gupta, VP, Developer Advocacy, Couchbase","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/39d8caed0f536489b6aa6e8d31ee631f"},"headline":"Microservice using AWS Serverless Application Model and Couchbase","datePublished":"2017-01-19T22:05:20+00:00","dateModified":"2023-06-21T12:47:49+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/microservice-aws-serverless-application-model-couchbase\/"},"wordCount":826,"commentCount":0,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/microservice-aws-serverless-application-model-couchbase\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/microservice-aws-serverless-application-model-couchbase\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/microservice-aws-serverless-application-model-couchbase\/","url":"https:\/\/www.couchbase.com\/blog\/microservice-aws-serverless-application-model-couchbase\/","name":"Microservice using serverless Application Model + Couchbase","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/microservice-aws-serverless-application-model-couchbase\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/microservice-aws-serverless-application-model-couchbase\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","datePublished":"2017-01-19T22:05:20+00:00","dateModified":"2023-06-21T12:47:49+00:00","description":"Learn how to create a microservice using AWS Serverless Application Model and Couchbase. SAM helps to ease deployment and management for the entire stack.","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/microservice-aws-serverless-application-model-couchbase\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/microservice-aws-serverless-application-model-couchbase\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/microservice-aws-serverless-application-model-couchbase\/#primaryimage","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","width":1800,"height":630},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/blog\/microservice-aws-serverless-application-model-couchbase\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Microservice using AWS Serverless Application Model and Couchbase"}]},{"@type":"WebSite","@id":"https:\/\/www.couchbase.com\/blog\/#website","url":"https:\/\/www.couchbase.com\/blog\/","name":"The Couchbase Blog","description":"Couchbase, the NoSQL Database","publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/blog\/#organization","name":"The Couchbase Blog","url":"https:\/\/www.couchbase.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","width":218,"height":34,"caption":"The Couchbase Blog"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/39d8caed0f536489b6aa6e8d31ee631f","name":"Arun Gupta, VP, Developer Advocacy, Couchbase","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/8900a75409c646948fe0bd80f6240337","url":"https:\/\/secure.gravatar.com\/avatar\/f912e10b5f39748ee4f1a0b0da6f42747f0b3a94fe7acb511791468656f5e726?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f912e10b5f39748ee4f1a0b0da6f42747f0b3a94fe7acb511791468656f5e726?s=96&d=mm&r=g","caption":"Arun Gupta, VP, Developer Advocacy, Couchbase"},"description":"Arun Gupta is the vice president of developer advocacy at Couchbase. He has built and led developer communities for 10+ years at Sun, Oracle, and Red Hat. He has deep expertise in leading cross-functional teams to develop and execute strategy, planning and execution of content, marketing campaigns, and programs. Prior to that he led engineering teams at Sun and is a founding member of the Java EE team. Gupta has authored more than 2,000 blog posts on technology. He has extensive speaking experience in more than 40 countries on myriad topics and is a JavaOne Rock Star for three years in a row. Gupta also founded the Devoxx4Kids chapter in the US and continues to promote technology education among children. An author of several books on technology, an avid runner, a globe trotter, a Java Champion, a JUG leader, NetBeans Dream Team member, and a Docker Captain, he is easily accessible at @arungupta.","sameAs":["https:\/\/x.com\/arungupta"],"url":"https:\/\/www.couchbase.com\/blog\/author\/arun-gupta\/"}]}},"authors":[{"term_id":8933,"user_id":58,"is_guest":0,"slug":"arun-gupta","display_name":"Arun Gupta, VP, Developer Advocacy, Couchbase","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/f912e10b5f39748ee4f1a0b0da6f42747f0b3a94fe7acb511791468656f5e726?s=96&d=mm&r=g","author_category":"","last_name":"Gupta","first_name":"Arun","job_title":"","user_url":"","description":"Arun Gupta is the vice president of developer advocacy at Couchbase. He has built and led developer communities for 10+ years at Sun, Oracle, and Red Hat. He has deep expertise in leading cross-functional teams to develop and execute strategy, planning and execution of content, marketing campaigns, and programs. Prior to that he led engineering teams at Sun and is a founding member of the Java EE team.\r\n\r\nGupta has authored more than 2,000 blog posts on technology. He has extensive speaking experience in more than 40 countries on myriad topics and is a JavaOne Rock Star for three years in a row. Gupta also founded the Devoxx4Kids chapter in the US and continues to promote technology education among children. An author of several books on technology, an avid runner, a globe trotter, a Java Champion, a JUG leader, NetBeans Dream Team member, and a Docker Captain, he is easily accessible at @arungupta."}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/2488","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/users\/58"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/comments?post=2488"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/2488\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media\/13873"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media?parent=2488"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/categories?post=2488"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/tags?post=2488"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=2488"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}