loading…
Search for a command to run...
loading…
Automates AWS EBS volume initialization via AWS Systems Manager, supporting multi-instance parallel execution and real-time progress tracking.
Automates AWS EBS volume initialization via AWS Systems Manager, supporting multi-instance parallel execution and real-time progress tracking.
A Model Context Protocol (MCP) server for automating AWS EBS volume initialization. This server provides tools to initialize EBS volumes attached to EC2 instances using AWS Systems Manager.
fio (recommended) or dd# Run directly without installation (latest version)
uvx ebs-initializer-mcp@latest
# Or run specific version
uvx ebs-initializer-mcp==0.7.10
# Install globally
uv tool install ebs-initializer-mcp
# Upgrade to latest version
uvx --upgrade ebs-initializer-mcp
uvx --from git+https://github.com/username/ebs-init-mcp.git ebs-mcp-server
Add to your MCP configuration (mcp_config.json):
{
"mcpServers": {
"ebs-initializer": {
"command": "uvx",
"args": ["ebs-initializer-mcp@latest"],
"env": {
"AWS_REGION": "us-west-2"
}
}
}
}
# Single instance
"Initialize all EBS volumes for instance i-1234567890abcdef0 using fio"
# Multiple instances (comma-separated)
"Initialize all EBS volumes for instances i-1234567890abcdef0,i-0987654321fedcba0 using fio"
# Specific volume
"Initialize volume vol-1234567890abcdef0 using fio"
# Check status
"Check the status of the initialization command 12345678-1234-1234-1234-123456789012"
# Cancel operation
"Cancel the initialization command 12345678-1234-1234-1234-123456789012"
The MCP server will:
Enhanced progress tracking optimized for AI agents with multi-instance support:
[██████████░░░░░░░░░░] 50.0%{
"command_id": "...",
"status": "InProgress",
"execution_start_time": "2025-09-10 01:18:21.418000+00:00",
"progress_percentage": 50.0,
"progress_bar": "[██████████░░░░░░░░░░] 50.0%",
"estimated_remaining_minutes": 5.2,
"message": "🔄 50.0% Complete..."
}
{
"status": "initialization_started",
"command_id": "4044d07e-c10c-4caf-b5b7-eee8435ac1c7",
"target_instances": ["i-0fe60964746c77041", "i-0a824284f8c887f4a"],
"total_instances": 2,
"instance_estimations": {
"i-0fe60964746c77041": {
"estimated_minutes": 1.09,
"volume_count": 1,
"total_gb": 8,
"instance_type": "t3.xlarge"
},
"i-0a824284f8c887f4a": {
"estimated_minutes": 6.89,
"volume_count": 3,
"total_gb": 208,
"instance_type": "m5.4xlarge"
}
},
"total_estimated_minutes": 6.89
}
ec2:DescribeVolumesec2:DescribeInstancesssm:SendCommandssm:GetCommandInvocationssm:PutParameterssm:GetParameterssm:DeleteParameter{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ec2:DescribeVolumes",
"ec2:DescribeInstances",
"ssm:SendCommand",
"ssm:GetCommandInvocation",
"ssm:PutParameter",
"ssm:GetParameter",
"ssm:DeleteParameter"
],
"Resource": "*"
}
]
}
The server automatically detects AWS region from environment variables:
# Option 1: AWS_DEFAULT_REGION (preferred)
export AWS_DEFAULT_REGION=ap-northeast-2
# Option 2: AWS_REGION (also supported)
export AWS_REGION=ap-northeast-2
Priority order:
AWS_DEFAULT_REGION environment variableAWS_REGION environment variable us-east-1{
"mcpServers": {
"ebs-initializer": {
"command": "uvx",
"args": ["ebs-initializer-mcp@latest"],
"env": {
"AWS_DEFAULT_REGION": "ap-northeast-2"
}
}
}
}
The codebase is organized into focused modules for maintainability and reusability:
src/ebs_init_mcp/
├── server.py # MCP server and tool definitions (430 lines)
├── aws_clients.py # AWS client caching and management
├── throughput.py # EBS throughput calculation
├── estimation.py # Time estimation algorithms
├── initialization.py # Command generation for volume initialization
├── status.py # Status checking and progress calculation
└── utils.py # Utility functions and device mapping scripts
initialize_all_volumes (Parallel Initialization)Algorithm: Simulates parallel processing with throughput sharing
# Step 1: Get instance EBS throughput
instance_throughput = get_instance_ebs_throughput(instance_type)
# Step 2: Collect volume data
volumes = [{'size_gb': size, 'max_throughput_mbps': vol_throughput}...]
# Step 3: AWS EBS throughput allocation algorithm
while volumes_remaining:
total_demand = sum(vol_throughput for each volume)
if total_demand <= instance_throughput:
# Each volume gets its maximum throughput
allocated_throughputs = [vol_max_throughput for each volume]
else:
# AWS EBS allocation: smaller volumes get priority
fair_share = instance_throughput / len(volumes_remaining)
# First pass: allocate full throughput to volumes <= fair_share
for volume in volumes_remaining:
if volume.max_throughput <= fair_share:
volume.allocated = volume.max_throughput
remaining_throughput -= volume.max_throughput
# Second pass: distribute remaining among larger volumes
remaining_large_volumes = volumes with throughput > fair_share
throughput_per_large = remaining_throughput / len(remaining_large_volumes)
for volume in remaining_large_volumes:
volume.allocated = throughput_per_large
# Calculate completion times and process next step
completion_times = [(size * 1024) / allocated_throughput / 60 for each volume]
Example: t3.large (500MB/s) with 3 volumes:
initialize_volume_by_id (Single Volume)Algorithm: Simple throughput-limited calculation
# Step 1: Get throughput constraints
instance_throughput = get_instance_ebs_throughput(instance_type)
volume_throughput = volume.get('Throughput', 1000)
# Step 2: Calculate effective throughput (bottleneck)
effective_throughput = min(volume_throughput, instance_throughput)
# Step 3: Linear time calculation
estimated_minutes = (size_gb * 1024 MB) / effective_throughput / 60
Example: 100GB volume, t3.large (500MB/s), gp3 (1000MB/s)
git clone <repository>
cd ebs-init-mcp
# Install dependencies
uv sync
# Run development server
AWS_REGION=ap-northeast-2 uv run mcp dev src/ebs_init_mcp/server.py
# Run tests
uv run pytest
# Format code
uv run ruff format src/
uv run ruff check src/
MIT License
Выполни в терминале:
claude mcp add ebs-initializer-mcp -- npx Не уверен что выбрать?
Найди свой стек за 60 секунд
Автор?
Embed-бейдж для README
Похожее
Все в категории development