EventBridge — API Caller
A Lambda function triggered by an Amazon EventBridge rule that loads an authentication token from AWS Secrets Manager, calls an external HTTP API, and persists the response to a DynamoDB table.
Architecture
The template sets up:
- Amazon EventBridge rule: Triggers the function based on a schedule or event pattern.
- AWS Lambda function: Loads secrets, calls the external API, and saves the response.
- AWS Secrets Manager: Securely stores the API authentication token.
- Amazon DynamoDB table: Persists the API responses.

Code
- Function code:
templates/eventbridge - Unit tests:
tests/eventbridge - Infra stack:
infra/stacks/eventbridge.py
Deployment
Deploy the stack using:
mise run deploy eventbridge
Data models
| Model | Description |
|---|---|
EventBridgeEvent |
Incoming EventBridge event payload (source, detail_type, detail) |
ApiResponse |
Response from the external HTTP API (id, message) |
Settings |
Runtime configuration from environment variables |
ApiResponse
Written to the DynamoDB table after calling the external API.
| Field | Type | Description |
|---|---|---|
id |
string | Unique identifier of the API response record (1-50 chars) |
message |
string | Message returned by the external API (1-1000 chars) |
Environment variables
| Variable | Description | Required | Default |
|---|---|---|---|
API_URL |
URL of the external HTTP API to call | Yes | - |
TABLE_NAME |
DynamoDB table name for persisting API responses | Yes | - |
SECRET_NAME |
AWS Secrets Manager secret name holding the API token | Yes | - |
SERVICE_NAME |
Powertools service name | No | eventbridge |
METRICS_NAMESPACE |
CloudWatch metrics namespace | No | EventBridge |
LOG_LEVEL |
Log level for the Lambda Logger | No | INFO |