Skip to main content

AWS Environment Replication Tool - Clone production to staging in minutes

Project description

RepliMap

Python versions Tests License

AWS Infrastructure Staging Cloner

Point at your Production AWS and generate cost-optimized Staging Terraform in minutes.

๐Ÿ”’ Read-only mode | ๐Ÿ“ All data stays local | โšก Minutes, not hours

Overview

RepliMap scans your AWS resources, builds a dependency graph, and generates Infrastructure-as-Code to replicate your environment with intelligent transformations:

  • Instance Downsizing: Automatically reduces EC2/RDS instance sizes for cost savings
  • Environment Renaming: Transforms names from prod to staging
  • Sensitive Data Sanitization: Removes secrets, passwords, and hardcoded credentials
  • Dependency Awareness: Understands VPC โ†’ Subnet โ†’ EC2 relationships

Installation

Recommended: pipx (isolated environment)

# Install pipx if you don't have it
brew install pipx && pipx ensurepath  # macOS
# or: pip install --user pipx && pipx ensurepath  # Linux

# Install RepliMap
pipx install replimap

# Verify installation
replimap --version

# Update later
pipx upgrade replimap

Alternative: pip

pip install replimap

Alternative: uv

uv pip install replimap

Docker (no Python required)

# Pull the image
docker pull replimap/replimap:latest

# Run with AWS credentials
docker run -v ~/.aws:/root/.aws replimap/replimap scan --profile prod --region us-east-1

Quick Start

1. Verify Installation

replimap --version

2. Scan Your AWS Environment

# Basic scan (scans all resources in region)
replimap scan --profile prod --region us-east-1

# Scan a specific VPC only
replimap scan --profile prod --scope vpc:vpc-12345678

# Scan resources by tag (e.g., Application=MyApp)
replimap scan --profile prod --entry tag:Application=MyApp

# Scan starting from an entry point (e.g., ALB)
replimap scan --profile prod --entry alb:my-app-alb

# Use cached results for faster incremental scans
replimap scan --profile prod --cache

3. Generate Infrastructure-as-Code

# Preview what will be generated
replimap clone --profile prod --mode dry-run

# Generate Terraform files
replimap clone --profile prod --output-dir ./staging-tf --mode generate

# Generate with custom transformations
replimap clone --profile prod --output-dir ./staging-tf \
  --rename-pattern "prod:staging" \
  --downsize \
  --mode generate

4. Apply to Your Staging Account

cd ./staging-tf

# Quick validation (no AWS credentials needed)
make quick-validate

# Or use the test script
./test-terraform.sh

# Full workflow with Makefile
make init                    # Initialize Terraform
make plan                    # Plan changes (outputs tfplan.txt)
make apply                   # Apply the plan

# Alternative: manual Terraform commands
terraform init
terraform plan -out=tfplan
terraform apply tfplan

5. Available Makefile Targets

The generated Terraform includes a comprehensive Makefile:

make help                    # Show all targets
make plan                    # Plan and save to tfplan + tfplan.txt
make plan-target TARGET=...  # Plan specific resource
make plan-json               # Plan with JSON output
make apply                   # Apply saved plan
make destroy                 # Destroy (requires confirmation)
make state-list              # List resources in state
make clean                   # Remove generated files

6. Check License & Usage

# View license status
replimap license status

# View usage statistics
replimap license usage

# Activate a license key (format: RM-XXXX-XXXX-XXXX-XXXX)
replimap license activate RM-XXXX-XXXX-XXXX-XXXX

Graph-Based Selection Engine

RepliMap uses intelligent graph traversal instead of simple filtering. This ensures complete, working infrastructure clones.

Selection Modes

# VPC Scope - Select everything in a VPC
replimap scan --profile prod --scope vpc:vpc-12345678
replimap scan --profile prod --scope vpc-name:Production*

# Entry Point - Start from a resource and follow dependencies
replimap scan --profile prod --entry alb:my-app-alb
replimap scan --profile prod --entry tag:Application=MyApp

# Tag-Based - Select by tags
replimap scan --profile prod --tag Environment=Production

YAML Configuration (Advanced)

For complex selection scenarios, use a YAML config file:

# selection.yaml
selection:
  mode: entry_point
  entry_points:
    - type: alb
      name: my-app-*
  dependency_direction: both
  max_depth: 5
  boundary_config:
    network_boundaries:
      - transit_gateway
      - vpc_peering
    identity_boundaries:
      - iam_role
  clone_mode: isolated
  exclusions:
    types:
      - cloudwatch_log_group
    patterns:
      - "*-backup-*"
replimap scan --profile prod --config selection.yaml

Boundary Handling

RepliMap intelligently handles infrastructure boundaries:

Boundary Type Resources Default Behavior
Network Transit Gateway, VPC Peering Create as data source
Identity IAM Roles, Policies Reference existing
Global Route53, CloudFront Create variables

Security Auditing

RepliMap includes security auditing powered by Checkov for scanning your AWS infrastructure.

# Run security audit on scanned infrastructure
replimap audit --profile prod --region us-east-1

# Output to HTML report
replimap audit --profile prod --format html --output audit-report.html

# Output to JSON for CI/CD integration
replimap audit --profile prod --format json --output audit.json

# Exit with non-zero code on failures (for CI/CD)
replimap audit --profile prod --ci

# Scan specific VPC
replimap audit --profile prod --scope vpc:vpc-12345678

Infrastructure Visualization

Generate interactive visualizations of your AWS infrastructure dependencies.

# Generate Mermaid diagram
replimap graph --profile prod --format mermaid

# Generate interactive HTML (D3.js)
replimap graph --profile prod --format html --output infra-graph.html

# Export as JSON for custom tooling
replimap graph --profile prod --format json --output graph.json

# Scope to specific VPC
replimap graph --profile prod --vpc vpc-12345678

Graph Simplification

By default, graphs are simplified for readability by hiding noisy resources (SG rules, routes) and collapsing large groups of similar resources.

# Show all resources (no filtering or grouping)
replimap graph -r us-east-1 --all

# Include security group rules
replimap graph -r us-east-1 --sg-rules

# Include routes and route tables
replimap graph -r us-east-1 --routes

# Disable resource grouping (show individual nodes)
replimap graph -r us-east-1 --no-collapse

# Security-focused view (show SGs, IAM, KMS)
replimap graph -r us-east-1 --security
Option Description
--all, -a Show all resources without filtering
--sg-rules Include security group rules
--routes Include routes and route tables
--no-collapse Disable resource grouping
--security Security-focused view

Advanced Graph Features

The interactive HTML graph includes several advanced visualization features:

Feature Description
Link Classification Toggle between traffic flow and infrastructure dependency views
Cost Overlay Heat map showing estimated monthly cost per resource (low/medium/high/critical)
Blast Radius Click a resource to visualize the impact of changes or failures
Orphan Detection Highlight unused resources with estimated cost savings
Drift Visualization Show resources that have drifted from Terraform state
Tool Modes Select/Trace/Blast modes for different analysis types
Breadcrumbs Navigation history with ESC key to go back

Infrastructure Drift Detection

Detect drift between your Terraform state and actual AWS resources.

# Detect drift using local state file
replimap drift --profile prod --state ./terraform.tfstate

# Detect drift using remote S3 backend
replimap drift --profile prod \
  --remote-bucket my-tf-state \
  --remote-key prod/terraform.tfstate \
  --remote-region us-east-1

# Output HTML report
replimap drift --profile prod --state ./terraform.tfstate \
  --format html --output drift-report.html

# CI/CD mode (exit code reflects drift status)
replimap drift --profile prod --state ./terraform.tfstate --ci

# Scope to specific VPC
replimap drift --profile prod --state ./terraform.tfstate \
  --scope vpc:vpc-12345678

Exit Codes (CI Mode)

Code Meaning
0 No drift detected
1 Drift detected (or critical/high severity drift)
2 Error during detection

Dependency Explorer

Explore what resources may be affected before modifying or deleting a resource.

Important: This analysis is based on AWS API metadata only. Application-level dependencies (hardcoded IPs, DNS, config files) are NOT detected. Always validate all dependencies before making infrastructure changes.

# Explore dependencies for a security group
replimap deps sg-12345 -r us-east-1

# Show dependency tree view
replimap deps vpc-abc123 -r us-east-1 --format tree

# Generate interactive HTML visualization
replimap deps i-xyz789 -r us-east-1 -f html -o deps.html

# Limit analysis depth
replimap deps vpc-12345 -r us-east-1 --depth 3

# Scope to a specific VPC
replimap deps sg-12345 -r us-east-1 --vpc vpc-abc123

Output Formats

Format Description
console Rich terminal output with summary (default)
tree Tree view of dependencies
table Table of affected resources
html Interactive D3.js visualization
json Machine-readable JSON

Estimated Impact Levels

Note: These are estimates based on AWS API metadata only.

Level Score Description
CRITICAL 90-100 Core infrastructure (VPC, main DB)
HIGH 70-89 Production services
MEDIUM 40-69 Supporting resources
LOW 1-39 Peripheral resources
NONE 0 No downstream impact detected
UNKNOWN - Impact cannot be determined

Cost Estimation

Estimate monthly AWS costs for your infrastructure with optimization recommendations.

Important: Cost estimates are for planning purposes only. Actual costs may differ due to data transfer, API calls, reserved instances, and other factors not included in estimates.

# Estimate costs for current region
replimap cost -r us-east-1

# Estimate costs for a specific VPC
replimap cost -r us-east-1 --vpc vpc-12345

# Export to HTML report with charts
replimap cost -r us-east-1 -f html -o cost-report.html

# Export to CSV for spreadsheet analysis
replimap cost -r us-east-1 -f csv -o costs.csv

# Export to JSON for automation
replimap cost -r us-east-1 -f json -o costs.json

# Export to Markdown report
replimap cost -r us-east-1 -f markdown -o costs.md

# Skip confirmation prompt for exports
replimap cost -r us-east-1 -f html -o report.html --acknowledge

Output Formats

Format Description
console Rich terminal output with summary (default)
table Full table of all resource costs
html Interactive HTML report with Chart.js
json Machine-readable JSON
csv Spreadsheet-compatible CSV
markdown Markdown report for documentation

Estimate Accuracy

Confidence Range Description
HIGH ยฑ10% Standard on-demand pricing
MEDIUM ยฑ20% Some usage assumptions
LOW ยฑ40% Many factors unknown

What's NOT Included

  • Data transfer costs (can be 10-30% of bill)
  • API request charges (S3, Lambda, API Gateway)
  • Reserved Instance / Savings Plan discounts
  • Spot Instance pricing
  • Free tier benefits
  • CloudWatch, CloudTrail fees
  • Support plan costs

For accurate billing, use AWS Cost Explorer or AWS Pricing Calculator.

Cost Categories

Category Resources
COMPUTE EC2, Lambda, ECS, EKS
DATABASE RDS, DynamoDB, ElastiCache
STORAGE S3, EBS, EFS
NETWORK VPC, NAT Gateway, Load Balancer
SECURITY IAM, KMS, WAF
MONITORING CloudWatch, SNS, SQS

Optimization Recommendations

The cost estimator provides actionable recommendations:

  • Reserved Instances: ~40% savings for steady-state workloads
  • Savings Plans: ~35% savings with flexibility
  • gp2 to gp3 Migration: ~20% savings with better performance
  • NAT Gateway Optimization: Consolidation opportunities
  • Right-sizing: Instance type recommendations

Right-Sizer (Dev Mode)

Automatically optimize instance sizes for dev/staging environments using the Right-Sizer API.

# Generate Terraform with dev-optimized instance sizes
replimap clone --profile prod --output-dir ./staging-tf \
  --dev-mode --mode generate

# Use aggressive optimization (smaller instances, lower costs)
replimap clone --profile prod --output-dir ./staging-tf \
  --dev-mode --dev-strategy aggressive --mode generate

# Conservative (default) - balanced performance and cost
replimap clone --profile prod --output-dir ./staging-tf \
  --dev-mode --dev-strategy conservative --mode generate

How It Works

  1. RepliMap scans your production infrastructure
  2. Generates Terraform with resource-specific variables (e.g., aws_instance_web_instance_type)
  3. When --dev-mode is enabled, calls the Right-Sizer API with your resource inventory
  4. Receives optimized instance size recommendations
  5. Generates right-sizer.auto.tfvars with the recommendations

Generated Files

File Description
variables.tf Resource-specific variables with production defaults
right-sizer.auto.tfvars Optimized values for dev/staging (auto-loaded by Terraform)

Strategies

Strategy Description Use Case
conservative Moderate downsizing, maintains headroom Staging, QA
aggressive Maximum downsizing, lowest cost Dev, CI/CD

Supported Resources

  • EC2 Instances (instance_type)
  • RDS Instances (instance_class)
  • ElastiCache Clusters (node_type)
  • ElastiCache Replication Groups (node_type)
  • Launch Templates (instance_type)

Requirements

  • Solo plan or higher (Free tier does not include Right-Sizer)
  • Network access to RepliMap API for recommendations

Output Formats

Format Plan Required Status
Terraform HCL Free+ โœ… Available
CloudFormation YAML Pro+ โœ… Available
Pulumi Python Pro+ โœ… Available

Supported Resources (24 Types)

Core Infrastructure

Resource Type Scan Transform Generate
VPC โœ… โœ… โœ…
Subnets โœ… โœ… โœ…
Security Groups โœ… โœ… โœ…
Internet Gateway โœ… โœ… โœ…
NAT Gateway โœ… โœ… โœ…
Route Tables โœ… โœ… โœ…
VPC Endpoints โœ… โœ… โœ…

Compute

Resource Type Scan Transform Generate
EC2 Instances โœ… โœ… โœ…
Launch Templates โœ… โœ… โœ…
Auto Scaling Groups โœ… โœ… โœ…
Application Load Balancers โœ… โœ… โœ…
Network Load Balancers โœ… โœ… โœ…
Target Groups โœ… โœ… โœ…
LB Listeners โœ… โœ… โœ…

Database

Resource Type Scan Transform Generate
RDS Instances โœ… โœ… โœ…
DB Subnet Groups โœ… โœ… โœ…
DB Parameter Groups โœ… โœ… โœ…
ElastiCache Clusters โœ… โœ… โœ…
ElastiCache Subnet Groups โœ… โœ… โœ…

Storage & Messaging

Resource Type Scan Transform Generate
S3 Buckets โœ… โœ… โœ…
S3 Bucket Policies โœ… โœ… โœ…
EBS Volumes โœ… โœ… โœ…
SQS Queues โœ… โœ… โœ…
SNS Topics โœ… โœ… โœ…

Pricing

Plan Monthly Scans/Month AWS Accounts
Free $0 3 1
Solo $29 Unlimited 1
Pro $79 Unlimited 3
Team $149 Unlimited 10
Enterprise $399+ Unlimited Unlimited

Note: All plans have unlimited resource scanning. Gating happens at output/export time, not during scanning.

Feature Matrix

Feature Free Solo Pro Team Enterprise
Terraform Output โœ… โœ… โœ… โœ… โœ…
CloudFormation Output โŒ โŒ โœ… โœ… โœ…
Pulumi Output โŒ โŒ โœ… โœ… โœ…
Async Scanning โŒ โœ… โœ… โœ… โœ…
Right-Sizer (Dev Mode) โŒ โœ… โœ… โœ… โœ…
Custom Templates โŒ โŒ โœ… โœ… โœ…
Cost Estimation โŒ โŒ โœ… โœ… โœ…
Drift Detection โŒ โŒ โœ… โœ… โœ…
Dependency Explorer โŒ โŒ โŒ โœ… โœ…
Web Dashboard โŒ โŒ โœ… โœ… โœ…
Team Collaboration โŒ โŒ โŒ โœ… โœ…
SSO Integration โŒ โŒ โŒ โŒ โœ…
Audit Logs โŒ โŒ โŒ โŒ โœ…

License Management

License keys use the format RM-XXXX-XXXX-XXXX-XXXX (RM prefix for RepliMap brand).

# Activate a license key
replimap license activate RM-XXXX-XXXX-XXXX-XXXX

# Check current status
replimap license status

# View usage statistics
replimap license usage

# Deactivate license
replimap license deactivate --yes

CLI Reference

# Show version
replimap --version

# Scan command
replimap scan [OPTIONS]
  --profile, -p TEXT    AWS profile name
  --region, -r TEXT     AWS region to scan [default: us-east-1]
  --output, -o PATH     Output path for graph JSON
  --verbose, -V         Enable verbose logging

# Clone command
replimap clone [OPTIONS]
  --profile, -p TEXT       AWS source profile name
  --region, -r TEXT        AWS region to scan [default: us-east-1]
  --output-dir, -o PATH    Output directory [default: ./terraform]
  --mode, -m TEXT          Mode: 'dry-run' or 'generate' [default: dry-run]
  --downsize/--no-downsize Enable instance downsizing [default: downsize]
  --rename-pattern TEXT    Renaming pattern, e.g., 'prod:stage'
  --dev-mode, --dev        [SOLO+] Optimize resources for dev/staging via Right-Sizer
  --dev-strategy TEXT      Right-Sizer strategy: 'conservative' or 'aggressive' [default: conservative]

# Load command
replimap load GRAPH_FILE

# Audit command (security scanning)
replimap audit [OPTIONS]
  --profile, -p TEXT       AWS profile name
  --region, -r TEXT        AWS region [default: us-east-1]
  --scope, -s TEXT         Scope to VPC (e.g., vpc:vpc-xxx or vpc-name:Production)
  --format, -f TEXT        Output format: console, html, json [default: console]
  --output, -o PATH        Output file path
  --ci                     CI mode (exit code reflects findings)

# Graph command (visualization)
replimap graph [OPTIONS]
  --profile, -p TEXT       AWS profile name
  --region, -r TEXT        AWS region [default: us-east-1]
  --scope, -s TEXT         Scope to VPC
  --format, -f TEXT        Output format: mermaid, html, json [default: mermaid]
  --output, -o PATH        Output file path

# Drift command (state comparison)
replimap drift [OPTIONS]
  --profile, -p TEXT       AWS profile name
  --region, -r TEXT        AWS region [default: us-east-1]
  --state PATH             Local terraform.tfstate file path
  --remote-bucket TEXT     S3 bucket for remote state
  --remote-key TEXT        S3 key for remote state
  --remote-region TEXT     S3 bucket region
  --scope, -s TEXT         Scope to VPC
  --format, -f TEXT        Output format: console, html, json [default: console]
  --output, -o PATH        Output file path
  --ci                     CI mode (exit code reflects drift status)

# Dependency explorer command (impact analysis, Pro+)
# Note: Based on AWS API metadata only. Application-level deps not detected.
replimap deps RESOURCE_ID [OPTIONS]
  --profile, -p TEXT       AWS profile name
  --region, -r TEXT        AWS region [default: us-east-1]
  --vpc, -v TEXT           VPC ID to scope the scan
  --depth, -d INT          Maximum depth to traverse [default: 10]
  --format, -f TEXT        Output format: console, tree, table, html, json [default: console]
  --output, -o PATH        Output file path
  --open/--no-open         Open HTML report in browser [default: open]

# Cost estimation command (Pro+)
replimap cost [OPTIONS]
  --profile, -p TEXT       AWS profile name
  --region, -r TEXT        AWS region [default: us-east-1]
  --vpc, -v TEXT           VPC ID to scope the scan
  --format, -f TEXT        Output format: console, table, html, json, csv [default: console]
  --output, -o PATH        Output file path
  --open/--no-open         Open HTML report in browser [default: open]

# License commands
replimap license activate KEY
replimap license status
replimap license usage
replimap license deactivate [--yes]

# Credential cache management
replimap cache status      # Show cached credentials
replimap cache clear       # Clear credential cache

# List AWS profiles
replimap profiles

Configuration

Project Configuration (.replimap.yaml)

RepliMap supports a YAML configuration file for advanced customization. Create .replimap.yaml in your project root:

# .replimap.yaml - RepliMap Configuration
version: "1.0"

# Naming conventions for generated resources
naming:
  style: snake_case  # snake_case, kebab-case, camelCase
  prefix: ""
  suffix: ""
  max_length: 64

# Scope and boundary rules
scope:
  # Default scope for resources
  default: managed

  # Rules for determining resource scope
  rules:
    # Ignore resources matching these patterns
    - pattern: ".*-backup-.*"
      scope: ignored
      reason: "Backup resources excluded"

    # Treat shared resources as data sources
    - pattern: "shared-.*"
      scope: data_source
      reason: "Shared infrastructure"

    # Resources tagged with Environment=Production are managed
    - tag: "Environment=Production"
      scope: managed

# File organization for generated Terraform
file_routing:
  strategy: semantic  # semantic, single, by_type
  # Semantic routing places resources in logical files:
  # - network.tf: VPC, subnets, route tables, gateways
  # - compute.tf: EC2, ASG, launch templates
  # - database.tf: RDS, ElastiCache
  # - storage.tf: S3, EBS
  # - security.tf: Security groups, IAM
  # - loadbalancing.tf: ALB, NLB, target groups

# Variable extraction settings
variables:
  # Extract these as variables automatically
  extract:
    - ami_ids
    - instance_types
    - key_names
    - certificate_arns

  # Environment-specific variable files
  environments:
    - dev
    - staging
    - prod

# Import block generation (Terraform 1.5+)
imports:
  enabled: true
  generate_import_blocks: true

# Audit annotations in generated code
audit:
  enabled: true
  include_source_metadata: true
  include_scan_timestamp: true

# Module extraction for repeated patterns
modules:
  enabled: true
  min_occurrences: 2  # Extract pattern if it appears 2+ times
  output_dir: modules/

Environment Variables

Variable Default Description
REPLIMAP_DEV_MODE false Enable dev mode (bypasses license limits)
REPLIMAP_LICENSE_API https://replimap-api... License validation API URL
REPLIMAP_MAX_WORKERS 4 Max parallel scanner threads
REPLIMAP_MAX_RETRIES 5 Max retries for AWS rate limiting
REPLIMAP_RETRY_DELAY 1.0 Base delay (seconds) for retry backoff
REPLIMAP_MAX_DELAY 30.0 Maximum delay (seconds) between retries

Dev Mode

For local development and testing, enable dev mode to bypass license restrictions:

# Enable dev mode (unlimited resources, parallel scanning, all outputs)
export REPLIMAP_DEV_MODE=1

# Or inline with command
REPLIMAP_DEV_MODE=1 replimap scan --profile prod

# Values accepted: 1, true, yes (case-insensitive)

AWS Credential Caching

RepliMap caches MFA-authenticated credentials for 12 hours to avoid repeated prompts:

# View cached credentials
replimap cache status

# Clear cache when switching accounts
replimap cache clear

# Disable cache for a single command
replimap scan --profile prod --no-cache

Parallel Scanning

Scanners run in parallel for faster execution (requires Solo+ plan or dev mode):

  • Default: 4 parallel workers
  • Configure with REPLIMAP_MAX_WORKERS environment variable
  • Free tier runs scanners sequentially

AWS Rate Limiting

Built-in retry with exponential backoff handles AWS throttling automatically:

  • Retries on: Throttling, RequestLimitExceeded, TooManyRequestsException, etc.
  • Exponential backoff: 1s โ†’ 2s โ†’ 4s โ†’ 8s โ†’ 16s (up to 30s max)
  • Configurable via environment variables

Security

RepliMap is designed with security as a priority:

  • Read-Only: Only requires read permissions to AWS resources
  • Local Processing: All data processing happens on your machine
  • No Data Upload: Your infrastructure data never leaves your environment
  • Minimal Permissions: See IAM_POLICY.md for recommended policy

Architecture

RepliMap uses a graph-based engine with an enhanced rendering pipeline:

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   Scanners  โ”‚โ”€โ”€โ”€โ–ถโ”‚ Graph Engineโ”‚โ”€โ”€โ”€โ–ถโ”‚ Transformers  โ”‚โ”€โ”€โ”€โ–ถโ”‚ Enhanced Renderer  โ”‚
โ”‚  (AWS API)  โ”‚    โ”‚ (NetworkX)  โ”‚    โ”‚  (Pipeline)   โ”‚    โ”‚   (Terraform v2)   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                                                     โ”‚
                   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                   โ”‚                                                 โ”‚                                                 โ”‚
                   โ–ผ                                                 โ–ผ                                                 โ–ผ
          โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                                 โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                                 โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
          โ”‚ SmartNaming   โ”‚                                 โ”‚ ScopeEngine   โ”‚                                 โ”‚ FileRouter    โ”‚
          โ”‚ Generator     โ”‚                                 โ”‚ (Boundaries)  โ”‚                                 โ”‚ (Semantic)    โ”‚
          โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                                 โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                                 โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                   โ”‚                                                 โ”‚                                                 โ”‚
                   โ–ผ                                                 โ–ผ                                                 โ–ผ
          โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                                 โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                                 โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
          โ”‚ ImportBlock   โ”‚                                 โ”‚ Variable      โ”‚                                 โ”‚ Audit         โ”‚
          โ”‚ Generator     โ”‚                                 โ”‚ Extractor     โ”‚                                 โ”‚ Annotator     โ”‚
          โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                                 โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                                 โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Core Pipeline

  1. Scanners: Query AWS APIs for VPC, EC2, RDS, S3 resources
  2. Graph Engine: Build dependency graph with NetworkX
  3. Transformers: Apply sanitization, downsizing, renaming
  4. Enhanced Renderer: Generate production-ready Terraform with intelligent features

Enhanced Renderer Components (Level 2-5)

Component Description
SmartNameGenerator Context-aware naming with collision detection and configurable styles
ScopeEngine Boundary recognition (managed/data_source/ignored) with rule-based classification
ImportBlockGenerator Terraform 1.5+ import blocks for seamless state adoption
RefactoringEngine Safe refactoring with moved blocks for resource renames
SemanticFileRouter Organize resources into logical files (network.tf, compute.tf, etc.)
VariableExtractor Auto-extract AMIs, instance types, certificates as variables
AuditAnnotator Add source metadata and compliance annotations to generated code
LocalModuleExtractor Detect repeated patterns and extract reusable modules
PlanBasedDriftEngine Detect drift using terraform plan output parsing
SchemaBootstrapper Auto-discover provider schemas for validation
ConfigLoader Load and validate .replimap.yaml configuration

Development

# Clone repository
git clone https://github.com/replimap/replimap.git
cd replimap

# Install with uv (recommended)
uv sync --all-extras --dev

# Run tests
uv run pytest tests/ -v

# Format code
uv run ruff format .

# Lint code
uv run ruff check .

# Type checking
uv run mypy replimap

Project Structure

replimap/
โ”œโ”€โ”€ replimap/
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ main.py              # Typer CLI entry point
โ”‚   โ”œโ”€โ”€ core/
โ”‚   โ”‚   โ”œโ”€โ”€ graph_engine.py  # NetworkX graph wrapper
โ”‚   โ”‚   โ”œโ”€โ”€ models.py        # ResourceNode dataclass
โ”‚   โ”‚   โ”œโ”€โ”€ config.py        # ConfigLoader - .replimap.yaml support
โ”‚   โ”‚   โ”œโ”€โ”€ scope.py         # ScopeEngine - boundary recognition
โ”‚   โ”‚   โ”œโ”€โ”€ bootstrap.py     # SchemaBootstrapper - provider schema discovery
โ”‚   โ”‚   โ”œโ”€โ”€ sanitizer.py     # Security-critical sanitization middleware
โ”‚   โ”‚   โ”œโ”€โ”€ retry.py         # Coordinated retry logic with backoff
โ”‚   โ”‚   โ”œโ”€โ”€ circuit_breaker.py # Circuit breaker for API resilience
โ”‚   โ”‚   โ”œโ”€โ”€ cache.py         # Credential and result caching
โ”‚   โ”‚   โ”œโ”€โ”€ filters.py       # Resource filtering utilities
โ”‚   โ”‚   โ””โ”€โ”€ selection.py     # Graph-based selection engine
โ”‚   โ”œโ”€โ”€ scanners/
โ”‚   โ”‚   โ”œโ”€โ”€ base.py              # Scanner base class
โ”‚   โ”‚   โ”œโ”€โ”€ async_base.py        # Async scanner support
โ”‚   โ”‚   โ”œโ”€โ”€ vpc_scanner.py       # VPC/Subnet/SG scanner
โ”‚   โ”‚   โ”œโ”€โ”€ ec2_scanner.py       # EC2 scanner
โ”‚   โ”‚   โ”œโ”€โ”€ s3_scanner.py        # S3 scanner
โ”‚   โ”‚   โ”œโ”€โ”€ rds_scanner.py       # RDS scanner
โ”‚   โ”‚   โ”œโ”€โ”€ networking_scanner.py # IGW/NAT/Route Tables
โ”‚   โ”‚   โ”œโ”€โ”€ compute_scanner.py   # ALB/ASG/Launch Templates
โ”‚   โ”‚   โ”œโ”€โ”€ elasticache_scanner.py # ElastiCache clusters
โ”‚   โ”‚   โ”œโ”€โ”€ storage_scanner.py   # EBS/S3 policies
โ”‚   โ”‚   โ””โ”€โ”€ messaging_scanner.py # SQS/SNS
โ”‚   โ”œโ”€โ”€ transformers/
โ”‚   โ”‚   โ”œโ”€โ”€ base.py          # Transformer pipeline
โ”‚   โ”‚   โ”œโ”€โ”€ sanitizer.py     # Sensitive data removal
โ”‚   โ”‚   โ”œโ”€โ”€ downsizer.py     # Instance size reduction
โ”‚   โ”‚   โ”œโ”€โ”€ renamer.py       # Environment renaming
โ”‚   โ”‚   โ””โ”€โ”€ network_remapper.py  # Reference updates
โ”‚   โ”œโ”€โ”€ renderers/
โ”‚   โ”‚   โ”œโ”€โ”€ terraform.py         # Terraform HCL renderer (base)
โ”‚   โ”‚   โ”œโ”€โ”€ terraform_v2.py      # EnhancedTerraformRenderer (recommended)
โ”‚   โ”‚   โ”œโ”€โ”€ name_generator.py    # SmartNameGenerator - context-aware naming
โ”‚   โ”‚   โ”œโ”€โ”€ import_generator.py  # ImportBlockGenerator - TF 1.5+ imports
โ”‚   โ”‚   โ”œโ”€โ”€ refactoring.py       # RefactoringEngine - moved blocks
โ”‚   โ”‚   โ”œโ”€โ”€ file_router.py       # SemanticFileRouter - logical file organization
โ”‚   โ”‚   โ”œโ”€โ”€ variable_extractor.py # VariableExtractor - auto-extract variables
โ”‚   โ”‚   โ”œโ”€โ”€ audit_annotator.py   # AuditAnnotator - source metadata
โ”‚   โ”‚   โ”œโ”€โ”€ cloudformation.py    # CloudFormation YAML (Solo+)
โ”‚   โ”‚   โ””โ”€โ”€ pulumi.py            # Pulumi Python (Pro+)
โ”‚   โ”œโ”€โ”€ patterns/
โ”‚   โ”‚   โ””โ”€โ”€ local_module.py  # LocalModuleExtractor - pattern detection
โ”‚   โ”œโ”€โ”€ audit/               # Security auditing
โ”‚   โ”‚   โ”œโ”€โ”€ engine.py        # Audit orchestration
โ”‚   โ”‚   โ”œโ”€โ”€ checkov_runner.py # Checkov integration
โ”‚   โ”‚   โ”œโ”€โ”€ renderer.py      # Console/HTML/JSON output
โ”‚   โ”‚   โ”œโ”€โ”€ soc2_mapping.py  # SOC2 compliance mapping
โ”‚   โ”‚   โ”œโ”€โ”€ fix_suggestions.py # Remediation suggestions
โ”‚   โ”‚   โ”œโ”€โ”€ remediation/     # Auto-remediation templates
โ”‚   โ”‚   โ””โ”€โ”€ templates/       # Jinja2 HTML templates
โ”‚   โ”œโ”€โ”€ graph/               # Infrastructure visualization
โ”‚   โ”‚   โ”œโ”€โ”€ visualizer.py    # Graph building
โ”‚   โ”‚   โ”œโ”€โ”€ builder.py       # Graph construction
โ”‚   โ”‚   โ”œโ”€โ”€ layout.py        # Hierarchical container layout
โ”‚   โ”‚   โ”œโ”€โ”€ aggregation.py   # Smart VPC-based aggregation
โ”‚   โ”‚   โ”œโ”€โ”€ grouper.py       # Resource grouping
โ”‚   โ”‚   โ”œโ”€โ”€ naming.py        # Graph node naming
โ”‚   โ”‚   โ”œโ”€โ”€ environment.py   # Environment detection (prod/staging/dev)
โ”‚   โ”‚   โ”œโ”€โ”€ views.py         # View management (overview/detail)
โ”‚   โ”‚   โ”œโ”€โ”€ filters.py       # Graph filtering
โ”‚   โ”‚   โ”œโ”€โ”€ link_classification.py  # Traffic vs dependency links
โ”‚   โ”‚   โ”œโ”€โ”€ summary_links.py # Cross-VPC connection summaries
โ”‚   โ”‚   โ”œโ”€โ”€ tool_modes.py    # Select/Trace/Blast tool palette
โ”‚   โ”‚   โ”œโ”€โ”€ cost_overlay.py  # Cost heat map visualization
โ”‚   โ”‚   โ”œโ”€โ”€ blast_radius.py  # Impact analysis calculation
โ”‚   โ”‚   โ”œโ”€โ”€ drift.py         # Drift detection for graphs
โ”‚   โ”‚   โ”œโ”€โ”€ orphan_detection.py # Unused resource detection
โ”‚   โ”‚   โ”œโ”€โ”€ formatters/      # Mermaid, JSON, D3.js formatters
โ”‚   โ”‚   โ””โ”€โ”€ templates/       # D3.js HTML template
โ”‚   โ”œโ”€โ”€ drift/               # Drift detection
โ”‚   โ”‚   โ”œโ”€โ”€ engine.py        # Legacy detection engine
โ”‚   โ”‚   โ”œโ”€โ”€ plan_engine.py   # PlanBasedDriftEngine (recommended)
โ”‚   โ”‚   โ”œโ”€โ”€ state_parser.py  # Terraform state parsing
โ”‚   โ”‚   โ”œโ”€โ”€ comparator.py    # Resource comparison
โ”‚   โ”‚   โ”œโ”€โ”€ models.py        # DriftReport, ResourceDrift models
โ”‚   โ”‚   โ”œโ”€โ”€ reporter.py      # Report generation (console/HTML/JSON)
โ”‚   โ”‚   โ””โ”€โ”€ templates/       # HTML report template
โ”‚   โ”œโ”€โ”€ dependencies/        # Dependency exploration
โ”‚   โ”‚   โ”œโ”€โ”€ models.py        # ResourceNode, DependencyZone, etc.
โ”‚   โ”‚   โ”œโ”€โ”€ graph_builder.py # Dependency graph building
โ”‚   โ”‚   โ”œโ”€โ”€ impact_calculator.py # Impact score estimation
โ”‚   โ”‚   โ””โ”€โ”€ reporter.py      # Console/HTML/JSON output
โ”‚   โ”œโ”€โ”€ blast/               # Blast radius analysis
โ”‚   โ”‚   โ”œโ”€โ”€ models.py        # Impact models
โ”‚   โ”‚   โ”œโ”€โ”€ graph_builder.py # Blast graph construction
โ”‚   โ”‚   โ”œโ”€โ”€ impact_calculator.py # Impact scoring
โ”‚   โ”‚   โ””โ”€โ”€ reporter.py      # Blast radius reporting
โ”‚   โ”œโ”€โ”€ snapshot/            # Infrastructure snapshots
โ”‚   โ”‚   โ”œโ”€โ”€ models.py        # Snapshot models
โ”‚   โ”‚   โ”œโ”€โ”€ store.py         # Snapshot storage
โ”‚   โ”‚   โ”œโ”€โ”€ differ.py        # Snapshot comparison
โ”‚   โ”‚   โ””โ”€โ”€ reporter.py      # Snapshot reporting
โ”‚   โ”œโ”€โ”€ cost/                # Cost estimation
โ”‚   โ”‚   โ”œโ”€โ”€ models.py        # ResourceCost, CostEstimate
โ”‚   โ”‚   โ”œโ”€โ”€ pricing.py       # AWS pricing data
โ”‚   โ”‚   โ”œโ”€โ”€ estimator.py     # Cost calculation engine
โ”‚   โ”‚   โ””โ”€โ”€ reporter.py      # Console/HTML/CSV output
โ”‚   โ””โ”€โ”€ licensing/
โ”‚       โ”œโ”€โ”€ manager.py       # License management
โ”‚       โ”œโ”€โ”€ models.py        # License models
โ”‚       โ”œโ”€โ”€ gates.py         # Feature gating
โ”‚       โ”œโ”€โ”€ prompts.py       # License prompts
โ”‚       โ””โ”€โ”€ tracker.py       # Usage tracking
โ”œโ”€โ”€ templates/               # Jinja2 templates
โ”œโ”€โ”€ tests/                   # pytest test suite (825+ tests)
โ”œโ”€โ”€ .github/workflows/       # CI/CD
โ”œโ”€โ”€ .replimap.yaml           # Project configuration (optional)
โ”œโ”€โ”€ pyproject.toml
โ”œโ”€โ”€ CHANGELOG.md             # Version history
โ””โ”€โ”€ README.md

Support

License

Proprietary - See LICENSE for details.

Copyright (c) 2025 RepliMap

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

replimap-0.1.15.tar.gz (387.9 kB view details)

Uploaded Source

Built Distribution

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

replimap-0.1.15-py3-none-any.whl (462.9 kB view details)

Uploaded Python 3

File details

Details for the file replimap-0.1.15.tar.gz.

File metadata

  • Download URL: replimap-0.1.15.tar.gz
  • Upload date:
  • Size: 387.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for replimap-0.1.15.tar.gz
Algorithm Hash digest
SHA256 ba3044cdf57c9a60194725a87e40aa2f9f12951cb94603954430f2f8d28e65f9
MD5 272a65b6a86840e4540cae749b4a184b
BLAKE2b-256 342182259a160ec454b96f944e4e3b65094ed7dbbfd16e4e4387602027e79ed4

See more details on using hashes here.

Provenance

The following attestation bundles were made for replimap-0.1.15.tar.gz:

Publisher: auto-release.yml on RepliMap/replimap

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file replimap-0.1.15-py3-none-any.whl.

File metadata

  • Download URL: replimap-0.1.15-py3-none-any.whl
  • Upload date:
  • Size: 462.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for replimap-0.1.15-py3-none-any.whl
Algorithm Hash digest
SHA256 e648d0bf52325f2f06030df8a4dad1c15a39980487eb873e180eeb30deab4e24
MD5 efeb0700267ff03379cee1c14d88b5f1
BLAKE2b-256 f5c7ea644d8a82264fe5607bb1a9f9d72dddc3b8ebf17029ff5f5964596a3730

See more details on using hashes here.

Provenance

The following attestation bundles were made for replimap-0.1.15-py3-none-any.whl:

Publisher: auto-release.yml on RepliMap/replimap

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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