Understanding the differences between SAM and CloudFormation
First of all, a SAM template is designed to be used with serverless applications and services. At the time of writing, the SAM template reference supports the following resource types:
AWS::Serverless::API
: Creates an API gateway and related resourcesAWS::Serverless::Application
: Creates a serverless applicationAWS::Serverless::Function
: Creates a Lambda function and related resourcesAWS::Serverless::HttpApi
: Creates an HTTP API gateway and related resourcesAWS::Serverless::LayerVersion
: Creates a Lambda layerAWS::Serverless::SimpleTable
: Creates a simplified DynamoDB table (only a primary key without a sort key)
It is still possible to combine CloudFormation's resources with SAM's resources. For example, if we want to create an S3 bucket with SimpleTable
, we can do so by adding the CloudFormation resource, as in the following code:
Transform: AWS::Serverless-2016-10-31...