This article details a reference architecture for an AI gateway using Amazon API Gateway to control access to Amazon Bedrock. The design focuses on implementing critical enterprise governance features like authorization, quota management, tenant isolation, and cost control for generative AI applications. It leverages managed AWS services to provide a scalable and transparent solution for integrating foundation models.
Read original on AWS Architecture BlogEnterprises building generative AI applications often face challenges in governing foundation model usage, requiring robust mechanisms for authorization, quota management, and cost control. This article presents a reusable reference architecture for an AI gateway that addresses these concerns by placing Amazon API Gateway in front of Amazon Bedrock.
The proposed AI gateway architecture relies on several AWS services to provide granular control and a transparent experience for client applications. The key components include:
Architectural Benefit: Transparency
The transparency to client applications is a significant benefit. Clients can use standard AWS SDKs to interact with Amazon Bedrock, while the AI gateway transparently handles governance aspects like authorization and quota management behind the scenes.
When a client makes an Amazon Bedrock API call to the AI gateway endpoint, the Lambda integration function captures the original request details, applies AWS Signature Version 4 authentication, and forwards it to the correct Amazon Bedrock service endpoint. This approach allows the gateway to adapt to new Bedrock features without requiring specific API knowledge or code updates, minimizing maintenance overhead as the platform evolves.
Parameters:
EndpointType:
Type: String
Default: PRIVATE
AllowedValues: [PRIVATE, REGIONAL]
Description: API Gateway endpoint accessibility (PRIVATE or REGIONAL)
EnableAuthorizer:
Type: String
Default: 'false'
AllowedValues: ['true', 'false']
Description: Enable Lambda Authorizer for API Gateway
CustomDomain:
Type: String
Default: ''
Description: Custom domain name for API Gateway (optional)
Outputs:
GatewayUrl:
Description: The URL of the API Gateway endpoint
Value: !GetAtt ApiGateway.Outputs.ApiEndpoint