{"id":2468,"date":"2017-01-18T23:08:04","date_gmt":"2017-01-18T23:08:03","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/?p=2468"},"modified":"2023-06-21T05:51:56","modified_gmt":"2023-06-21T12:51:56","slug":"microservice-aws-api-gateway-lambda-couchbase","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/microservice-aws-api-gateway-lambda-couchbase\/","title":{"rendered":"Microservice using AWS API Gateway, AWS Lambda and Couchbase"},"content":{"rendered":"<p><a href=\"https:\/\/www.couchbase.com\/blog\/author\/arun-gupta\/\">This blog<\/a> has\u00a0explained the following concepts\u00a0for serverless applications so far:<\/p>\n<ul>\n<li><a href=\"https:\/\/www.couchbase.com\/blog\/serverless-faas-aws-lambda-java\/\">Serverless FaaS with AWS Lambda and Java<\/a><\/li>\n<li><a href=\"https:\/\/www.couchbase.com\/blog\/serverless-faas-aws-lambda-java\/\">AWS IoT Button, Lambda and Couchbase<\/a><\/li>\n<\/ul>\n<p>The third blog in serverless series will explain\u00a0how to create a simple microservice using Amazon API Gateway, AWS Lambda and\u00a0<a href=\"https:\/\/developer.couchbase.com\/server\">Couchbase<\/a>. Read <a href=\"https:\/\/www.couchbase.com\/blog\/serverless-faas-aws-lambda-java\/\">previous blogs<\/a> for more context on AWS Lambda. <a href=\"https:\/\/aws.amazon.com\/api-gateway\/\">Amazon API Gateway<\/a> is a fully managed service that makes it easy for developers to create, publish, maintain, monitor, and secure APIs at any scale. Amazon API Gateway handles all the tasks involved in accepting and processing up to hundreds of thousands of concurrent API calls, including traffic management, authorization and access control, monitoring, and API version management. Here are the key components in this architecture:<br \/>\n<a href=\"\/wp-content\/original-assets\/december-2016\/microservice-using-aws-api-gateway-aws-lambda-and-couchbase\/serverless-microservice-1024x193.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-14518\" src=\"\/wp-content\/original-assets\/december-2016\/microservice-using-aws-api-gateway-aws-lambda-and-couchbase\/serverless-microservice-1024x193.png\" alt=\"serverless-microservice\" width=\"604\" height=\"114\" \/><\/a><\/p>\n<ul>\n<li>Client could be curl, AWS CLI, Postman client or any other tool\/API that can invoke a REST endpoint.<\/li>\n<li>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>Let&#8217;s get started!<\/p>\n<h2>Create IAM\u00a0Role<\/h2>\n<p>IAM roles will have policies and trust relationships that will allow this role to be used in API Gateway and execute Lambda function. Let&#8217;s create a new IAM role:<\/p>\n<pre class=\"lang:default decode:true\">aws iam create-role \r\n--role-name microserviceRole \r\n--assume-role-policy-document file:\/\/.\/trust.json<\/pre>\n<p><code>--assume-role-policy-document<\/code> defines the trust relationship policy document that grants an entity permission to assume the role. <code>trust.json<\/code> is at\u00a0<a href=\"https:\/\/github.com\/arun-gupta\/serverless\/blob\/master\/aws\/microservice\/trust.json\">github.com\/arun-gupta\/serverless\/blob\/master\/aws\/microservice\/trust.json<\/a>\u00a0and looks like:<\/p>\n<pre class=\"lang:default decode:true\">{\r\n  \"Version\": \"2012-10-17\",\r\n  \"Statement\": [\r\n    {\r\n      \"Sid\": \"\",\r\n      \"Effect\": \"Allow\",\r\n      \"Principal\": {\r\n        \"Service\": [\r\n          \"lambda.amazonaws.com\",\r\n          \"apigateway.amazonaws.com\"\r\n        ]\r\n      },\r\n      \"Action\": \"sts:AssumeRole\"\r\n    }\r\n  ]\r\n}<\/pre>\n<p>This trust relationship\u00a0allows Lambda functions and API Gateway to assume this role\u00a0during execution. Associate\u00a0policies\u00a0with this role as:<\/p>\n<pre class=\"lang:default decode:true\">aws iam put-role-policy \r\n--role-name microserviceRole \r\n--policy-name microPolicy \r\n--policy-document file:\/\/.\/policy.json<\/pre>\n<p><code>policy.json<\/code> is at\u00a0<a href=\"https:\/\/github.com\/arun-gupta\/serverless\/blob\/master\/aws\/microservice\/policy.json\">github.com\/arun-gupta\/serverless\/blob\/master\/aws\/microservice\/policy.json<\/a> and looks like:<\/p>\n<pre class=\"lang:default decode:true\">{\r\n  \"Version\": \"2012-10-17\",\r\n  \"Statement\": [\r\n    {\r\n      \"Effect\": \"Allow\",\r\n      \"Action\": [\r\n        \"logs:*\"\r\n      ],\r\n      \"Resource\": \"arn:aws:logs:*:*:*\"\r\n    },\r\n    {\r\n      \"Effect\": \"Allow\",\r\n      \"Action\": [\r\n        \"apigateway:*\"\r\n      ],\r\n      \"Resource\": \"arn:aws:apigateway:*::\/*\"\r\n    },\r\n    {\r\n      \"Effect\": \"Allow\",\r\n      \"Action\": [\r\n        \"execute-api:Invoke\"\r\n      ],\r\n      \"Resource\": \"arn:aws:execute-api:*:*:*\"\r\n    },\r\n    {\r\n      \"Effect\": \"Allow\",\r\n      \"Action\": [\r\n          \"lambda:*\"\r\n      ],\r\n      \"Resource\": \"*\"\r\n    }\r\n  ]\r\n}<\/pre>\n<p>This generous policy allows any permissions over logs generated in CloudWatch for all resources. In addition it allows\u00a0all Lambda\u00a0and API Gateway permissions to all resources. In general, only required\u00a0policy would be\u00a0given to specific resources.<\/p>\n<h2>Create Lambda Functions<\/h2>\n<p>Detailed steps to create Lambda functions are explained in <a href=\"https:\/\/www.couchbase.com\/blog\/serverless-faas-aws-lambda-java\/\">Serverless FaaS with AWS Lambda and Java<\/a>. Let&#8217;s create the two Lambda functions as required in our case:<\/p>\n<pre class=\"lang:default decode:true\">aws lambda create-function \r\n--function-name MicroserviceGetAll \r\n--role arn:aws:iam::598307997273:role\/microserviceRole \r\n--handler org.sample.serverless.aws.couchbase.BucketGetAll \r\n--zip-file fileb:\/\/\/Users\/arungupta\/workspaces\/serverless\/aws\/microservice\/microservice-http-endpoint\/target\/microservice-http-endpoint-1.0-SNAPSHOT.jar \r\n--description \"Microservice HTTP Endpoint - Get All\" \r\n--runtime java8 \r\n--region us-west-1 \r\n--timeout 30 \r\n--memory-size 1024 \r\n--environment Variables={COUCHBASE_HOST=ec2-52-53-193-176.us-west-1.compute.amazonaws.com} \r\n--publish<\/pre>\n<p>Couple of\u00a0key items to note in this function are:<\/p>\n<ul>\n<li>IAM role\u00a0<code>microserviceRole<\/code> created in previous step is explicitly specified here<\/li>\n<li>Handler is\u00a0<code>org.sample.serverless.aws.couchbase.BucketGetAll<\/code> class. This class queries the Couchbase database defined using the <code>COUCHBASE_HOST<\/code> environment variable.<\/li>\n<\/ul>\n<p>Create the second Lambda function:<\/p>\n<pre class=\"lang:default decode:true\">aws lambda create-function \r\n--function-name MicroservicePost \r\n--role arn:aws:iam::598307997273:role\/microserviceRole \r\n--handler org.sample.serverless.aws.couchbase.BucketPost \r\n--zip-file fileb:\/\/\/Users\/arungupta\/workspaces\/serverless\/aws\/microservice\/microservice-http-endpoint\/target\/microservice-http-endpoint-1.0-SNAPSHOT.jar \r\n--description \"Microservice HTTP Endpoint - Post\" \r\n--runtime java8 \r\n--region us-west-1 \r\n--timeout 30 \r\n--memory-size 1024 \r\n--environment Variables={COUCHBASE_HOST=ec2-52-53-193-176.us-west-1.compute.amazonaws.com} \r\n--publish<\/pre>\n<p>The handler for this function is <code>org.sample.serverless.aws.couchbase.BucketPost<\/code> class. This class creates a new JSON\u00a0document in the Couchbase database\u00a0identified by <code>COUCHBASE_HOST<\/code> environment variable. The\u00a0complete source code for these classes 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>.<\/p>\n<h2>API Gateway Resource<\/h2>\n<p><a href=\"https:\/\/docs.aws.amazon.com\/lambda\/latest\/dg\/with-on-demand-https-example-configure-event-source.html\">Create an API using Amazon API Gateway and Test It<\/a> and\u00a0<a href=\"https:\/\/docs.aws.amazon.com\/apigateway\/latest\/developerguide\/getting-started.html\">Build an API to Expose a Lambda Function<\/a>\u00a0provide detailed steps and explanation on how to use API Gateway and Lambda Functions to build powerful backend systems. This blog will do a quick run down of the steps in case you want to cut the chase. Let&#8217;s create API Gateway resources.<\/p>\n<ol>\n<li>The first step is to create an API:\n<pre class=\"lang:default decode:true\">aws apigateway \r\ncreate-rest-api \r\n--name Book<\/pre>\n<p>This shows the output as:<\/p>\n<pre class=\"lang:default decode:true\">{\r\n    \"name\": \"Book\", \r\n    \"id\": \"lb2qgujjif\", \r\n    \"createdDate\": 1482998945\r\n}<\/pre>\n<p>The value of <code>id<\/code> attribute is API ID. In our case, this is\u00a0<code>lb2qgujjif<\/code>.<\/li>\n<li>Find ROOT ID of the created API as this is\u00a0required for the next\u00a0AWS CLI invocation:\n<pre class=\"lang:default decode:true\">aws apigateway get-resources --rest-api-id lb2qgujjif<\/pre>\n<p>This shows the output:<\/p>\n<pre class=\"lang:default decode:true\">{\r\n    \"items\": [\r\n        {\r\n            \"path\": \"\/\", \r\n            \"id\": \"hgxogdkheg\"\r\n        }\r\n    ]\r\n}<\/pre>\n<p>Value of <code>id<\/code> attribute is ROOT ID. This is also the PARENT ID\u00a0for the top level resource.<\/li>\n<li>Create a resource\n<pre class=\"lang:default decode:true\">aws apigateway create-resource \r\n--rest-api-id lb2qgujjif \r\n--parent-id hgxogdkheg \r\n--path-part books<\/pre>\n<p>This shows the output:<\/p>\n<pre class=\"lang:default decode:true\">{\r\n    \"path\": \"\/books\", \r\n    \"pathPart\": \"books\", \r\n    \"id\": \"vrpkod\", \r\n    \"parentId\": \"hgxogdkheg\"\r\n}<\/pre>\n<p>Value of <code>id<\/code> attribute is RESOURCE ID.<\/li>\n<\/ol>\n<p>API ID and RESOURCE ID are used\u00a0for subsequent AWS CLI invocations.<\/p>\n<h2>API\u00a0Gateway POST Method<\/h2>\n<p>Now that the resource is created, let&#8217;s create HTTP <code>POST<\/code> method on this resource.<\/p>\n<ol>\n<li>Create a <code>POST<\/code> method\n<pre class=\"lang:default decode:true\">aws apigateway put-method \r\n--rest-api-id lb2qgujjif \r\n--resource-id vrpkod \r\n--http-method POST \r\n--authorization-type NONE<\/pre>\n<p>to see the response:<\/p>\n<pre class=\"lang:default decode:true\">{\r\n    \"apiKeyRequired\": false, \r\n    \"httpMethod\": \"POST\", \r\n    \"authorizationType\": \"NONE\"\r\n}<\/pre>\n<\/li>\n<li>Set Lambda function as destination of the POST method:\n<pre class=\"lang:default decode:true\">aws apigateway put-integration \r\n--rest-api-id lb2qgujjif \r\n--resource-id vrpkod \r\n--http-method POST \r\n--type AWS \r\n--integration-http-method POST \r\n--uri arn:aws:apigateway:us-west-1:lambda:path\/2015-03-31\/functions\/arn:aws:lambda:us-west-1::function:MicroservicePost\/invocations<\/pre>\n<p>Make sure to replace <code><\/code> with your AWS account id. API ID and RESOURCE ID from previous section are used here as well. <code>--uri<\/code> is used to specify the URI of integration input. The format of the URI is fixed. This CLI will show the result as:<\/p>\n<pre class=\"lang:default decode:true\">{\r\n    \"httpMethod\": \"POST\", \r\n    \"passthroughBehavior\": \"WHEN_NO_MATCH\", \r\n    \"cacheKeyParameters\": [], \r\n    \"type\": \"AWS\", \r\n    \"uri\": \"arn:aws:apigateway:us-west-1:lambda:path\/2015-03-31\/functions\/arn:aws:lambda:us-west-1::function:MicroservicePost\/invocations\", \r\n    \"cacheNamespace\": \"vrpkod\"\r\n}<\/pre>\n<\/li>\n<li>Set <code>content-type<\/code> of POST method response:\n<pre class=\"lang:default decode:true\">aws apigateway put-method-response \r\n--rest-api-id lb2qgujjif \r\n--resource-id vrpkod \r\n--http-method POST \r\n--status-code 200 \r\n--response-models \"{\"application\/json\": \"Empty\"}\"<\/pre>\n<p>to see the response:<\/p>\n<pre class=\"lang:default decode:true\">{\r\n    \"responseModels\": {\r\n        \"application\/json\": \"Empty\"\r\n    }, \r\n    \"statusCode\": \"200\"\r\n}<\/pre>\n<\/li>\n<li>Set <code>content-type<\/code> of POST method integration response:\n<pre class=\"lang:default decode:true\">aws apigateway put-integration-response \r\n--rest-api-id lb2qgujjif \r\n--resource-id vrpkod \r\n--http-method POST \r\n--status-code 200 \r\n--response-templates \"{\"application\/json\": \"Empty\"}\"<\/pre>\n<p>to see the response:<\/p>\n<pre class=\"lang:default decode:true\">{\r\n    \"statusCode\": \"200\", \r\n    \"responseTemplates\": {\r\n        \"application\/json\": \"Empty\"\r\n    }\r\n}<\/pre>\n<\/li>\n<li>Deploy the API\n<pre class=\"lang:default decode:true\">aws apigateway create-deployment \r\n--rest-api-id lb2qgujjif \r\n--stage-name test<\/pre>\n<p>to see the response<\/p>\n<pre class=\"lang:default decode:true\">{\r\n    \"id\": \"9wi991\", \r\n    \"createdDate\": 1482999187\r\n}<\/pre>\n<\/li>\n<li>Grant permission to allow API Gateway to invoke Lambda Function:\n<pre class=\"lang:default decode:true\">aws lambda add-permission \r\n--function-name MicroservicePost \r\n--statement-id apigateway-test-post-1 \r\n--action lambda:InvokeFunction \r\n--principal apigateway.amazonaws.com \r\n--source-arn \"arn:aws:execute-api:us-west-1::lb2qgujjif\/*\/POST\/books\"<\/pre>\n<p>Also, grant permission to the deployed API:<\/p>\n<pre class=\"lang:default decode:true\">aws lambda add-permission \r\n--function-name MicroservicePost \r\n--statement-id apigateway-test-post-2 \r\n--action lambda:InvokeFunction \r\n--principal apigateway.amazonaws.com \r\n--source-arn \"arn:aws:execute-api:us-west-1::lb2qgujjif\/test\/GET\/books\"<\/pre>\n<\/li>\n<li>Test the API method:\n<pre class=\"lang:default decode:true\">aws apigateway test-invoke-method \r\n--rest-api-id lb2qgujjif \r\n--resource-id vrpkod \r\n--http-method POST \r\n--path-with-query-string \"\" \r\n--body \"{\"id\": \"1\", \"bookname\": \"test book\", \"isbn\": \"123\", \"cost\": \"1.23\"}\"<\/pre>\n<p>to see the response:<\/p>\n<pre class=\"lang:default decode:true\">{\r\n    \"status\": 200, \r\n    \"body\": \"Empty\", \r\n    \"log\": \"Execution log for request test-requestnThu Dec 29 08:16:05 UTC 2016 : Starting execution for request: test-invoke-requestnThu Dec 29 08:16:05 UTC 2016 : HTTP Method: POST, Resource Path: \/booksnThu Dec 29 08:16:05 UTC 2016 : Method request path: {}nThu Dec 29 08:16:05 UTC 2016 : Method request query string: {}nThu Dec 29 08:16:05 UTC 2016 : Method request headers: {}nThu Dec 29 08:16:05 UTC 2016 : Method request body before transformations: {\"id\": \"1\", \"bookname\": \"test book\", \"isbn\": \"123\", \"cost\": \"1.23\"}nThu Dec 29 08:16:05 UTC 2016 : Endpoint request URI: https:\/\/lambda.us-west-1.amazonaws.com\/2015-03-31\/functions\/arn:aws:lambda:us-west-1:598307997273:function:MicroservicePost\/invocationsnThu Dec 29 08:16:05 UTC 2016 : Endpoint request headers: {x-amzn-lambda-integration-tag=test-request, Authorization=****************************************************************************************************************************************************************************************************************************************************************************************************************************************c8bb85, X-Amz-Date=20161229T081605Z, x-amzn-apigateway-api-id=lb2qgujjif, X-Amz-Source-Arn=arn:aws:execute-api:us-west-1:598307997273:lb2qgujjif\/null\/POST\/books, Accept=application\/json, User-Agent=AmazonAPIGateway_lb2qgujjif, Host=lambda.us-west-1.amazonaws.com, X-Amz-Content-Sha256=559d0296d96ec5647eef6381602fe5e7f55dd17065864fafb4f581d106aa92f4, X-Amzn-Trace-Id=Root=1-5864c645-8494974a41a3a16c8d2f9929, Content-Type=application\/json}nThu Dec 29 08:16:05 UTC 2016 : Endpoint request body after transformations: {\"id\": \"1\", \"bookname\": \"test book\", \"isbn\": \"123\", \"cost\": \"1.23\"}nThu Dec 29 08:16:10 UTC 2016 : Endpoint response body before transformations: \"{\\\"cost\\\":\\\"1.23\\\",\\\"id\\\":\\\"1\\\",\\\"bookname\\\":\\\"test book\\\",\\\"isbn\\\":\\\"123\\\"}\"nThu Dec 29 08:16:10 UTC 2016 : Endpoint response headers: {x-amzn-Remapped-Content-Length=0, x-amzn-RequestId=0b25323b-cd9f-11e6-8bd4-292925ba63a9, Connection=keep-alive, Content-Length=78, Date=Thu, 29 Dec 2016 08:16:10 GMT, Content-Type=application\/json}nThu Dec 29 08:16:10 UTC 2016 : Method response body after transformations: EmptynThu Dec 29 08:16:10 UTC 2016 : Method response headers: {X-Amzn-Trace-Id=Root=1-5864c645-8494974a41a3a16c8d2f9929, Content-Type=application\/json}nThu Dec 29 08:16:10 UTC 2016 : Successfully completed executionnThu Dec 29 08:16:10 UTC 2016 : Method completed with status: 200n\", \r\n    \"latency\": 5091, \r\n    \"headers\": {\r\n        \"X-Amzn-Trace-Id\": \"Root=1-5864c645-8494974a41a3a16c8d2f9929\", \r\n        \"Content-Type\": \"application\/json\"\r\n    }\r\n}<\/pre>\n<p>Value of <code>status<\/code> attribute is 200 and indicates this was a successful invocation. Value of <code>log<\/code> attribute shows the log statement from CloudWatch Logs. Detailed logs can also be obtained using <code>aws logs filter-log-events --log-group \/aws\/lambda\/MicroservicePost<\/code>.<\/li>\n<li>This command stores a single JSON document in\u00a0Couchbase. This can be easily verified using the <a href=\"https:\/\/developer.couchbase.com\/documentation\/server\/current\/tools\/cbq-shell.html\">Couchbase\u00a0CLI Tool cbq<\/a>.Connect to the Couchbase server as:\n<pre class=\"lang:default decode:true\">cbq -u Administrator -p password -e=\"https:\/\/:8091\"<\/pre>\n<p>Create a primary index on <code>default<\/code> bucket as this is\u00a0required to query the bucket with no clauses:<\/p>\n<pre class=\"lang:default decode:true\">cbq&gt; create primary index default_index on default;\r\n{\r\n    \"requestID\": \"13b539f9-7fff-4386-92f4-cea161a7aa08\",\r\n    \"signature\": null,\r\n    \"results\": [\r\n    ],\r\n    \"status\": \"success\",\r\n    \"metrics\": {\r\n        \"elapsedTime\": \"1.917009047s\",\r\n        \"executionTime\": \"1.916970061s\",\r\n        \"resultCount\": 0,\r\n        \"resultSize\": 0\r\n    }\r\n}<\/pre>\n<\/li>\n<li>Write a <a href=\"https:\/\/www.couchbase.com\/n1ql\/\">N1QL<\/a> query to access the data:\n<pre class=\"lang:default decode:true\">cbq&gt; select * from default limit 10;\r\n{\r\n    \"requestID\": \"d7b1c3f9-6b4e-4952-9a1e-9faf5169926e\",\r\n    \"signature\": {\r\n        \"*\": \"*\"\r\n    },\r\n    \"results\": [\r\n        {\r\n            \"default\": {\r\n                \"bookname\": \"test\",\r\n                \"cost\": \"1.23\",\r\n                \"id\": \"1\",\r\n                \"isbn\": \"123\"\r\n            }\r\n        }\r\n    ],\r\n    \"status\": \"success\",\r\n    \"metrics\": {\r\n        \"elapsedTime\": \"24.337755ms\",\r\n        \"executionTime\": \"24.289796ms\",\r\n        \"resultCount\": 1,\r\n        \"resultSize\": 175\r\n    }\r\n}<\/pre>\n<p>The results show the JSON document that was\u00a0stored by our Lambda function.<\/li>\n<\/ol>\n<h2>API Gateway GET Method<\/h2>\n<p>Let&#8217;s create HTTP <code>GET<\/code> method on the resource:<\/p>\n<ol>\n<li>Create a <code>GET<\/code> method:\n<pre class=\"lang:default decode:true\">aws apigateway put-method \r\n--rest-api-id lb2qgujjif \r\n--resource-id vrpkod \r\n--http-method GET \r\n--authorization-type NONE<\/pre>\n<\/li>\n<li>Set\u00a0correct Lambda function as destination of GET:\n<pre class=\"lang:default decode:true\">aws apigateway put-integration \r\n--rest-api-id lb2qgujjif \r\n--resource-id vrpkod \r\n--http-method GET \r\n--type AWS \r\n--integration-http-method POST \r\n--uri arn:aws:apigateway:us-west-1:lambda:path\/2015-03-31\/functions\/arn:aws:lambda:us-west-1:598307997273:function:MicroserviceGetAll\/invocations<\/pre>\n<\/li>\n<li>Set <code>content-type<\/code> of GET method response:\n<pre class=\"lang:default decode:true\">aws apigateway put-method-response \r\n--rest-api-id lb2qgujjif \r\n--resource-id vrpkod \r\n--http-method GET \r\n--status-code 200 \r\n--response-models \"{\"application\/json\": \"Empty\"}\"<\/pre>\n<\/li>\n<li>Set <code>content-type<\/code> of GET method integration response:\n<pre class=\"lang:default decode:true\">aws apigateway put-integration-response \r\n--rest-api-id lb2qgujjif \r\n--resource-id vrpkod \r\n--http-method GET \r\n--status-code 200 \r\n--response-templates \"{\"application\/json\": \"Empty\"}\"<\/pre>\n<\/li>\n<li>Grant permission to allow API Gateway to invoke Lambda Function\n<pre class=\"lang:default decode:true\">aws lambda add-permission \r\n--function-name MicroserviceGetAll \r\n--statement-id apigateway-test-getall-1 \r\n--action lambda:InvokeFunction \r\n--principal apigateway.amazonaws.com \r\n--source-arn \"arn:aws:execute-api:us-west-1:598307997273:lb2qgujjif\/*\/GET\/books\"<\/pre>\n<\/li>\n<li>Grant permission to the deployed API:\n<pre class=\"lang:default decode:true\">aws lambda add-permission \r\n--function-name MicroserviceGetAll \r\n--statement-id apigateway-test-getall-2 \r\n--action lambda:InvokeFunction \r\n--principal apigateway.amazonaws.com \r\n--source-arn \"arn:aws:execute-api:us-west-1:598307997273:lb2qgujjif\/test\/GET\/books\"<\/pre>\n<\/li>\n<li>Test the method:\n<pre class=\"lang:default decode:true\">aws apigateway test-invoke-method \r\n--rest-api-id lb2qgujjif \r\n--resource-id vrpkod \r\n--http-method GET<\/pre>\n<p>to see the output:<\/p>\n<pre class=\"lang:default decode:true\">{\r\n    \"status\": 200, \r\n    \"body\": \"Empty\", \r\n    \"log\": \"Execution log for request test-requestnSat Dec 31 09:07:48 UTC 2016 : Starting execution for request: test-invoke-requestnSat Dec 31 09:07:48 UTC 2016 : HTTP Method: GET, Resource Path: \/booksnSat Dec 31 09:07:48 UTC 2016 : Method request path: {}nSat Dec 31 09:07:48 UTC 2016 : Method request query string: {}nSat Dec 31 09:07:48 UTC 2016 : Method request headers: {}nSat Dec 31 09:07:48 UTC 2016 : Method request body before transformations: nSat Dec 31 09:07:48 UTC 2016 : Endpoint request URI: https:\/\/lambda.us-west-1.amazonaws.com\/2015-03-31\/functions\/arn:aws:lambda:us-west-1:598307997273:function:MicroserviceGetAll\/invocationsnSat Dec 31 09:07:48 UTC 2016 : Endpoint request headers: {x-amzn-lambda-integration-tag=test-request, Authorization=******************************************************************************************************************************************************************************************************************************************************************************************************6de147, X-Amz-Date=20161231T090748Z, x-amzn-apigateway-api-id=lb2qgujjif, X-Amz-Source-Arn=arn:aws:execute-api:us-west-1:598307997273:lb2qgujjif\/null\/GET\/books, Accept=application\/json, User-Agent=AmazonAPIGateway_lb2qgujjif, X-Amz-Security-Token=FQoDYXdzEHEaDEILpsKTo45Ys1LrFCK3A+KOe5HXOSP3GfVAaRYHe1pDUJGHL9MtkFiPjORLFT+UCKjRqE7UFaGscTVG6PZXTuSyQev4XTyROfPylCrtDomGsoZF\/iwy4rlJQIJ7elBceyeKu1OVdaT1A99PVeliaCAiDL6Veo1viWOnP+7c72nAaJ5jnyF\/nHl\/OLhFdFv4t\/hnx3JePMk5YM89\/6ofxUEVDNfzXxbZHRpTrG\/4TPHwjPdoR5i9dEzWMU6Eo5xD4ldQ\/m5B3RmrwpaPOuEq39LhJ8k\/Vzo+pAfgJTq5ssbNwYOgh0RPSGVNMcoTkCwk0EMMT5vDbmQqZ2dW1a1tmQg9N2xR+QQy+RKMFgO5YY8fMxHnRSdMuuipxl79G1pktc [TRUNCATED]nSat Dec 31 09:07:48 UTC 2016 : Endpoint request body after transformations: nSat Dec 31 09:07:53 UTC 2016 : Endpoint response body before transformations: \"[{\\\"default\\\":{\\\"cost\\\":\\\"1.23\\\",\\\"id\\\":\\\"1\\\",\\\"bookname\\\":\\\"test book\\\",\\\"isbn\\\":\\\"123\\\"}}]\"nSat Dec 31 09:07:53 UTC 2016 : Endpoint response headers: {x-amzn-Remapped-Content-Length=0, x-amzn-RequestId=99ab09b2-cf38-11e6-996f-f5f07af431af, Connection=keep-alive, Content-Length=94, Date=Sat, 31 Dec 2016 09:07:52 GMT, Content-Type=application\/json}nSat Dec 31 09:07:53 UTC 2016 : Method response body after transformations: EmptynSat Dec 31 09:07:53 UTC 2016 : Method response headers: {X-Amzn-Trace-Id=Root=1-58677564-66f1e96642b16d2db703126e, Content-Type=application\/json}nSat Dec 31 09:07:53 UTC 2016 : Successfully completed executionnSat Dec 31 09:07:53 UTC 2016 : Method completed with status: 200n\", \r\n    \"latency\": 4744, \r\n    \"headers\": {\r\n        \"X-Amzn-Trace-Id\": \"Root=1-58677564-66f1e96642b16d2db703126e\", \r\n        \"Content-Type\": \"application\/json\"\r\n    }\r\n}<\/pre>\n<p>Once again, 200 status code shows a successful invocation. Detailed logs can be obtained using\u00a0<code>aws logs filter-log-events --log-group \/aws\/lambda\/MicroservicePost<\/code>.<\/li>\n<\/ol>\n<p>This blog only shows one simple POST and GET methods. Other HTTP methods can be very easily included in this microservice as well.<\/p>\n<h2>API Gateway and Lambda References<\/h2>\n<ul>\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>This blog has\u00a0explained the following concepts\u00a0for serverless applications so far: Serverless FaaS with AWS Lambda and Java AWS IoT Button, Lambda and Couchbase The third blog in serverless series will explain\u00a0how to create a simple microservice using Amazon API Gateway, [&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":[1816],"tags":[],"ppma_author":[8933],"class_list":["post-2468","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-couchbase-server"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.9 (Yoast SEO v25.9) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Microservice using AWS API Gateway, AWS Lambda and Couchbase - The Couchbase Blog<\/title>\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-api-gateway-lambda-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 API Gateway, AWS Lambda and Couchbase\" \/>\n<meta property=\"og:description\" content=\"This blog has\u00a0explained the following concepts\u00a0for serverless applications so far: Serverless FaaS with AWS Lambda and Java AWS IoT Button, Lambda and Couchbase The third blog in serverless series will explain\u00a0how to create a simple microservice using Amazon API Gateway, [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/microservice-aws-api-gateway-lambda-couchbase\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:published_time\" content=\"2017-01-18T23:08:03+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-06-21T12:51:56+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=\"9 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-api-gateway-lambda-couchbase\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/microservice-aws-api-gateway-lambda-couchbase\/\"},\"author\":{\"name\":\"Arun Gupta, VP, Developer Advocacy, Couchbase\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/39d8caed0f536489b6aa6e8d31ee631f\"},\"headline\":\"Microservice using AWS API Gateway, AWS Lambda and Couchbase\",\"datePublished\":\"2017-01-18T23:08:03+00:00\",\"dateModified\":\"2023-06-21T12:51:56+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/microservice-aws-api-gateway-lambda-couchbase\/\"},\"wordCount\":968,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/microservice-aws-api-gateway-lambda-couchbase\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"articleSection\":[\"Couchbase Server\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/microservice-aws-api-gateway-lambda-couchbase\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/microservice-aws-api-gateway-lambda-couchbase\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/microservice-aws-api-gateway-lambda-couchbase\/\",\"name\":\"Microservice using AWS API Gateway, AWS Lambda and Couchbase - The Couchbase Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/microservice-aws-api-gateway-lambda-couchbase\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/microservice-aws-api-gateway-lambda-couchbase\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"datePublished\":\"2017-01-18T23:08:03+00:00\",\"dateModified\":\"2023-06-21T12:51:56+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/microservice-aws-api-gateway-lambda-couchbase\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/microservice-aws-api-gateway-lambda-couchbase\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/microservice-aws-api-gateway-lambda-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-api-gateway-lambda-couchbase\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.couchbase.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Microservice using AWS API Gateway, AWS Lambda 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 AWS API Gateway, AWS Lambda and Couchbase - The Couchbase Blog","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-api-gateway-lambda-couchbase\/","og_locale":"en_US","og_type":"article","og_title":"Microservice using AWS API Gateway, AWS Lambda and Couchbase","og_description":"This blog has\u00a0explained the following concepts\u00a0for serverless applications so far: Serverless FaaS with AWS Lambda and Java AWS IoT Button, Lambda and Couchbase The third blog in serverless series will explain\u00a0how to create a simple microservice using Amazon API Gateway, [&hellip;]","og_url":"https:\/\/www.couchbase.com\/blog\/microservice-aws-api-gateway-lambda-couchbase\/","og_site_name":"The Couchbase Blog","article_published_time":"2017-01-18T23:08:03+00:00","article_modified_time":"2023-06-21T12:51:56+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":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.couchbase.com\/blog\/microservice-aws-api-gateway-lambda-couchbase\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/microservice-aws-api-gateway-lambda-couchbase\/"},"author":{"name":"Arun Gupta, VP, Developer Advocacy, Couchbase","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/39d8caed0f536489b6aa6e8d31ee631f"},"headline":"Microservice using AWS API Gateway, AWS Lambda and Couchbase","datePublished":"2017-01-18T23:08:03+00:00","dateModified":"2023-06-21T12:51:56+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/microservice-aws-api-gateway-lambda-couchbase\/"},"wordCount":968,"commentCount":1,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/microservice-aws-api-gateway-lambda-couchbase\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","articleSection":["Couchbase Server"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/microservice-aws-api-gateway-lambda-couchbase\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/microservice-aws-api-gateway-lambda-couchbase\/","url":"https:\/\/www.couchbase.com\/blog\/microservice-aws-api-gateway-lambda-couchbase\/","name":"Microservice using AWS API Gateway, AWS Lambda and Couchbase - The Couchbase Blog","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/microservice-aws-api-gateway-lambda-couchbase\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/microservice-aws-api-gateway-lambda-couchbase\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","datePublished":"2017-01-18T23:08:03+00:00","dateModified":"2023-06-21T12:51:56+00:00","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/microservice-aws-api-gateway-lambda-couchbase\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/microservice-aws-api-gateway-lambda-couchbase\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/microservice-aws-api-gateway-lambda-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-api-gateway-lambda-couchbase\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Microservice using AWS API Gateway, AWS Lambda 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\/2468","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=2468"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/2468\/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=2468"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/categories?post=2468"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/tags?post=2468"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=2468"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}