Posts

Showing posts from June, 2018

Creating Serverless application using SAM Part2

There are two ways to create API gateway resource using SAM template. These two types are called explicit API definition and implicit API definition. An explicit API gateway creation involves defining the resource explicitly with type AWS::Serverless::API In this type we give the API resource some name and thus we have an handle to the API. An implicit API gateway involves defining the end points for API as part of the serverless function event definition. There is no separate API gateway resource defined. As part of SAM deployment, all the endpoints are collected and a new API gateway resource is automatically created by the SAM. Implicit API Gateway Using our previous example where we created lambda function, we add few more properties as shown in the below snippet which creates an API gateway resource Explicit API Gateway example As we see that we don't have control with implicit API gateway. Also it is not possible to create a custom stage name for implicit ...

Creating Serverless application using SAM

Image
Hi Welcome to the tutorial on how to create serverless application using AWS. This tutorial will cover the steps required to create one such application. SAM refers to Serverless Application Model. In simple terms it is a template to define the resources that AWS cloudformation will provision. Documentation for SAM can be found here . Question: Why do I need SAM when I can create resources cloud formation? Answer: SAM template has a special type called serverless and it specially supports functions, api and table. However SAM itself supports few more services which can be found here . SAM abstracts lot of the  complexities and simpler compared to cloud formation. SAM also has a cli which can be used for local testing and speeds development time. The basic template of SAM looks like below AWSTemplateFormatVersion : ' 2010-09-09 ' Transform : ' AWS::Serverless-2016-10-31 ' Resources : Under the resources section we define the resources required for our applicat...