Skip to content
reaatechREAATECH

Files · AWS Bedrock AI Incident Runbook for DevOps-light SMBs

36 (0 binary, 273.0 kB total)attempt 3

README.md·2166 B·markdown
markdown
# AWS Bedrock AI Incident Runbook for DevOps-light SMBs
 
Automated incident response and rollback for AI agents, so lean teams can sleep without production nightmares.
 
## Architecture
 
```mermaid
flowchart LR
    A[AI Agent Webhook] --> B[Fastify Server]
    B --> C[Classify Incident]
    C --> D[AWS Bedrock LLM]
    D --> E[Incident Summary]
    D --> F[Remediation Plan]
    C --> G{Rollback Needed?}
    G -->|Yes| H[Generate Rollback Procedures]
    H --> I[Send Slack Alert]
    G -->|No| I
    I --> J[Return JSON Response]
    E --> J
    F --> J
```
 
## Setup
 
### Prerequisites
 
- Node.js >= 22
- pnpm 10.x
- An AWS account with Bedrock access
- A Slack webhook URL (optional)
 
### Environment Variables
 
| Variable | Description | Example |
|----------|-------------|---------|
| `BEDROCK_REGION` | AWS region for Bedrock | `us-east-1` |
| `BEDROCK_MODEL_ID` | Bedrock model ID | `amazon.nova-micro-v1:0` |
| `SLACK_WEBHOOK_URL` | Slack incoming webhook URL | `https://hooks.slack.com/services/...` |
| `FASTIFY_PORT` | Fastify server port (default: 3001) | `3001` |
| `NEXT_PUBLIC_API_BASE` | API base URL for Next.js dashboard | `http://localhost:3001` |
 
### Installation
 
```bash
pnpm install
```
 
### Build
 
```bash
pnpm build
```
 
### Run
 
```bash
# Start the Fastify incident API server
pnpm start
 
# Start the Next.js admin dashboard (separate terminal)
pnpm dev
```
 
### Usage
 
Send an incident alert to the API:
 
```bash
curl -X POST http://localhost:3001/api/incidents \
  -H "Content-Type: application/json" \
  -d '{
    "serviceName": "customer-support-bot",
    "alertPayload": {
      "type": "database-connection-failure",
      "error": "connection refused"
    },
    "timestamp": "2025-01-01T00:00:00Z"
  }'
```
 
Check server health:
 
```bash
curl http://localhost:3001/health
```
 
### AWS Bedrock Model Access
 
Ensure your AWS account has access to the Bedrock model specified in `BEDROCK_MODEL_ID`. You may need to request model access through the AWS Bedrock console.
 
## Development
 
```bash
pnpm typecheck    # TypeScript type checking
pnpm lint         # ESLint
pnpm test         # Run tests with coverage
```
 
## License
 
MIT