Skip to main content

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

  1. AI agent makes request to API Gateway with agent headers
  2. API Gateway invokes Lambda Authorizer before routing
  3. Lambda Authorizer extracts agent info and calls ASCEND Platform
  4. ASCEND Platform evaluates against policies and returns decision
  5. Lambda generates IAM policy (Allow/Deny) for API Gateway
  6. 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:

SettingDescriptionDefault
Cache TTLHow long to cache decisions60 seconds
Cache KeyWhat uniquely identifies a requestAgent ID + Action
Cache Approved OnlyOnly cache approved decisionsYes

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:

HeaderRequiredDescription
X-Ascend-Agent-IdYesUnique agent identifier
X-Ascend-EnvironmentNoEnvironment (production/staging/dev)
X-Ascend-Data-SensitivityNoData sensitivity level
X-Ascend-Tool-NameNoTool/capability being used
X-Ascend-Target-SystemNoTarget 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 StatusLambda ResponseResult
approvedAllowRequest proceeds
pending_approvalDenyRequest blocked (needs human review)
deniedDenyRequest blocked (policy violation)
Any errorDenyRequest blocked (fail-secure)

Configuration Options

Environment Variables

VariableDescriptionDefault
ASCEND_API_URLASCEND Platform API URLRequired
ASCEND_API_KEYAPI key for authenticationRequired
ASCEND_API_KEY_SECRET_ARNSecrets Manager ARN (preferred)None
ASCEND_ENVIRONMENTEnvironment contextproduction
ASCEND_CACHE_TTLCache TTL in seconds60
ASCEND_TIMEOUTAPI timeout in seconds4
LOG_LEVELLogging levelINFO

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:

MetricTargetTypical
Cold start< 500ms~200ms
Warm invocation< 100ms~50ms
Cache hit< 10ms~5ms
P99 latency< 100ms~75ms

Optimization Tips

  1. Use Provisioned Concurrency - Eliminates cold starts
  2. Enable Response Caching - Reduces ASCEND API calls
  3. Use ARM64 Architecture - Better price/performance
  4. 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:

StandardControlImplementation
SOC 2CC6.1All requests logged and audited
HIPAA164.312(d)Access control enforcement
PCI-DSS7.1Least privilege authorization
NISTAC-3Access enforcement

Troubleshooting

Common Issues

403 Forbidden on all requests:

  1. Check API key is valid
  2. Verify agent ID header is present
  3. Check CloudWatch logs for errors

High latency:

  1. Enable response caching
  2. Check network connectivity to ASCEND
  3. Consider provisioned concurrency

Cache not working:

  1. Verify cache TTL > 0
  2. Check cache key matches request pattern
  3. 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

Support