A developer is configuring a deployment template for a new serverless application using the AWS Serverless Application Model (SAM). The template contains the following partial structure:
yaml
Transform: AWS::Serverless-2016-10-31
Resources:
MyFunction:
Type: AWS::Serverless::Function
Properties:
Handler: index.handler
Runtime: nodejs18.x
CodeUri: ./src
Which two steps or configurations are required to successfully deploy and run this serverless application? (Select two.)
- The template must declare the Transform header at the root level of the template file to instruct CloudFormation on how to process SAM-specific resources.Cevap
- The local function code located in the './src' directory must be packaged and uploaded to an Amazon S3 bucket prior to deploying the CloudFormation stack.Cevap
- CThe template must list the Lambda function resource under the Globals section instead of the Resources section.
- DThe API Gateway event source must be configured with a custom integration rather than a proxy integration to allow SAM to automatically map HTTP header values.
- EThe Lambda function's IAM trust policy must explicitly grant permissions to retrieve runtime configuration secrets from AWS Secrets Manager.
Cevap
The configurations required are: (1) declaring the Transform header at the root level of the template file, and (2) packaging and uploading the local function code in the './src' directory to an Amazon S3 bucket.
The correct answer states that the Transform declaration must be at the root of the template file to instruct CloudFormation how to parse the SAM shorthand syntax, and that local function artifacts in the source directory must be zipped and uploaded to an S3 bucket prior to CloudFormation execution.
Adım Adım Çözüm
Anahtar Kavram
AWS SAM templates require a root-level transform declaration to be parsed by AWS CloudFormation, and local deployment artifacts must be packaged and uploaded to S3.
Tahmini Süre:1m 0s