AWS DevOps Serverless Deployment 2 — Questions and Answers
Question 1: Which AWS SAM CLI command packages a serverless application and uploads artifacts to S3 before deployment?
- sam build
- sam package (Correct answer)
- sam deploy --guided
- sam publish
Correct answer: sam package
sam package bundles the application code and uploads artifacts to an S3 bucket, producing a packaged CloudFormation template.
Question 2: When deploying a Lambda function via CodeDeploy with a canary traffic-shifting strategy, which configuration routes 10% of traffic immediately and the rest after 5 minutes?
- Linear10PercentEvery1Minute
- Canary10Percent5Minutes (Correct answer)
- AllAtOnce
- Linear10PercentEvery5Minutes
Correct answer: Canary10Percent5Minutes
Canary10Percent5Minutes shifts 10% of traffic to the new version immediately, then shifts the remaining 90% after 5 minutes.
Question 3: In an AWS SAM template, which resource type is used to define a serverless REST API backed by Lambda?
- AWS::ApiGateway::RestApi
- AWS::Serverless::Api (Correct answer)
- AWS::ApiGatewayV2::Api
- AWS::Serverless::HttpApi
Correct answer: AWS::Serverless::Api
AWS::Serverless::Api is the SAM transform shorthand for creating an API Gateway REST API integrated with Lambda.
Question 4: A DevOps engineer needs Lambda to process S3 events only from a specific prefix. Where should this filter be configured?
- Lambda function environment variables
- S3 bucket policy
- Lambda event source mapping notification filter (Correct answer)
- IAM role condition
Correct answer: Lambda event source mapping notification filter
S3 event notification filters on prefix/suffix are configured in the event source mapping or S3 bucket notification configuration, not in Lambda itself.
Question 5: Which feature of Lambda allows a DevOps team to keep a function pre-initialized to eliminate cold start latency?
- Reserved concurrency
- Provisioned concurrency (Correct answer)
- Enhanced monitoring
- Lambda layers
Correct answer: Provisioned concurrency
Provisioned concurrency initializes a specified number of execution environments so they are ready to respond immediately without cold starts.
Question 6: During a blue/green Lambda deployment via AWS CodeDeploy, which hook runs automated tests BEFORE traffic is shifted to the new version?
- AfterAllowTraffic
- BeforeAllowTraffic (Correct answer)
- AfterInstall
- ValidateService
Correct answer: BeforeAllowTraffic
The BeforeAllowTraffic hook executes a Lambda function to run validation tests before CodeDeploy shifts any production traffic to the new version.
Question 7: A SAM template defines a DynamoDB table with the StreamSpecification enabled. Which SAM event type connects the stream to a Lambda function?
- SQS
- Kinesis
- DynamoDB (Correct answer)
- EventBridgeRule
Correct answer: DynamoDB
The DynamoDB event type in a SAM template creates a Lambda event source mapping that reads records from a DynamoDB Streams stream.
Which AWS SAM CLI command packages a serverless application and uploads artifacts to S3 before deployment?