Q10 — AWS SAA-C03 Ch.16
Question 10 of 100 | ← Chapter 16
Q1210. A company wants to use AWS services to build an event-driven application. The company wants to use an Amazon API Gateway REST API to control traffic between blue and green environments during deployments.Which solution will meet these requirements?
- A. Create two AWS Lambda functions. Configure API Gateway with two stage variables that point to each of the Lambda functions. Use AWS Serverless Application Model (AWS SAM) to perform blue/green deployments by updating the stage variables in API Gateway.
- B. Create a single AWS Lambda function. Use AWS Systems Manager Run Command to perform blue/ green deployments by swapping the Lambda function alias between two different versions.
- C. Create two AWS Lambda functions. Use AWS Serverless Application Model(AWS SAM) to update the Lambda functions. Use Amazon EventBridge to route events to each of the Lambda functions based on environment tags during deployments.
- D. Create a single AWS Lambda function. Use AWS Serverless Application Model (AWS SAM) to perform blue/green deployments by creating two Lambda aliases and updating the APl Gateway stage variable to switch between aliases. ✓
Correct Answer: D. Create a single AWS Lambda function. Use AWS Serverless Application Model (AWS SAM) to perform blue/green deployments by creating two Lambda aliases and updating the APl Gateway stage variable to switch between aliases.
Explanation
To meet the company's requirements of building an event-driven application with an Amazon API Gateway REST API to control traffic between blue and green environments during deployments, the most suitable solution is:D. Create a single AWS Lambda function. Use AWS Serverless Application Model (AWS SAM) to perform blue/green deployments by creating two Lambda aliases and updating the API Gateway stage variable to switch between aliases.Analysis:Single AWS Lambda Function with Aliases:Blue/Green Deployments: By creating two aliases (e.g., blue and green) for a single Lambda function, you can easily switch traffic between different versions of the function. This is a common approach for implementing blue/green deployments in AWS Lambda.Version Control: Each alias can point to a different version of the Lambda function, allowing you to test new versions in the green environment while keeping the stable version in the blue environment.AWS SAM for Blue/Green Deployments:Automated Deployments: AWS SAM provides a convenient way to define and deploy serverless applications. You can use SAM to create and manage Lambda aliases, as well as update the API Gateway stage variable to switch between aliases during deployments. Infrastructure as Code: By using SAM, you can version-control your infrastructure and deployments, making it easier to manage and audit changes over time.API Gateway Stage Variable:Traffic Routing: By updating the API Gateway stage variable to point to different Lambda aliases, you can control which version of the Lambda function receives traffic from the API Gateway. This allows you to seamlessly switch between blue and green environments during deployments.Why Other Options Are Not Suitable:A. Create Two AWS Lambda Functions and Update Stage Variables:Resource Duplication: Creating two separate Lambda functions for blue and green environments leads to resource duplication and increased management overhead. It is more efficient to use a single Lambda function with aliases.B. Use AWS Systems Manager Run Command to Swap Lambda Function Aliases:Manual Intervention: Using AWS Systems Manager Run Command to swap Lambda function aliases is a manual process that is not as efficient or scalable as using AWS SAM to automate the deployment process.C. Create Two AWS Lambda Functions and Use Amazon EventBridge for Routing:Complexity and Overhead: Creating two separate Lambda functions and using Amazon EventBridge to route events based on environment tags adds unnecessary complexity and overhead. It is more straightforward to use a single Lambda function with aliases and API Gateway stage variables for blue/ green deployments.