Topic 1 Question #4
An ecommerce company operates a global product recommendation system that needs to switch between multiple foundation models (FM) in Amazon Bedrock based on regulations, cost optimization, and performance requirements. The company must apply custom controls based on proprietary business logic, including dynamic cost thresholds, AWS Region-specific compliance rules, and real-time A/B testing across multiple FMs. The system must be able to switch between FMs without deploying new code. The system must route user requests based on complex rules including user tier, transaction value, regulatory zone, and real-time cost metrics that change hourly and require immediate propagation across thousands of concurrent requests.Which solution will meet these requirements?
- A.
Deploy an AWS Lambda function that uses environment variables to store routing rules and Amazon Bedrock FM IDs. Use the Lambda console to update the environment variables when business requirements change. Configure an Amazon API Gateway REST API to read request parameters to make routing decisions.
- B.
Deploy Amazon API Gateway REST API request transformation templates to implement routing logic based on request attributes. Store Amazon Bedrock FM endpoints as REST API stage variables. Update the variables when the system switches between models.
- C.
Configure an AWS Lambda function to fetch routing configurations from the AWS AppConfig Agent for each user request. Run business logic in the Lambda function to select the appropriate FM for each request. Expose the FM through a single Amazon API Gateway REST API endpoint.
- D.
Use AWS Lambda authorizers for an Amazon API Gateway REST API to evaluate routing rules that are stored in AWS AppConfig. Return authorization contexts based on business logic. Route requests to model-specific Lambda functions for each Amazon Bedrock FM.
Answer: C
This question aligns with the AWS Certified Generative AI Developer - Professional domain of designing scalable, compliant generative AI application architectures that integrate multiple foundation models. The scenario requires a solution that supports dynamic, code-free updates to routing rules, immediate propagation of rule changes across high concurrency workloads, and complex business logic evaluation for selecting Amazon Bedrock FMs based on compliance, cost, and performance requirements. The suggested answer C addresses all these requirements by leveraging AWS AppConfig for dynamic, no-code configuration management and Lambda as a centralized routing layer. AppConfig eliminates the need for code deployments when updating routing rules, FM IDs, cost thresholds, or compliance policies, and its Lambda agent caches configurations locally to ensure low latency even for thousands of concurrent requests. The centralized Lambda layer runs the required custom business logic to evaluate request attributes, real-time cost metrics, and compliance rules against the latest configuration to select the optimal Bedrock FM, with a single API Gateway endpoint providing a unified user-facing interface that requires no client-side changes when routing rules or FMs are updated.
Option Analysis:
A. Incorrect. Lambda environment variables require a full Lambda function deployment to update, which violates the requirement to switch FMs and update rules without deploying new code. Updates to environment variables also do not propagate immediately to all active Lambda execution environments, failing the immediate propagation requirement for hourly rule changes. Additionally, API Gateway cannot independently evaluate complex dynamic routing rules that rely on real-time metrics stored as static environment variables.
B. Incorrect. API Gateway stage variables and request transformation templates require a re-deployment of the API stage to update, which violates the no-code change requirement for routing rule and FM switches. Request transformation templates also have limited support for complex business logic such as evaluating real-time cost metrics, A/B test splits, or dynamic regional compliance rules that change hourly, making this option unsuitable for the scenario.
C. Correct. This solution meets all stated requirements. The AWS AppConfig Agent for Lambda caches routing configurations locally, enabling low-latency access for high concurrency requests while supporting immediate, code-free propagation of rule and FM configuration changes. The centralized Lambda function can run full custom business logic to evaluate all required routing factors including user tier, transaction value, regulatory zone, and real-time cost metrics to select the appropriate Amazon Bedrock FM. The single API Gateway endpoint provides a unified entry point that requires no client changes when routing rules or FMs are updated, and no code deployments are required to modify routing logic or switch between FMs.
D. Incorrect. Lambda authorizers are purpose-built for authentication and authorization workflows, not for routing logic, so misusing them for routing introduces unnecessary latency and operational anti-patterns. Routing to model-specific Lambda functions also requires deploying new Lambda functions when adding or switching to new FMs, violating the no new code deployment requirement. This architecture also adds unnecessary operational overhead from managing multiple model-specific Lambda functions compared to a centralized routing layer.
Key Concepts:
1. Dynamic Configuration for Generative AI Workflows: AWS AppConfig is the recommended managed service for managing dynamic routing rules, feature flags, compliance policies, and cost thresholds for generative AI applications, as it supports zero-code deployments of configuration changes, immediate propagation, and validation guardrails for high-risk updates, which is a core competency for the AIP-C01 exam.
2. Multi-FM Routing Architecture for Amazon Bedrock: Centralized routing layers that pull dynamic configuration from a managed service enable organizations to switch between FMs, run A/B tests, enforce regional compliance, and optimize cost without modifying client integrations or core application code, a key design pattern tested in the AIP-C01 exam.
3. Serverless Best Practices for Generative AI Workloads: Using Lambda with the AppConfig Agent layer provides low-latency, high-concurrency support for real-time generative AI use cases while reducing operational overhead, as the agent handles configuration caching and updates automatically without custom code.
References:
AWS AppConfig User Guide,
https://docs.aws.amazon.com/appconfig/latest/userguide/what-is-appconfig.html
Build a multi-model routing solution for Amazon Bedrock to dynamically select the optimal foundation model