{"id":20130,"date":"2016-10-07T18:39:30","date_gmt":"2016-10-08T02:39:30","guid":{"rendered":"https:\/\/www.altoros.com\/blog\/?p=20130"},"modified":"2021-03-17T17:00:59","modified_gmt":"2021-03-17T14:00:59","slug":"creating-your-first-serverless-app-with-aws-lambda-and-the-serverless-framework","status":"publish","type":"post","link":"https:\/\/www.altoros.com\/blog\/creating-your-first-serverless-app-with-aws-lambda-and-the-serverless-framework\/","title":{"rendered":"Creating Your First Serverless App with AWS Lambda and the Serverless Framework"},"content":{"rendered":"<p><a href=\"https:\/\/www.martinfowler.com\/articles\/serverless.html\" target=\"_blank\" rel=\"noopener noreferrer\">Serverless architectures<\/a> are one of the newest trends in computing that brings reduced infrastructure and development costs to the table. According to this approach, an application is split into multiple functions with each of them deployed separately.<\/p>\n<p>Here, we demonstrate how to create a serverless application and deploy it to <a href=\"https:\/\/aws.amazon.com\/lambda\/\" target=\"_blank\" rel=\"noopener noreferrer\">AWS Lambda<\/a>, as well as explain some of the architecture basics.<\/p>\n<p>&nbsp;<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_79_2 counter-hierarchy ez-toc-counter ez-toc-transparent ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.altoros.com\/blog\/creating-your-first-serverless-app-with-aws-lambda-and-the-serverless-framework\/#Serverless_architectures\" >Serverless architectures<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.altoros.com\/blog\/creating-your-first-serverless-app-with-aws-lambda-and-the-serverless-framework\/#The_Serverless_framework\" >The Serverless framework<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.altoros.com\/blog\/creating-your-first-serverless-app-with-aws-lambda-and-the-serverless-framework\/#Creating_your_first_serverless_application\" >Creating your first serverless application<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.altoros.com\/blog\/creating-your-first-serverless-app-with-aws-lambda-and-the-serverless-framework\/#Conclusions\" >Conclusions<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.altoros.com\/blog\/creating-your-first-serverless-app-with-aws-lambda-and-the-serverless-framework\/#Related_reading\" >Related reading<\/a><\/li><\/ul><\/nav><\/div>\n<h3><span class=\"ez-toc-section\" id=\"Serverless_architectures\"><\/span>Serverless architectures<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>In serverless architectures, all routines that process events are defined individually. This allows for assigning computation resources to a routine only when it is executed and minimizes the time of using the resources.<\/p>\n<p><center><a href=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2017\/01\/serverless-architectures.png\"><img decoding=\"async\" src=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2017\/01\/serverless-architectures.png\" alt=\"serverless-architectures\" width=\"640\" class=\"aligncenter size-full wp-image-20157\" \/><\/a><\/p>\n<p><small>Blog application deployed according to the serverless model<\/small><\/p>\n<p><\/center><\/p>\n<p>Currently, among the major vendors that provide supporting services for serverless architectures are <a href=\"https:\/\/aws.amazon.com\/lambda\/\" target=\"_blank\" rel=\"noopener noreferrer\">AWS Lambda<\/a>, <a href=\"https:\/\/cloud.google.com\/functions\/docs\/\" target=\"_blank\" rel=\"noopener noreferrer\">Google Cloud Functions<\/a>, <a href=\"https:\/\/www.ibm.com\/cloud\/openwhisk\" target=\"_blank\" rel=\"noopener noreferrer\">OpenWhisk<\/a> (available in IBM Bluemix), and <a href=\"https:\/\/azure.microsoft.com\/en-us\/services\/functions\/\" target=\"_blank\" rel=\"noopener noreferrer\">Azure Functions<\/a>.<\/p>\n<p>For instance, OpenWhisk creates a Docker image for each function. When an event requires processing, OpenWhisk runs these images in a container and processes the event. Then, the service suspends the container and puts it to cache. If the functions are called frequently, the existing container is reused from the cache. Otherwise, OpenWhisk will create a new container for each request.<\/p>\n<p><center><a href=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2017\/01\/ibm-openwhisk-event-processing-algorithm.png\"><img decoding=\"async\" src=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2017\/01\/ibm-openwhisk-event-processing-algorithm.png\" alt=\"ibm-openwhisk-event-processing-algorithm\" width=\"320\" class=\"aligncenter size-full wp-image-20156\" \/><\/a><\/p>\n<p><small>Event processing algorithm for OpenWhisk<\/small><\/p>\n<p><\/center><\/p>\n<p>However, the serverless model is not ideal for development. The separate definition and deployment of functions is not very useful when implementing applications. For this reason, there are a number of frameworks\u2014such as <a href=\"https:\/\/www.serverless.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">Serverless<\/a>, <a href=\"https:\/\/www.apex.run\/\" target=\"_blank\" rel=\"noopener noreferrer\">Apex<\/a>, and <a href=\"https:\/\/github.com\/cagataygurturk\/lambadaframework\" target=\"_blank\" rel=\"noopener noreferrer\">Lambada<\/a>\u2014that allow you to simplify the development and implement functionality without a paradigm shift.<\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"The_Serverless_framework\"><\/span>The Serverless framework<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Serverless is one of the best-known frameworks that facilitate implementation of serverless architectures. It provides a set of command line tools for creating, deploying, and invoking serverless applications. Currently, Serverless supports only AWS Lambda, but there are plans to add OpenWhisk, Azure Functions, and Google Cloud Functions in future releases.<\/p>\n<p>With the framework, you can create an application in a usual way, define all functions that will be used for event processing, and deploy this application to a cloud.<\/p>\n<p>To get started, we need to create a project:<\/p>\n<pre style=\"padding-left: 30px;\"><code>Ilyas-MacBook-Pro:prototypes idrabenia$ mkdir serverless-hello\nIlyas-MacBook-Pro:prototypes idrabenia$ cd .\/serverless-hello\/\nIlyas-MacBook-Pro:serverless-hello idrabenia$ serverless create --name test --template aws-nodejs\nServerless: Creating new Serverless service...\n _______                             __\n|   _   .-----.----.--.--.-----.----|  .-----.-----.-----.\n|   |___|  -__|   _|  |  |  -__|   _|  |  -__|__ --|__ --|\n|____   |_____|__|  \\___\/|_____|__| |__|_____|_____|_____|\n|   |   |             The Serverless Application Framework\n|       |                           serverless.com, v1.0.0-rc.1\n -------'\n\nServerless: Successfully created service with template: \"aws-nodejs\"\nServerless: NOTE: Please update the \"service\" property in serverless.yml with your service name\nIlyas-MacBook-Pro:serverless-hello idrabenia$ ls\nevent.json    handler.js     serverless.yml<\/code><\/pre>\n<p><\/p>\n<p>After this sample project is created, you can see three files. Below is the <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">serverless.yaml<\/code> configuration file:<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\"> 'service: aws-nodejs # NOTE: update this with your service name'\n\nprovider:\n  name: aws\n  runtime: nodejs4.3\n\nfunctions:\n  hello:\n    handler: handler.hello<\/pre>\n<p><\/p>\n<p>The file contains the configuration of the function that will be deployed to the cloud.<\/p>\n<p>The <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">handler.js<\/code> file includes the definition of this function:<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">'use strict';\n\n\/\/ Your first function handler\nmodule.exports.hello = (event, context, cb) =&gt; cb(null,\n  { message: 'Go Serverless v1.0! Your function executed successfully!', event }\n);\n\n\/\/ You can add more handlers here and reference them in serverless.yml<\/pre>\n<p>Thus, you can just specify the functions of your application in <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">serverless.yaml<\/code> and implement it as a traditional web application.<\/p>\n<p>The third file\u2014<code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">event.json<\/code>\u2014contains a sample event for the default handler.<\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Creating_your_first_serverless_application\"><\/span>Creating your first serverless application<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>To implement a serverless architecture, we decided to create a simple REST API for the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Create,_read,_update_and_delete\" target=\"_blank\" rel=\"noopener noreferrer\">CRUD<\/a> operations of the application user entity. In this scenario, we used the <a href=\"https:\/\/aws.amazon.com\/dynamodb\/\" target=\"_blank\" rel=\"noopener noreferrer\">DynamoDB<\/a> NoSQL database provided by AWS.<\/p>\n<p><center><a href=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2017\/01\/aws-lambda-serverless-architectures.png\"><img decoding=\"async\" src=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2017\/01\/aws-lambda-serverless-architectures.png\" alt=\"aws-lambda-serverless-architectures\" width=\"307\" class=\"aligncenter size-full wp-image-20154\" \/><\/a><\/p>\n<p><small>Project structure<\/small><\/p>\n<p><\/center><\/p>\n<p>For implementing the entity model and persistence, we used the <a href=\"https:\/\/github.com\/ryanfitz\/vogels\" target=\"_blank\" rel=\"noopener noreferrer\">vogels<\/a> library and <a href=\"https:\/\/github.com\/sideway\/joi\" target=\"_blank\" rel=\"noopener noreferrer\">Joi<\/a> validator.<\/p>\n<p>The <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">model\/user.js<\/code> file:<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">'use strict';\n\nlet vogels = require('vogels');\nlet Joi = require('joi');\nvogels.AWS.config.update({region: 'us-east-1'});\n\n\nlet User = vogels.define('User', {\n hashKey: 'email',\n\n \/\/ add the timestamp attributes (updatedAt, createdAt)\n timestamps: true,\n\n schema: {\n   email: Joi.string().email(),\n   firstName: Joi.string(),\n   lastName: Joi.string(),\n   age: Joi.number(),\n   roles: vogels.types.stringSet(),\n   settings: {\n     nickname: Joi.string(),\n     acceptedTerms: Joi.boolean().default(false)\n   }\n }\n});\n\nmodule.exports = User;<\/pre>\n<p>Also,  there is a controller that enables all required CRUD operations and exposes them through a REST API. Here is the code of the <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">controller\/user.js<\/code> file:<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">'use strict';\n\nlet User = require('.\/..\/model\/user');\nlet vogels = require('vogels');\n\n\nfunction UserController () {\n let self = this;\n\n self.create = function (event, context, cb) {\n   vogels.createTables(() =&gt; User.create(user, cb));\n };\n\n self.list = function (event, context, callback) {\n   User.scan().limit(20).exec(callback);\n };\n\n self.update = function (event, context, callback) {\n   new User(event.body).save(callback);\n };\n\n self.delete = function (event, context, callback) {\n   User.destroy(event.path.id, (err) =&gt; callback(err, {}));\n };\n}\n\nmodule.exports = new UserController();<\/pre>\n<p>The configuration for the API is below:<\/p>\n<pre style=\"padding-left: 30px;\"><code>service: aws-nodejs \nprovider:\n name: aws\n runtime: nodejs4.3\n iamRoleStatements:\n   - Effect: \"Allow\"\n     Action:\n       - \"*\"\n     Resource: # next role requires to allow AWS Lambda routines access to DynamoDB\n       - \"arn:aws:dynamodb:us-east-1:[ACCOUNT_ID]:table\/*\"\n\nfunctions:\n userCreate:\n   handler: lib\/controller\/user.create\n   events:\n     - http: POST user\n\n userList:\n   handler: lib\/controller\/user.list\n   events:\n     - http: GET user\n\n userUpdate:\n   handler: lib\/controller\/user.update\n   events:\n     - http: POST user\/{id}\n\n userDelete:\n   handler: lib\/controller\/user.delete\n   events:\n     - http: DELETE user\/{id}<\/code><\/pre>\n<p><\/p>\n<p>Then, we can deploy the application to AWS Lambda:<\/p>\n<pre style=\"padding-left: 30px;\"><code>ilyas-mbp:serverless-probe idrabenia$ serverless deploy\nServerless: Packaging service...\nServerless: Removing old service versions...\nServerless: Uploading CloudFormation file to S3...\nServerless: Uploading service .zip file to S3...\nServerless: Updating Stack...\nServerless: Checking Stack update progress...\n........................................................\nServerless: Stack update finished...\n\nService Information\nservice: aws-nodejs\nstage: dev\nregion: us-east-1\nendpoints:\n  POST - https:\/\/wtiqkzaow2c.execute-api.us-east-1.amazonaws.com\/dev\/user\n  GET - https:\/\/wtiqkzaow2c.execute-api.us-east-1.amazonaws.com\/dev\/user\n  POST - https:\/\/wtiqkzaow2c.execute-api.us-east-1.amazonaws.com\/dev\/user\/{id}\n  DELETE - https:\/\/wtiqkzaow2c.execute-api.us-east-1.amazonaws.com\/dev\/user\/{id}<\/code><\/pre>\n<p><\/p>\n<p>It is also possible to test the API using Postman:<\/p>\n<p><center><a href=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2017\/01\/creating-serverless-apps.png\"><img decoding=\"async\" src=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2017\/01\/creating-serverless-apps.png\" alt=\"creating-serverless-apps\" width=\"640\" class=\"aligncenter size-full wp-image-20155\" \/><\/a><\/p>\n<p><small>Receiving a list of users through the developed REST API<\/small><\/p>\n<p><\/center><\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Conclusions\"><\/span>Conclusions<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>The serverless model promises new opportunities for low-cost computing. With libraries like the Serverless framework available, it is quite simple to use this architecture to implement fully functional  applications. Overall, the serverless model seems to be a good fit for some small- and medium-sized web applications, including e-stores, corporate websites, forums, and blogs. Now available exclusively for AWS Lambda, the Serverless framework will hopefully feature support for OpenWhisk as well.<\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Related_reading\"><\/span>Related reading<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<ul>\n<li><a href=\"https:\/\/www.altoros.com\/blog\/ibm-bluemix-openwhisk-101-developing-a-microservice\/\">IBM Bluemix OpenWhisk 101: Developing a Microservice<\/a><\/li>\n<li><a href=\"https:\/\/www.altoros.com\/blog\/introduction-to-ibm-bluemix-openwhisk\/\">Introduction to IBM Bluemix OpenWhisk<\/a><\/li>\n<li><a href=\"https:\/\/www.altoros.com\/blog\/how-to-use-openwhisk-docker-actions-in-ibm-bluemix\/\">How to Use OpenWhisk Docker Actions in IBM Bluemix<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Serverless architectures are one of the newest trends in computing that brings reduced infrastructure and development costs to the table. According to this approach, an application is split into multiple functions with each of them deployed separately.<\/p>\n<p>Here, we demonstrate how to create a serverless application and deploy it to AWS [&#8230;]<\/p>\n","protected":false},"author":71,"featured_media":29299,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"content-type":"","footnotes":"","_links_to":"","_links_to_target":""},"categories":[214],"tags":[873,187,750],"class_list":["post-20130","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","tag-cloud-native","tag-ibm-bluemix","tag-openwhisk"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Creating Your First Serverless App with AWS Lambda and the Serverless Framework | Altoros<\/title>\n<meta name=\"description\" content=\"With code examples, this blog post provides a tutorial on how to create a serverless app, as well as looks into the underlying architecture.\" \/>\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.altoros.com\/blog\/creating-your-first-serverless-app-with-aws-lambda-and-the-serverless-framework\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Creating Your First Serverless App with AWS Lambda and the Serverless Framework | Altoros\" \/>\n<meta property=\"og:description\" content=\"Serverless architectures are one of the newest trends in computing that brings reduced infrastructure and development costs to the table. According to this approach, an application is split into multiple functions with each of them deployed separately. Here, we demonstrate how to create a serverless application and deploy it to AWS [...]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.altoros.com\/blog\/creating-your-first-serverless-app-with-aws-lambda-and-the-serverless-framework\/\" \/>\n<meta property=\"og:site_name\" content=\"Altoros\" \/>\n<meta property=\"article:published_time\" content=\"2016-10-08T02:39:30+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-03-17T14:00:59+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2016\/10\/serverless-app-with-AWS-lambda-and-serverless-framework_v2.gif\" \/>\n\t<meta property=\"og:image:width\" content=\"640\" \/>\n\t<meta property=\"og:image:height\" content=\"318\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/gif\" \/>\n<meta name=\"author\" content=\"Ilya Drabenia\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ilya Drabenia\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.altoros.com\/blog\/creating-your-first-serverless-app-with-aws-lambda-and-the-serverless-framework\/\",\"url\":\"https:\/\/www.altoros.com\/blog\/creating-your-first-serverless-app-with-aws-lambda-and-the-serverless-framework\/\",\"name\":\"Creating Your First Serverless App with AWS Lambda and the Serverless Framework | Altoros\",\"isPartOf\":{\"@id\":\"https:\/\/www.altoros.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.altoros.com\/blog\/creating-your-first-serverless-app-with-aws-lambda-and-the-serverless-framework\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.altoros.com\/blog\/creating-your-first-serverless-app-with-aws-lambda-and-the-serverless-framework\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2016\/10\/serverless-app-with-AWS-lambda-and-serverless-framework_v2.gif\",\"datePublished\":\"2016-10-08T02:39:30+00:00\",\"dateModified\":\"2021-03-17T14:00:59+00:00\",\"author\":{\"@id\":\"https:\/\/www.altoros.com\/blog\/#\/schema\/person\/48c2eaf6d86abc9fa945bc3860fa2dc2\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.altoros.com\/blog\/creating-your-first-serverless-app-with-aws-lambda-and-the-serverless-framework\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.altoros.com\/blog\/creating-your-first-serverless-app-with-aws-lambda-and-the-serverless-framework\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.altoros.com\/blog\/creating-your-first-serverless-app-with-aws-lambda-and-the-serverless-framework\/#primaryimage\",\"url\":\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2016\/10\/serverless-app-with-AWS-lambda-and-serverless-framework_v2.gif\",\"contentUrl\":\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2016\/10\/serverless-app-with-AWS-lambda-and-serverless-framework_v2.gif\",\"width\":640,\"height\":318},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.altoros.com\/blog\/creating-your-first-serverless-app-with-aws-lambda-and-the-serverless-framework\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.altoros.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Creating Your First Serverless App with AWS Lambda and the Serverless Framework\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.altoros.com\/blog\/#website\",\"url\":\"https:\/\/www.altoros.com\/blog\/\",\"name\":\"Altoros\",\"description\":\"Insight\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.altoros.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.altoros.com\/blog\/#\/schema\/person\/48c2eaf6d86abc9fa945bc3860fa2dc2\",\"name\":\"Ilya Drabenia\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.altoros.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2017\/01\/1108467-150x150.jpg\",\"contentUrl\":\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2017\/01\/1108467-150x150.jpg\",\"caption\":\"Ilya Drabenia\"},\"description\":\"Ilya Drabenia is a Technical Lead at Altoros. He has broad experience in building software architectures, including design and development of complex solutions. Ilya is passionate about microservices, domain-driven design, as well as scalable and parallel algorithms. He also holds an MSc degree in Computer Science. See his profile on GitHub.\",\"url\":\"https:\/\/www.altoros.com\/blog\/author\/ilya-drabenia\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Creating Your First Serverless App with AWS Lambda and the Serverless Framework | Altoros","description":"With code examples, this blog post provides a tutorial on how to create a serverless app, as well as looks into the underlying architecture.","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.altoros.com\/blog\/creating-your-first-serverless-app-with-aws-lambda-and-the-serverless-framework\/","og_locale":"en_US","og_type":"article","og_title":"Creating Your First Serverless App with AWS Lambda and the Serverless Framework | Altoros","og_description":"Serverless architectures are one of the newest trends in computing that brings reduced infrastructure and development costs to the table. According to this approach, an application is split into multiple functions with each of them deployed separately. Here, we demonstrate how to create a serverless application and deploy it to AWS [...]","og_url":"https:\/\/www.altoros.com\/blog\/creating-your-first-serverless-app-with-aws-lambda-and-the-serverless-framework\/","og_site_name":"Altoros","article_published_time":"2016-10-08T02:39:30+00:00","article_modified_time":"2021-03-17T14:00:59+00:00","og_image":[{"width":640,"height":318,"url":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2016\/10\/serverless-app-with-AWS-lambda-and-serverless-framework_v2.gif","type":"image\/gif"}],"author":"Ilya Drabenia","twitter_misc":{"Written by":"Ilya Drabenia","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.altoros.com\/blog\/creating-your-first-serverless-app-with-aws-lambda-and-the-serverless-framework\/","url":"https:\/\/www.altoros.com\/blog\/creating-your-first-serverless-app-with-aws-lambda-and-the-serverless-framework\/","name":"Creating Your First Serverless App with AWS Lambda and the Serverless Framework | Altoros","isPartOf":{"@id":"https:\/\/www.altoros.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.altoros.com\/blog\/creating-your-first-serverless-app-with-aws-lambda-and-the-serverless-framework\/#primaryimage"},"image":{"@id":"https:\/\/www.altoros.com\/blog\/creating-your-first-serverless-app-with-aws-lambda-and-the-serverless-framework\/#primaryimage"},"thumbnailUrl":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2016\/10\/serverless-app-with-AWS-lambda-and-serverless-framework_v2.gif","datePublished":"2016-10-08T02:39:30+00:00","dateModified":"2021-03-17T14:00:59+00:00","author":{"@id":"https:\/\/www.altoros.com\/blog\/#\/schema\/person\/48c2eaf6d86abc9fa945bc3860fa2dc2"},"breadcrumb":{"@id":"https:\/\/www.altoros.com\/blog\/creating-your-first-serverless-app-with-aws-lambda-and-the-serverless-framework\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.altoros.com\/blog\/creating-your-first-serverless-app-with-aws-lambda-and-the-serverless-framework\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.altoros.com\/blog\/creating-your-first-serverless-app-with-aws-lambda-and-the-serverless-framework\/#primaryimage","url":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2016\/10\/serverless-app-with-AWS-lambda-and-serverless-framework_v2.gif","contentUrl":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2016\/10\/serverless-app-with-AWS-lambda-and-serverless-framework_v2.gif","width":640,"height":318},{"@type":"BreadcrumbList","@id":"https:\/\/www.altoros.com\/blog\/creating-your-first-serverless-app-with-aws-lambda-and-the-serverless-framework\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.altoros.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Creating Your First Serverless App with AWS Lambda and the Serverless Framework"}]},{"@type":"WebSite","@id":"https:\/\/www.altoros.com\/blog\/#website","url":"https:\/\/www.altoros.com\/blog\/","name":"Altoros","description":"Insight","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.altoros.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.altoros.com\/blog\/#\/schema\/person\/48c2eaf6d86abc9fa945bc3860fa2dc2","name":"Ilya Drabenia","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.altoros.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2017\/01\/1108467-150x150.jpg","contentUrl":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2017\/01\/1108467-150x150.jpg","caption":"Ilya Drabenia"},"description":"Ilya Drabenia is a Technical Lead at Altoros. He has broad experience in building software architectures, including design and development of complex solutions. Ilya is passionate about microservices, domain-driven design, as well as scalable and parallel algorithms. He also holds an MSc degree in Computer Science. See his profile on GitHub.","url":"https:\/\/www.altoros.com\/blog\/author\/ilya-drabenia\/"}]}},"_links":{"self":[{"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/posts\/20130","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/users\/71"}],"replies":[{"embeddable":true,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/comments?post=20130"}],"version-history":[{"count":12,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/posts\/20130\/revisions"}],"predecessor-version":[{"id":60664,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/posts\/20130\/revisions\/60664"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/media\/29299"}],"wp:attachment":[{"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/media?parent=20130"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/categories?post=20130"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/tags?post=20130"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}