How to Deploy AWS SAM Templates Using CloudFormation?
Short answer
C Add a Transform section to the CloudFormation templates. Use the AWS SAM syntax to define the resources.
Question
Key Takeaways
This question tests knowledge of how SAM integrates with native CloudFormation, specifically the mandatory Transform directive, while trapping candidates who confuse resource types or template sections.
AWS SAM extends CloudFormation by allowing developers to write serverless resources in simplified YAML or JSON syntax. The community unanimously agrees that adding a Transform section to the CloudFormation template is the required step to enable this functionality.
Common mistake: Option A is frequently chosen because it uses standard CloudFormation Lambda resource types, but it fails to leverage the simplified SAM macros and requires manual configuration of API Gateway, IAM roles, and permissions instead of using AWS::Serverless::Function.
Expert Analysis
Why the Answer Is Correct
AWS SAM is fundamentally a macro language built on top of CloudFormation. To use SAM-specific resource types like AWS::Serverless::Function or AWS::Serverless::API, you must declare the Transform directive at the root level of your CloudFormation template. This tells CloudFormation to pre-process the template and translate SAM macros into native CloudFormation resources before deployment. Without this directive, CloudFormation will reject the template as invalid.
Why the Other Options Are Wrong
Option A incorrectly suggests using native AWS::Lambda::Function resources, which bypasses SAM entirely and defeats the purpose of using the framework. Option B misplaces SAM resource definitions inside the Mappings section, which is strictly for key-value lookups and cannot hold resource configurations. Option D incorrectly associates SAM globals with the Parameters section, whereas globals belong in a dedicated Globals block that applies settings across multiple functions.
Community Comment Notes
Candidates overwhelmingly confirmed option C through practical examples shared in the discussion. Comment [3] provided a complete template structure demonstrating the exact Transform directive syntax required. Multiple users noted they encountered this exact wording during their recent DVA-C02 exams, validating its high relevance. The official AWS documentation link shared in comment [1] further corroborates the necessary template structure.
Official Reference
- https://docs.aws.amazon.com/codecatalyst/latest/userguide/deploy-tut-lambda.html
- https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-specification-template-anatomy.html
These links open the official vendor documentation in a new tab.
Exam Strategy
Memorize the exact syntax for the Transform directive, as AWS frequently tests this foundational integration point. When reviewing infrastructure-as-code questions, always verify whether the question explicitly requests a higher-level abstraction like SAM or CDK, as this dictates which template sections and resource prefixes are valid.
Community Votes
100% of anonymous learners picked answer C. Votes are pick records left by other test-takers — they are not the verified answer.
Discussion 8 contributions
Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.
From public community threads 8
-
KarBiswa 👍 4 Answered Chttps://docs.aws.amazon.com/codecatalyst/latest/userguide/deploy-tut-lambda.html#:~:text=AWSTemplateFormatVersion%3A%20%272010%2D09%2D09%27%0ATransform%3A%20AWS%3A%3AServerless%2D2016%2D10%2D31
-
nder 👍 3 Answered CUsing SAM to define the CF templates
-
albert_kuo 👍 1 Answered CAWSTemplateFormatVersion: '2010-09-09' Transform: 'AWS::Serverless-2016-10-31' Resources: MyFunction: Type: AWS::Serverless::Function Properties: Handler: index.handler Runtime: nodejs14.x CodeUri: s3://my-bucket/my-function.zip Events: ApiEvent: Type: Api Properties: Path: /myfunction Method: get
-
CrescentShared 👍 4 Answered CGot this question in exam.
-
tgv 👍 4the correct answer is C
Show 3 more comments
-
monishvster 👍 4 Answered CShould be C
-
koltysh 👍 3it will be C
-
65703c1 👍 1 Answered CC is the correct answer.
Reader comments & corrections
No reader corrections yet — spotted an error or have a note? Share it below.
Related Analysis
Practice All DVA-C02 Questions
Access 100 questions with complete answers and detailed explanations.
View Full DVA-C02 Practice Test →