The twelve-factor application model represents 12 best practices for building modern, cloud-native applications. With guidance on factors like configuration, deployment, runtime, and multiple-service communication, the twelve-factor model prescribes best practices that apply to everything from web applications to APIs to data processing applications. Although serverless computing and AWS Lambda have changed application development, the twelve-factor best practices remain relevant and applicable in a serverless world. In this talk, we apply the twelve-factor model to serverless application development with AWS Lambda and Amazon API Gateway, and we show you how these services enable you to build scalable, well-built, low-administration applications.
43. AWS SAM template
Tells AWS CloudFormation this is an
AWS SAM template that it needs to
“transform.”
Creates a Lambda function with the
referenced managed AWS IAM policy,
runtime, code at the referenced zip
location, and handler as defined. Also
creates an Amazon API Gateway and
takes care of all mapping/permissions
necessary.
Creates an Amazon DynamoDB table
with five read & write units.
AWSTemplateFormatVersion: '2010-09-09’
Transform: AWS::Serverless-2016-10-31
Resources:
GetHtmlFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: s3://sam-demo-bucket/todo_list.zip
Handler: index.gethtml
Runtime: nodejs6.10
Policies: AmazonDynamoDBReadOnlyAccess
Events:
GetHtml:
Type: Api
Properties:
Path: /{proxy+}
Method: ANY
ListTable:
Type: AWS::Serverless::SimpleTable