SAM Flashcards
Serverless Application Model (SAM)
An open-source framework for building serverless applications.
What does SAM provide?
It provides shorthand syntax to express functions, APIs, databases, and event source mappings.
Template configuration options for SAM?
You create a JSON or YAML configuration template to model your applications.
How is SAM transformed and expanded upon deployment?
During deployment, SAM transforms and expands the SAM syntax into AWS CloudFormation syntax. Any resource that you can declare in an AWS CloudFormation template you can also declare in an AWS SAM template.
SAM CLI
The SAM CLI provides a Lambda-like execution environment that lets you locally build, test, and debug applications defined by SAM templates. You can also use the SAM CLI to deploy your applications to AWS.
True/False. You can use AWS SAM to build serverless applications that use any runtime supported by AWS Lambda.
True.
True/False. You can also use SAM CLI to locally debug Lambda functions written in Node.js, Java, Python, and Go.
True.
True/False. The Transform section is not required if you are writing a SAM template along and not via CloudFormation.
False. If you are writing an AWS Serverless Application Model template alone and not via CloudFormation, the Transform section IS required.
Globals section.
The Globals section is unique to AWS SAM templates. It defines properties that are common to all your serverless functions and APIs. All the AWS::Serverless::Function, AWS::Serverless::Api, and AWS::Serverless::SimpleTable resources inherit the properties that are defined in the Globals section.
Resources section.
The Resources section can contain a combination of AWS CloudFormation resources and AWS SAM resources.
Syntax: AWS::Serverless::Api
This resource type describes an API Gateway resource. It’s useful for advanced use cases where you want full control and flexibility when you configure your APIs.
Syntax: AWS::Serverless::Application
This resource type embeds a serverless application from the AWS Serverless Application Repository or from an Amazon S3 bucket as a nested application. Nested applications are deployed as nested stacks, which can contain multiple other resources.
Syntax: AWS::Serverless::Function
This resource type describes configuration information for creating a Lambda function. You can describe any event source that you want to attach to the Lambda function—such as Amazon S3, Amazon DynamoDB Streams, and Amazon Kinesis Data Streams.
Syntax: AWS::Serverless::LayerVersion
This resource type creates a Lambda layer version that contains library or runtime code needed by a Lambda function. When a serverless layer version is transformed, AWS SAM also transforms the logical ID of the resource so that old layer versions are not automatically deleted by AWS CloudFormation when the resource is updated.
Syntax: AWS::Serverless::SimpleTable
This resource type provides simple syntax for describing how to create DynamoDB tables.