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 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 methodology remains relevant and applicable in a serverless world. In this talk, we apply the Twelve-Factor model to serverless application development with Lambda and Amazon API Gateway, and we demonstrate how these services enable you to build scalable, well-built, low-administration applications.
42. AWS SAM template
Tells AWS CloudFormation this is an AWS
SAM template it needs to “transform”
Creates a Lambda function with the
referenced managed IAM policy, runtime,
code at the referenced .zip location, and
handler as defined. Also creates an API
Gateway and takes care of all
mapping/permissions necessary
Creates a DynamoDB table with five read-
and-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