0
0
AWScloud~10 mins

Serverless Application Model (SAM) in AWS - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define a Lambda function resource in SAM.

AWS
Resources:\n  MyFunction:\n    Type: AWS::Serverless::Function\n    Properties:\n      Handler: index.handler\n      Runtime: nodejs14.x\n      CodeUri: [1]
Drag options to blanks, or click blank then click option'
Aindex.handler
B./src/
Cnodejs14.x
DAWS::Lambda::Function
Attempts:
3 left
💡 Hint
Common Mistakes
Putting the handler name in CodeUri
Using the runtime value in CodeUri
Using the resource type instead of CodeUri
2fill in blank
medium

Complete the code to specify the API event trigger for the Lambda function.

AWS
Resources:\n  MyFunction:\n    Type: AWS::Serverless::Function\n    Properties:\n      Events:\n        ApiEvent:\n          Type: Api\n          Properties:\n            Path: /hello\n            Method: [1]
Drag options to blanks, or click blank then click option'
AGET
BS3
CPOST
DLambda
Attempts:
3 left
💡 Hint
Common Mistakes
Using event types like S3 or Lambda instead of HTTP methods
Confusing POST with GET when the event is a simple retrieval
3fill in blank
hard

Fix the error in the SAM template to correctly define the function's memory size.

AWS
Resources:\n  MyFunction:\n    Type: AWS::Serverless::Function\n    Properties:\n      MemorySize: [1]
Drag options to blanks, or click blank then click option'
A512MB
B0.5GB
C512
D512MBs
Attempts:
3 left
💡 Hint
Common Mistakes
Adding units like MB or GB in the value
Using decimal or fractional values
4fill in blank
hard

Fill both blanks to define environment variables for the Lambda function.

AWS
Resources:\n  MyFunction:\n    Type: AWS::Serverless::Function\n    Properties:\n      Environment:\n        Variables:\n          STAGE: [1]\n          LOG_LEVEL: [2]
Drag options to blanks, or click blank then click option'
A"prod"
BDEBUG
C"INFO"
Dprod
Attempts:
3 left
💡 Hint
Common Mistakes
Not quoting string values
Using unquoted bare words
5fill in blank
hard

Fill all three blanks to define a simple SAM template with a function, API event, and timeout.

AWS
Resources:\n  HelloWorldFunction:\n    Type: AWS::Serverless::Function\n    Properties:\n      Handler: app.lambda_handler\n      Runtime: python3.9\n      Timeout: [1]\n      Events:\n        HelloApi:\n          Type: Api\n          Properties:\n            Path: /hello\n            Method: [2]\n      CodeUri: [3]
Drag options to blanks, or click blank then click option'
A10
BGET
C./hello_world/
D30
Attempts:
3 left
💡 Hint
Common Mistakes
Using strings for Timeout
Wrong HTTP method
Incorrect CodeUri path format