Skip to content

KB-AI-LLC/semanticguard-terraform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

SemanticGuard — Terraform

Self-hosted deployment modules for SemanticGuard — the AI gateway with self-validating semantic caching that cuts LLM API costs across OpenAI, Anthropic, Google, Azure OpenAI, AWS Bedrock, and Mistral.

Bring SemanticGuard into your own cloud account in minutes. Your data, your VPC, your egress — no code from this repo runs anywhere outside your project.

semanticguard.dev · Docs · Benchmark · Pricing · Releases · Issues


What this repo gives you

Terraform modules to deploy SemanticGuard into your own cloud account. The app image is pulled from a public registry — ghcr.io/kb-ai-llc/sg-ai/monolith — and wired up to your managed Postgres, Redis, and vector store. No source code from SemanticGuard runs anywhere outside the cloud project you control.

Provider Status Module
GCP (Cloud Run + Memorystore + Secret Manager) ✅ Available ./gcp/
AWS (ECS + ElastiCache + Secrets Manager) 🛠️ Coming soon ./aws/
Azure (Container Apps + Cache for Redis + Key Vault) 🛠️ Coming soon ./azure/

Why self-host

  • Data residency. All prompt and response traffic stays inside your VPC / cloud account. Useful for HIPAA, GDPR-strict workloads, and air-gapped environments.
  • Egress control. Outbound calls only go to the upstream LLM provider you configure — nothing flows to a third-party gateway in between.
  • Cost predictability. Pay your own infra bill plus the SemanticGuard license. No per-request gateway markup.
  • One image, every cloud. Same container, same configuration surface — switch clouds without re-learning the product.

Quick start (GCP)

git clone https://github.com/KB-AI-LLC/semanticguard-terraform.git
cd semanticguard-terraform/gcp

cp terraform.tfvars.example terraform.tfvars
# Edit terraform.tfvars — required: project_id, image_url, database_url, redis_url, sg_license_key

terraform init
terraform apply

terraform output service_url

Then point your LLM clients at the returned service_url with an x-sg-api-key header. Full guide in ./gcp/README.md.

Prerequisites (every provider)

  • Terraform ≥ 1.6
  • The cloud provider's CLI authenticated locally (gcloud auth application-default login, aws configure, az login)
  • A PostgreSQL database — Neon, your cloud provider's managed Postgres, or any Postgres ≥ 14
  • A Redis instance — your cloud provider's managed Redis, Upstash, or self-managed
  • A SemanticGuard license key (sgl-xxxxx) — obtain from the GCP Marketplace onboarding page or by contacting enterprise@semanticguard.dev

Image versioning

Modules default to :latest for first-touch ergonomics. Pin a version for production:

image_url = "ghcr.io/kb-ai-llc/sg-ai/monolith:1.2.3"

Release notes and version list: https://github.com/KB-AI-LLC/sg-ai/releases.

Module layout

.
├── gcp/                    # Cloud Run + Memorystore + Secret Manager
│   ├── main.tf
│   ├── variables.tf
│   ├── outputs.tf
│   ├── modules/
│   └── terraform.tfvars.example
├── aws/                    # (coming soon)
├── azure/                  # (coming soon)
└── README.md

Each provider directory is a standalone root module — terraform init && apply from inside.

What the modules create

Category GCP resources
Compute Cloud Run service (scale-to-zero by default)
Identity Dedicated service account with least-privilege IAM
Secrets One Secret Manager secret per env var, mounted into Cloud Run
Registry Artifact Registry repo for custom-built images
Networking Optional VPC connector for private-IP Memorystore

Equivalent compositions on AWS and Azure are mapped one-for-one in the upcoming modules.

Contributing

Issues and PRs welcome — especially additional cloud providers, hardening tweaks, and example tfvars for common topologies. The product itself lives in a separate repository; bug reports and feature requests for the SemanticGuard service itself go to support@semanticguard.dev.

Support

License

The Terraform modules in this repository are released under the MIT License (see LICENSE). The SemanticGuard application image they deploy is governed by the SemanticGuard Terms of Service.


Operated by KB-AI LLC · Wyoming, USA · https://www.semanticguard.dev

About

Self-hosted SemanticGuard deployment modules — bring the AI gateway with self-validating semantic caching into your own GCP / AWS / Azure account. https://www.semanticguard.dev

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages