Lambda Authorizer Overview
Deploy ASCEND governance to your AWS API Gateway with zero code changes using Lambda authorizers.
What is the ASCEND Lambda Authorizer?
The ASCEND Lambda Authorizer is a pre-built AWS Lambda function that integrates with API Gateway to provide real-time authorization decisions for AI agent API calls. Every request is evaluated against your organization's policies before reaching your backend services.
Architecture
ASCEND Platform
|
(authorization)
|
┌──────────┐ ┌─────────────┐ ┌──────────────┐ ┌──────────────┐
│ AI Agent │───>│ API Gateway │───>│ Lambda │───>│ Backend │
│ │ │ │ │ Authorizer │ │ Service │
└──────────┘ └─────────────┘ └──────────────┘ └──────────────┘
│
(Allow/Deny)
How It Works
- AI agent makes request to API Gateway with agent headers
- API Gateway invokes Lambda Authorizer before routing
- Lambda Authorizer extracts agent info and calls ASCEND Platform
- ASCEND Platform evaluates against policies and returns decision
- Lambda generates IAM policy (Allow/Deny) for API Gateway
- API Gateway routes request (if allowed) or returns 403
Key Features
Zero-Code Integration
Deploy as a Lambda function - no modifications to existing APIs required.
# API Gateway configuration
Type: AWS::ApiGateway::Authorizer
Properties:
Name: AscendAuthorizer
Type: REQUEST
AuthorizerUri: !Sub arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${AscendAuthorizerArn}/invocations
Fail-Secure Design
All errors result in DENY responses - following security best practices.
# From handler.py
def lambda_handler(event, context):
try:
# Evaluate with ASCEND
decision = ascend.evaluate(...)
except Exception:
# FAIL SECURE: deny on any error
return generate_deny_policy()
Response Caching
Configurable caching reduces latency for repeated requests:
| Setting | Description | Default |
|---|---|---|
| Cache TTL | How long to cache decisions | 60 seconds |
| Cache Key | What uniquely identifies a request | Agent ID + Action |
| Cache Approved Only | Only cache approved decisions | Yes |
Full Observability
- CloudWatch Metrics: Decisions, latency, errors
- CloudWatch Logs: Structured JSON logging
- X-Ray Tracing: End-to-end request tracing
- CloudWatch Dashboard: Pre-built monitoring dashboard
Request Headers
AI agents must include these headers in requests:
| Header | Required | Description |
|---|---|---|
X-Ascend-Agent-Id | Yes | Unique agent identifier |
X-Ascend-Environment | No | Environment (production/staging/dev) |
X-Ascend-Data-Sensitivity | No | Data sensitivity level |
X-Ascend-Tool-Name | No | Tool/capability being used |
X-Ascend-Target-System | No | Target resource identifier |
Example Request
curl -X POST https://api.example.com/data \
-H "X-Ascend-Agent-Id: my-ai-agent" \
-H "X-Ascend-Environment: production" \
-H "X-Ascend-Tool-Name: database.query" \
-H "Content-Type: application/json" \
-d '{"query": "SELECT * FROM customers"}'
Response Context
The authorizer adds context to approved requests via API Gateway:
{
"requestContext": {
"authorizer": {
"ascendActionId": "act_abc123",
"ascendAgentId": "my-ai-agent",
"ascendRiskScore": 35,
"ascendRiskLevel": "low",
"ascendEnvironment": "production"
}
}
}
Your backend can access this context for additional processing.
Decision Logic
The authorizer uses this decision logic:
| ASCEND Status | Lambda Response | Result |
|---|---|---|
approved | Allow | Request proceeds |
pending_approval | Deny | Request blocked (needs human review) |
denied | Deny | Request blocked (policy violation) |
| Any error | Deny | Request blocked (fail-secure) |
Configuration Options
Environment Variables
| Variable | Description | Default |
|---|---|---|
ASCEND_API_URL | ASCEND Platform API URL | Required |
ASCEND_API_KEY | API key for authentication | Required |
ASCEND_API_KEY_SECRET_ARN | Secrets Manager ARN (preferred) | None |
ASCEND_ENVIRONMENT | Environment context | production |
ASCEND_CACHE_TTL | Cache TTL in seconds | 60 |
ASCEND_TIMEOUT | API timeout in seconds | 4 |
LOG_LEVEL | Logging level | INFO |
CloudFormation Parameters
Parameters:
AscendApiUrl:
Type: String
Default: https://api.ascend.owkai.app
AscendApiKeySecret:
Type: String
Description: ARN of Secrets Manager secret
Environment:
Type: String
Default: production
AllowedValues:
- production
- staging
- development
CacheTtlSeconds:
Type: Number
Default: 60
MinValue: 0
MaxValue: 300
Performance
The Lambda Authorizer is optimized for low latency:
| Metric | Target | Typical |
|---|---|---|
| Cold start | < 500ms | ~200ms |
| Warm invocation | < 100ms | ~50ms |
| Cache hit | < 10ms | ~5ms |
| P99 latency | < 100ms | ~75ms |
Optimization Tips
- Use Provisioned Concurrency - Eliminates cold starts
- Enable Response Caching - Reduces ASCEND API calls
- Use ARM64 Architecture - Better price/performance
- Deploy in Same Region - Minimize network latency
Security
API Key Storage
Store API keys in AWS Secrets Manager:
aws secretsmanager create-secret \
--name ascend/api-key \
--secret-string '{"api_key":"owkai_prod_xxxx"}'
IAM Permissions
Minimum required permissions:
- Effect: Allow
Action:
- secretsmanager:GetSecretValue
Resource: !Ref AscendApiKeySecret
- Effect: Allow
Action:
- logs:CreateLogStream
- logs:PutLogEvents
Resource: !Sub 'arn:aws:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/lambda/ascend-authorizer-*'
VPC Deployment
For private API endpoints, deploy Lambda in VPC:
VpcConfig:
SecurityGroupIds:
- !Ref AuthorizerSecurityGroup
SubnetIds:
- !Ref PrivateSubnet1
- !Ref PrivateSubnet2
Compliance
The Lambda Authorizer supports compliance requirements:
| Standard | Control | Implementation |
|---|---|---|
| SOC 2 | CC6.1 | All requests logged and audited |
| HIPAA | 164.312(d) | Access control enforcement |
| PCI-DSS | 7.1 | Least privilege authorization |
| NIST | AC-3 | Access enforcement |
Troubleshooting
Common Issues
403 Forbidden on all requests:
- Check API key is valid
- Verify agent ID header is present
- Check CloudWatch logs for errors
High latency:
- Enable response caching
- Check network connectivity to ASCEND
- Consider provisioned concurrency
Cache not working:
- Verify cache TTL > 0
- Check cache key matches request pattern
- Ensure approved decisions only
Debug Mode
Enable debug logging for troubleshooting:
LOG_LEVEL: DEBUG
View logs in CloudWatch:
aws logs tail /aws/lambda/ascend-authorizer-production --follow
Next Steps
- Deployment Guide - Deploy with SAM/CloudFormation
- Python SDK - Client-side integration
- API Reference - Direct API usage
Support
- Documentation: https://docs.owkai.app
- Support: support@owkai.app
- GitHub Issues: https://github.com/owkai/ascend-lambda-authorizer/issues