How to Deploy AWS SAM Templates Using CloudFormation?

A company is adopting serverless computing for some of its new services. A development team needs to create a serverless infrastructure by using AWS Serverless Application Model (AWS SAM). All infrastructure must be deployed by using AWS CloudFormation templates. What should the development team do to meet these requirements?

  1. Add a Resources section to the CloudFormation templates that contains AWS::Lambda::Function resources.
  2. Add a Mappings section to the CloudFormation templates that contains AWS::Serverless::Function and AWS::Serverless::API.
  3. Add a Transform section to the CloudFormation templates. Use the AWS SAM syntax to define the resources. Source Reference Answer
  4. Add a Parameters section to the CloudFormation templates that specifies the relevant AWS SAM Globals section.

Community Votes

C
100%

100% of anonymous learners picked answer C. Votes are pick records left by other test-takers — they are not the verified answer.

Community Insight

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.

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.

Community Discussion (8 comments)

albert_kuo 👍 1 Selected: C
AWSTemplateFormatVersion: '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
65703c1 👍 1 Selected: C
C is the correct answer.
KarBiswa 👍 4 Selected: C
https://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
koltysh 👍 3
it will be C
nder 👍 3 Selected: C
Using SAM to define the CF templates
monishvster 👍 4 Selected: C
Should be C
CrescentShared 👍 4 Selected: C
Got this question in exam.
tgv 👍 4
the correct answer is C

Comments & Corrections

No comments yet — spotted an error or have a note? Share it below.

Log in to comment, report an error, or add a note about this question.

Submitted for moderation before publishing. Keep it helpful and respectful.

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

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.

Related Analysis

Practice All DVA-C02 Questions

Access 100 questions with complete answers and detailed explanations.

View Full DVA-C02 Practice Test →

← Back to DVA-C02 Study Guide