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 Lambda and Amazon API Gateway, and we demonstrate how these services enable the creation of scalable, well-built, low-administration applications.
38. AWS SAM template
Diz ao AWS CloudFormation que esse
é um modelo do AWS SAM que ele
precisa "transformar".
Cria uma função Lambda com política
de acesso definida no AWS IAM.
Também cria um Amazon API
Gateway e cuida de todos os
mapeamentos / permissões
necessários.
Cria uma tabela do Amazon
DynamoDB com cinco unidades de
leitura e gravação.
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