AWS Builder Center
CloudPilot AI: Automating AWS Architecture Design with Amazon Bedrock

CloudPilot AI: Automating AWS Architecture Design with Amazon Bedrock

CloudPilot AI simplifies AWS infrastructure design by analyzing project requirements and generating AI-assisted architecture recommendations, Terraform code, security guidance, cost estimates, and deployment workflows. Built for students, startups, and developers, it helps turn application ideas into deployment-ready AWS solutions faster and with greater confidence.

CloudPilot AI: Democratizing AWS Architecture Design with AI-Powered Infrastructure Automation

Introduction

Designing production-grade AWS architectures requires deep expertise in service selection, cost optimization, security best practices, and infrastructure-as-code. Yet most startups and small teams lack in-house AWS architects. CloudPilot AI bridges this gap by transforming plain-English project descriptions into fully deployable, production-ready AWS infrastructure—complete with architecture diagrams, cost estimates, security compliance checks, and modular Terraform code—all powered by Amazon Bedrock and automated deployment.

The Problem

AWS offers 200+ services. Choosing the right combination for a specific workload is non-trivial. Teams typically face one of three scenarios:
  1. Hiring bottleneck: Waiting weeks for an AWS architect to design the infrastructure costs time and money.
  1. Knowledge gaps: Engineers without AWS certification often make costly mistakes—oversized instances, missing security controls, non-optimal service choices.
  1. Manual tedium: Even experienced architects spend hours on repetitive tasks: diagramming, estimating costs, writing Terraform, documenting deployment steps.
For startups in cost-sensitive markets like India, these challenges are amplified. The need for rapid, correct, cost-effective infrastructure decisions is urgent.

The Solution: CloudPilot AI

CloudPilot AI is an end-to-end AWS Solutions Architect in software form. It operates in four orchestrated phases:
Phase 1: Rule-Based Intelligence A stateful Python pipeline extracts project metadata (name, goal, budget, timeline, user base) using NLP heuristics, identifies gaps in the requirements, and generates prioritized clarifying questions. Once validated, a modular solution generator produces:
  • Service-aware architecture (e.g., data pipelines get Kinesis + Glue + Redshift; static sites get S3 + CloudFront)
  • ASCII and Mermaid diagrams
  • Per-service cost breakdowns in Indian Rupees (₹)
  • Security recommendations across seven domains (IAM, encryption, VPC, security groups, secrets management, CloudTrail, CloudWatch)
  • DPDP Act compliance checks for India-based projects
  • Topologically-ordered deployment steps
  • Production-ready modular Terraform code
Phase 2: AI-Powered Refinement (Amazon Bedrock) Optional integration with Amazon Bedrock's Converse API replaces rule-based service selection with AI-generated architecture recommendations. The system serializes all confirmed requirements into a structured prompt, receives JSON-formatted architecture suggestions from Claude 3 Haiku, and gracefully falls back to rule-based logic if the API is unavailable—ensuring reliability.
Phase 3: Safe Deployment Automation A dedicated Terraform runner orchestrates the deployment lifecycle:
  • Writes generated HCL to a secure temporary directory
  • Executes  terraform init  →  validate  →  plan  (preview without creating resources)
  • Only applies changes when explicitly confirmed by the user
  • Captures all stdout, stderr, and exit codes in a structured result model
  • Handles timeouts, missing binaries, and unexpected exceptions without crashing
Phase 4: Streamlit Web Interface A five-step workflow guides users from description to deployment:
  1. Describe: Enter project requirements in plain English
  1. Clarify: Answer AI-generated follow-up questions (priority-ranked)
  1. Validate: Review structured requirements summary before proceeding
  1. Results: Five tabbed views (Architecture, Terraform, Cost, Security, Deployment)
  1. Deploy: Run Terraform plan, review outputs, confirm, and deploy to AWS with one click

Architecture & Technical Highlights

Modular Design Each component (ProjectAnalyzer, RequirementsGatherer, Validator, SolutionGenerator) is independently testable and reusable. All data flows through Pydantic v2 models, ensuring type safety and validation at every step.
Production-Ready Terraform The generated Terraform includes:
  • Unique resource naming via  random_id  suffixes (eliminates naming collisions)
  • Auto-packaged Lambda functions (no manual ZIP creation)
  • Secure RDS password generation via  random_password  resource
  • Globally unique S3 bucket names with project-scoped naming conventions
  • Configurable CloudWatch log retention
  • Default tags for cost allocation and governance
  • Comprehensive outputs (API endpoints, Lambda ARNs, database names, log group paths)
Service-Aware Logic Seven project types are supported with type-specific service selection:
  • Web App: ALB, ECS, RDS, ElastiCache
  • Data Pipeline: Kinesis, Glue, Redshift, S3
  • Mobile Backend: API Gateway, Lambda, DynamoDB, SQS
  • IoT Platform: IoT Core, Kinesis, Lambda, S3
  • ML Platform: SageMaker, S3, Lambda, CloudWatch
  • Static Site: S3, CloudFront, Route 53
  • API Service: API Gateway, Lambda, DynamoDB, CloudWatch
Cost Optimization Costs are calculated in Indian Rupees using current AWS pricing, adjusted by traffic multipliers. Users see three scalability tiers (Small Startup → Growing → Enterprise) with progressively optimized architectures and costs.
Security & Compliance Every architecture includes:
  • Least-privilege IAM policies
  • Encryption in transit and at rest
  • VPC isolation with security groups
  • Secrets Manager integration
  • CloudTrail audit logging
  • CloudWatch monitoring
  • DPDP (Digital Personal Data Protection) Act compliance checks when applicable

Testing & Reliability

CloudPilot AI includes a comprehensive test suite of 411 passing tests across 11 test files:
  • ProjectAnalyzer: 49 tests (regex extraction, edge cases)
  • RequirementsGatherer: 32 tests (question prioritization)
  • Validator: 28 tests (summary accuracy, confirmation gates)
  • SolutionGenerator: 28 tests (all outputs non-null, justifications)
  • ArchitectureDiagrammer: 24 tests (Mermaid rendering, ASCII fallback)
  • CostEstimator: 22 tests (INR currency, traffic scaling)
  • SecurityAdvisor: 25 tests (all seven domains, compliance logic)
  • ScalabilityPlanner: 15 tests (three tiers, cost progression)
  • DeploymentPlanner: 22 tests (topological sorting, dependencies)
  • TerraformGenerator: 49 tests (HCL syntax, resource types, fixes)
  • BedrockIntegration: 33 tests (API mocking, fallback behavior)
  • TerraformRunner: 41 tests (subprocess mocking, full lifecycle)
  • EndToEnd: 43 tests (workflow transitions, error recovery)
Zero real AWS calls in tests—all Bedrock and AWS SDK interactions are mocked, ensuring fast, reliable CI/CD pipelines.

Real-World Impact

CloudPilot AI was built during a two-day AWS hackathon at Amazon's Chennai office, reaching Phase 1 completion with all 324 planned tests passing. It directly addresses the infrastructure design bottleneck:
  • Speed: From hours of manual architecture work to seconds
  • Accuracy: Rule-based and AI-powered logic reduce costly mistakes
  • Accessibility: Non-architects can now design production-grade AWS infrastructure
  • Cost Awareness: Built-in cost estimation in local currency (₹) helps startups stay within budget
  • Compliance Ready: Automatic security and regulatory checks eliminate post-deployment surprises

Key Learnings

1. Modular Pipeline Architecture Wins Decoupling concerns (analysis → clarification → validation → generation → deployment) makes the system resilient and testable. Each phase can fail gracefully without cascading.
2. AI as Enhancement, Not Replacement Bedrock integration works best when it enhances rule-based logic, not replaces it. Fallback mechanisms are essential for production reliability.
3. Pydantic Models Are Your Friend Using Pydantic v2 throughout eliminated entire classes of bugs. Type safety caught issues early and made testing trivial.
4. Terraform Modules Should Be Generated Carefully Auto-generating HCL requires deep knowledge of edge cases: resource naming collisions, password management, file packaging, unique constraints. Comprehensive testing is non-negotiable.
5. User Validation Gates Matter Asking users to confirm structured requirements before generation prevented bad outputs and built trust in the tool.

Technology Stack

  • Language: Python 3.12
  • Data Models: Pydantic v2
  • AI/LLM: Amazon Bedrock (Claude 3 Haiku via Converse API)
  • Infrastructure as Code: Terraform >= 1.5, AWS Provider v5
  • Web UI: Streamlit >= 1.30
  • Testing: pytest with mocked subprocess and boto3
  • Cloud: AWS (Lambda, DynamoDB, SQS, API Gateway, CloudWatch, S3, RDS, and 15+ other services)

Getting Started

CloudPilot AI is open-source and production-ready. Users can:
  1. Clone the repository and install dependencies
  1. Configure AWS credentials via the standard SDK chain
  1. Run the Streamlit app locally:  streamlit run app.py 
  1. Describe their project in plain English
  1. Answer clarifying questions
  1. Review the generated architecture, Terraform, cost breakdown, and security recommendations
  1. Deploy to AWS with a single button click
The modular architecture also makes it easy for developers to extend CloudPilot AI with custom generators, new AWS services, or domain-specific logic.

Conclusion

CloudPilot AI demonstrates how AI and infrastructure automation can democratize AWS architecture design. By combining rule-based intelligence, Amazon Bedrock integration, comprehensive security and compliance checks, and one-click deployment, it transforms AWS expertise from a scarce resource into an accessible tool for every team.
Whether you're a startup designing your first infrastructure, a team scaling to enterprise, or an architect looking to automate repetitive work, CloudPilot AI delivers production-grade AWS architectures in minutes—not hours.
The future of infrastructure design is here. It's intelligent, accessible, and deployed with a single click.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article