Skip to main content

The Rails of Modern Infrastructure - Enterprise DSL for Infrastructure Management

Project description

InfraDSL

The Rails of Modern Infrastructure - Enterprise DSL for Infrastructure Management

PyPI version Python Versions License: MIT

InfraDSL is a next-generation Infrastructure as Code (IaC) tool that brings Rails-like conventions and chainable APIs to cloud infrastructure management. It combines the simplicity of Python with powerful multi-cloud capabilities, intelligent caching, and self-healing infrastructure.

✨ Key Features

  • 🚀 Rails-like DSL: Chainable, intuitive APIs that feel natural to developers
  • ☁️ Multi-Cloud Native: AWS, GCP, Azure, DigitalOcean support with unified syntax
  • 🧠 Intelligent Import: Superior import system with dependency analysis and fingerprint-based caching
  • ⚡ Performance First: PostgreSQL-backed caching, parallel execution, and smart resource detection
  • 🔄 Self-Healing: Automatic drift detection and remediation with customizable policies
  • 📊 Enterprise Ready: RBAC, audit logging, cost optimization, and compliance features

🚀 Quick Start

Installation

pip install infradsl

Basic Example

from infradsl import AWS

# Create a simple web server with Rails-like chainability
vm = (AWS.EC2("web-server")
      .instance_type("t3.micro")
      .ubuntu_24_04()
      .key_pair("my-key")
      .security_group("web-sg")
      .public_ip()
      .production())

# Create VPC with intelligent defaults
vpc = (AWS.VPC("main-vpc")
       .cidr("10.0.0.0/16")
       .enable_dns()
       .multi_az()
       .production())

# CloudFront CDN with S3 origin
cdn = (AWS.CloudFront("website-cdn")
       .s3_origin("my-website-bucket")
       .custom_domain("www.example.com")
       .ssl_certificate("arn:aws:acm:...")
       .gzip_compression()
       .production())

CLI Usage

# Initialize a new project
infra init myproject

# Import existing infrastructure
infra import aws --region us-east-1

# Preview changes
infra preview infrastructure.py

# Apply changes
infra apply infrastructure.py --production

# Monitor drift and auto-heal
infra heal start --auto-remediate

🏗️ Architecture

InfraDSL is built on several core principles:

1. Rails-like Conventions

  • Convention over Configuration: Intelligent defaults for common patterns
  • Chainable APIs: Fluent interfaces that read like natural language
  • Environment Presets: .production(), .staging(), .development() with optimized settings

2. Superior Import System

  • Dependency-Aware: Automatically resolves resource relationships
  • Fingerprint Caching: PostgreSQL-backed cache for instant resource recognition
  • Intelligent Organization: Groups imported resources by function and dependencies

3. Multi-Cloud Abstraction

# Same API across all clouds
AWS.VirtualMachine("web").ubuntu().production()
GCP.VirtualMachine("web").ubuntu().production() 
Azure.VirtualMachine("web").ubuntu().production()

📚 Documentation

🌟 Examples

Multi-Cloud Application

from infradsl import AWS, GCP

# AWS Infrastructure
app_server = (AWS.EC2("app")
              .instance_type("t3.medium")
              .ubuntu_24_04()
              .auto_scaling_group(2, 10)
              .production())

# GCP Database
database = (GCP.CloudSQL("app-db")
            .postgres_15()
            .high_availability()
            .backup_schedule("0 2 * * *")
            .production())

# Cross-cloud networking automatically configured

Static Website with CDN

from infradsl import AWS

# Website bucket
website = (AWS.S3("my-website")
           .website("index.html", "404.html")
           .public_read()
           .production())

# Global CDN
cdn = (AWS.CloudFront("website-cdn")
       .s3_origin("my-website")
       .custom_domain("www.example.com")
       .ssl_certificate("arn:aws:acm:...")
       .price_class_all()
       .production())

# DNS routing
dns = (AWS.Route53("example-dns")
       .use_existing_zone("example.com")
       .cloudfront_alias("www", cdn)
       .production())

Self-Healing Infrastructure

from infradsl import AWS, DriftAction

# Auto-healing web servers
web_servers = (AWS.EC2("web-cluster")
               .instance_type("t3.medium")
               .auto_scaling_group(3, 20)
               .health_check_grace_period(300)
               .drift_policy(DriftAction.AUTO_HEAL)
               .production())

# Automatic failover database
database = (AWS.RDS("app-db")
            .postgres_15()
            .multi_az()
            .backup_retention(30)
            .drift_policy(DriftAction.ALERT_AND_HEAL)
            .production())

🔧 Advanced Features

Import Existing Infrastructure

# Import AWS resources with dependency analysis
infra import aws --region us-east-1 --analyze-dependencies

# Import specific resource types
infra import gcp --project my-project --resources compute,storage

# Import with custom organization
infra import aws --organize-by environment,function

Intelligent Caching

# View cache statistics
infra cache stats

# Clear and rebuild cache
infra cache clear --rebuild

# Cache performance metrics
infra cache analyze --performance

Cost Optimization

# Built-in cost optimization
vm = (AWS.EC2("web")
      .cost_optimized()  # Automatically selects best instance type
      .spot_instances()   # Use spot instances when possible
      .production())

# Cost insights
infra insights cost --forecast 30d

🤝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

Development Setup

git clone https://github.com/infradsl/infradsl.git
cd infradsl
pip install -e ".[dev]"
pre-commit install

Running Tests

pytest
pytest --cov=infradsl --cov-report=html

📄 License

InfraDSL is released under the MIT License.

🆘 Support

🗺️ Roadmap

  • ✅ Multi-cloud resource management (AWS, GCP, Azure, DigitalOcean)
  • ✅ Superior import system with dependency analysis
  • ✅ PostgreSQL-backed intelligent caching
  • ✅ Self-healing infrastructure capabilities
  • 🚧 Kubernetes native integration
  • 🚧 Terraform migration tools
  • 🚧 Advanced security scanning
  • 🚧 GitOps integration

Made with ❤️ by the InfraDSL Team

InfraDSL - Infrastructure as Code, Redefined

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

infradsl-0.1.5.tar.gz (613.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

infradsl-0.1.5-py3-none-any.whl (767.7 kB view details)

Uploaded Python 3

File details

Details for the file infradsl-0.1.5.tar.gz.

File metadata

  • Download URL: infradsl-0.1.5.tar.gz
  • Upload date:
  • Size: 613.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for infradsl-0.1.5.tar.gz
Algorithm Hash digest
SHA256 61c8eb61bf4f06b1cedd6905ceb383ed12e9bdc5b457644bc927762b67e5f0b2
MD5 6989280b344bd0fc3eac913d163c034a
BLAKE2b-256 405d2bac46d0870fa285784bc4fc0e9e2325ad2af78c94c148ba278d4f783fbf

See more details on using hashes here.

File details

Details for the file infradsl-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: infradsl-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 767.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for infradsl-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 c0bad61921e9b100f4990afb2b756b00e6b832333881de55636329397713f4e6
MD5 3b607aaa1bb258e461603afa5da3e4ff
BLAKE2b-256 38755ad42a2d1d987f8297dddbd22be516d1ee32ebda7b1cce6a72ae7b1d91d5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page