A developer is writing an AWS Serverless Application Model (SAM) template to deploy a Lambda function that handles API requests. The developer wants to apply a default timeout of 10 seconds to all functions and ensure that the template is parsed correctly by AWS CloudFormation as a SAM template.
yaml
AWSTemplateFormatVersion: '2010-09-09'
# [Configuration 1]
Globals:
# [Configuration 2]
Resources:
ProcessRequestFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: src/
Handler: index.handler
Runtime: nodejs18.x
Which two configuration steps must the developer take to complete the template?
- Declare `Transform: AWS::Serverless-2016-10-31` at the root level of the templateCevap
- Define `Function:` followed by `Timeout: 10` inside the `Globals` sectionCevap
- CDeclare `Transform: AWS::CloudFormation::Serverless` at the root level of the template
- DDefine `Parameters:` followed by `DefaultTimeout: 10` inside the `Globals` section
- EDefine `Role:` followed by `AssumeRolePolicyDocument: Timeout: 10` inside the `Globals` section
Cevap
The developer must declare the correct SAM transform at the root level of the template and specify the function timeout under the Globals section.
To complete the AWS SAM template, the template must include the correct `Transform` header at the root level to instruct CloudFormation to process it using the SAM translator, and the `Globals` section must define the `Timeout` under `Function` to apply it to all functions in the template.
Adım Adım Çözüm
Anahtar Kavram
AWS Serverless Application Model (SAM) templates require a specific Transform header to be processed by CloudFormation, and support a Globals section to define shared resource properties.