CStream case study

Turning Cloud Vulnerability Findings into Instant, Validated Infrastructure as Code

Protagona partnered with CStream to build a serverless, AI-powered pipeline that converts cloud vulnerability findings into validated, deployment-ready Terraform code automatically, cutting the time between detection and remediation from days to seconds.

Industry

Startups & Software

Teams & Services

DevOps, Back-End Engineering, Machine Learning, Security

Tech & Tools

Amazon Bedrock, Amazon API Gateway, AWS Lambda, Amazon S3, Amazon DynamoDB, Amazon CloudWatch, Anthropic Claude 3, Bedrock Converse API, Python, Boto3, Terraform, Docker, Bitbucket

Key Data Points

Delivered a self-healing code generation pipeline with automated retry logic, structured error feedback, and explicit safeguards against infinite loops and context overflow.
Achieved a ~10-minute recovery time objective and regional redeployment capability through a fully serverless, multi-availability-zone architecture with no idle compute.
Reduced time to resolve critical vulnerabilities by 60% and cut customer configuration onboarding time by 30%.

The Vision

CStream operates a compliance intelligence platform that continuously scans customer cloud environments to surface vulnerabilities and governance gaps. Detection speed was always the platform's strength. But fast detection left a gap: customers still had to translate each finding into remediation code, a process that stretched from days to weeks and required DevOps engineers to hand-write Terraform aligned to specific security controls. CStream set out to make remediation as fast and reliable as identification.

The Goal

Protagona was engaged to build a production-grade API that accepts a vulnerability finding and returns validated, standards-aligned Terraform code ready for deployment. The target was a concrete, deployable fix delivered automatically, cutting the time between detection and remediation and reducing the configuration burden on customer DevOps teams.

The Challenge

Generating infrastructure as code against an existing cloud environment is materially harder than generating greenfield code. Output must satisfy both Terraform syntax rules and the specific security controls each customer has adopted. A failed validation cannot be a dead end: the system must recognize failure, feed structured error information back into the generation loop, and produce corrected code without human intervention. The pipeline also had to be safe under adversarial conditions. Infinite retry loops, oversized model context windows, and Lambda timeout boundaries all required explicit handling. In a serverless architecture with no persistent compute, state had to be tracked externally and the entire pipeline had to be recoverable within a tight recovery time objective. Coordinating generation, validation, retry, and retrieval across discrete functions while keeping failure modes clean required careful architectural discipline.

The Solution

Protagona designed a serverless, event-driven pipeline on AWS that moves a vulnerability finding through generation, validation, and retrieval without manual steps. Amazon API Gateway accepts a process identifier, a reference to a standards document in S3, and a controls payload. That single call sets the entire remediation workflow in motion.

A generation function reads the standards document and submits a structured prompt to Anthropic Claude 3 via the Bedrock Converse API with tool use enabled. The model produces Terraform code written to S3, which triggers a validation function running terraform validate through a Lambda layer, keeping validation logic self-contained and version-controlled. When validation fails, structured error output returns directly to the model for revision and retry. Explicit safeguards cap retry depth, guard against context overflow, and enforce timeout boundaries. DynamoDB serves as the durable status store throughout, giving every function in the chain a low-latency record of each job's progress. A retrieval function reads the completed code and returns it through the API. Deployments run through Bitbucket on pull request, and CloudWatch provides observability across all functions.

OUTCOMES

Your data is trying to tell you something

Contact us

... are you listening?