Documentation Index
Fetch the complete documentation index at: https://o1.network/docs/llms.txt
Use this file to discover all available pages before exploring further.
Managing Cloud Infrastructure
O1 provides comprehensive cloud infrastructure management across multiple providers including AWS, Azure, GCP, and DigitalOcean. This guide covers provisioning, managing, and monitoring cloud instances.
Prerequisites
- O1 backend service running
- Cloud provider account credentials
- SSH keys configured in O1
Add AWS Credentials
curl -X POST http://localhost:3000/api/nodes/credentials/save \
-H "Content-Type: application/json" \
-d '{
"provider": "AWS",
"name": "production-aws",
"region": "us-east-1",
"accessKeyId": "your-access-key",
"secretAccessKey": "your-secret-key"
}'
Add Azure Credentials
curl -X POST http://localhost:3000/api/nodes/credentials/save \
-H "Content-Type: application/json" \
-d '{
"provider": "Azure",
"name": "production-azure",
"subscriptionId": "your-subscription-id",
"tenantId": "your-tenant-id",
"clientId": "your-client-id",
"clientSecret": "your-client-secret"
}'
List Available Credentials
# List all credentials
curl http://localhost:3000/api/nodes/credentials
# Filter by provider
curl "http://localhost:3000/api/nodes/credentials?provider=AWS"
Step 2: Discover Existing Instances
Before creating new instances, discover what’s already running:
curl -X POST http://localhost:3000/api/nodes/discover-instances \
-H "Content-Type: multipart/form-data" \
-F "credentials='{\"provider\":\"AWS\",\"accessKeyId\":\"your-key\",\"secretAccessKey\":\"your-secret\"}'" \
-F "saveCredentials=true" \
-F "credentialName=discovered-aws"
Step 3: Launch a Cloud Instance
Launch a new cloud instance and automatically add it to O1 management:
Basic Instance Launch
curl -X POST http://localhost:3000/api/nodes/launch-instance \
-H "Content-Type: application/json" \
-d '{
"credentialName": "production-aws",
"provider": "AWS",
"region": "us-east-1",
"instanceType": "t2.micro",
"name": "web-server-01",
"sshKeyName": "my-ssh-key",
"createSecurityGroup": true
}'
Advanced Instance Configuration
curl -X POST http://localhost:3000/api/nodes/launch-instance \
-H "Content-Type: application/json" \
-d '{
"credentialName": "production-aws",
"provider": "AWS",
"region": "us-east-1",
"instanceType": "t2.medium",
"name": "app-server-01",
"sshKeyName": "my-ssh-key",
"sshPublicKey": "ssh-rsa AAAA...",
"createSecurityGroup": true,
"volumeSize": 100,
"tags": {
"Environment": "production",
"Project": "web-app",
"ManagedBy": "O1"
}
}'
Step 4: Instance Lifecycle Management
Restart Instance
curl -X POST http://localhost:3000/api/nodes/restart-instance \
-H "Content-Type: application/json" \
-d '{
"nodeName": "web-server-01"
}'
Terminate Instance
curl -X POST http://localhost:3000/api/nodes/terminate-instance \
-H "Content-Type: application/json" \
-d '{
"nodeName": "web-server-01"
}'
Step 5: Resource Management
Add Firewall Rules
# Allow HTTP traffic
curl -X POST http://localhost:3000/api/nodes/web-server-01/resources/firewall \
-H "Content-Type: application/json" \
-d '{
"protocol": "tcp",
"port": "80",
"source": "0.0.0.0/0",
"description": "Allow HTTP traffic"
}'
# Allow SSH from specific IP
curl -X POST http://localhost:3000/api/nodes/web-server-01/resources/firewall \
-H "Content-Type: application/json" \
-d '{
"protocol": "tcp",
"port": "22",
"source": "203.0.113.1/32",
"description": "Allow SSH from office"
}'
Create and Attach Volumes
curl -X POST http://localhost:3000/api/nodes/web-server-01/resources/volumes \
-H "Content-Type: application/json" \
-d '{
"sizeGb": 100,
"volumeType": "gp3",
"device": "/dev/sdf",
"description": "Application data volume"
}'
Step 6: Multi-Provider Management
Compare Instance Types Across Providers
# AWS instance types
curl http://localhost:3000/api/nodes/instance-types/AWS/us-east-1
# Azure instance types
curl http://localhost:3000/api/nodes/instance-types/Azure/eastus
# GCP instance types
curl http://localhost:3000/api/nodes/instance-types/GCP/us-central1
Deploy Across Multiple Clouds
# Deploy to AWS
curl -X POST http://localhost:3000/api/nodes/launch-instance \
-H "Content-Type: application/json" \
-d '{
"credentialName": "production-aws",
"provider": "AWS",
"region": "us-east-1",
"instanceType": "t2.micro",
"name": "aws-app-01"
}'
# Deploy to Azure
curl -X POST http://localhost:3000/api/nodes/launch-instance \
-H "Content-Type: application/json" \
-d '{
"credentialName": "production-azure",
"provider": "Azure",
"region": "eastus",
"instanceType": "Standard_B1s",
"name": "azure-app-01"
}'
Step 7: Infrastructure Monitoring
Monitor Instance Health
# Get infrastructure state
curl http://localhost:3000/api/nodes/infrastructure/web-server-01
# Get hardware information
curl http://localhost:3000/api/nodes/web-server-01/hardware-info
# Monitor uptime
curl -X POST http://localhost:3000/api/nodes/web-server-01/uptime
Monitor Resource Usage
# CPU and memory monitoring
curl -X POST http://localhost:3000/api/monitoring/metrics/snapshot \
-H "Content-Type: application/json" \
-d '{
"host": "web-server-01",
"application": "system",
"metrics": ["cpu", "memory", "disk"],
"timespan": "1h"
}'
Advanced Scenarios
Auto-scaling Groups
While O1 doesn’t provide native auto-scaling, you can manage scaling manually:
# Scale up - launch additional instances
for i in {1..3}; do
curl -X POST http://localhost:3000/api/nodes/launch-instance \
-H "Content-Type: application/json" \
-d "{
\"credentialName\": \"production-aws\",
\"provider\": \"AWS\",
\"region\": \"us-east-1\",
\"instanceType\": \"t2.micro\",
\"name\": \"app-scale-${i}\"
}"
done
# Scale down - terminate instances
curl -X POST http://localhost:3000/api/nodes/terminate-instance \
-H "Content-Type: application/json" \
-d '{
"nodeName": "app-scale-3"
}'
High Availability Setup
Deploy across multiple regions for redundancy:
# Primary region (US East)
curl -X POST http://localhost:3000/api/nodes/launch-instance \
-H "Content-Type: application/json" \
-d '{
"credentialName": "production-aws",
"provider": "AWS",
"region": "us-east-1",
"instanceType": "t2.micro",
"name": "primary-app-01"
}'
# Secondary region (US West)
curl -X POST http://localhost:3000/api/nodes/launch-instance \
-H "Content-Type: application/json" \
-d '{
"credentialName": "production-aws",
"provider": "AWS",
"region": "us-west-2",
"instanceType": "t2.micro",
"name": "secondary-app-01"
}'
Cost Optimization
Use spot instances for cost savings:
# Check spot pricing history
curl "http://localhost:3000/api/explorer/spot-pricing-history?provider=AWS&instanceType=t2.micro®ion=us-east-1&timeRange=7d"
# Launch spot instance (if supported by provider)
curl -X POST http://localhost:3000/api/nodes/launch-instance \
-H "Content-Type: application/json" \
-d '{
"credentialName": "production-aws",
"provider": "AWS",
"region": "us-east-1",
"instanceType": "t2.micro",
"name": "spot-app-01",
"useSpot": true
}'
Security Best Practices
SSH Key Management
# Add SSH keys to instances
curl -X POST http://localhost:3000/api/nodes/add-ssh-key-to-instance \
-H "Content-Type: application/json" \
-d '{
"nodeName": "web-server-01",
"sshPublicKey": "ssh-rsa AAAA..."
}'
# Update SSH keys in bulk
curl -X POST http://localhost:3000/api/nodes/update-ssh-keys-bulk \
-H "Content-Type: application/json" \
-d '{
"nodeNames": ["web-server-01", "app-server-01"],
"sshKeyName": "production-key"
}'
Network Security
# Restrict public access
curl -X POST http://localhost:3000/api/nodes/web-server-01/resources/firewall \
-H "Content-Type: application/json" \
-d '{
"protocol": "tcp",
"port": "22",
"source": "203.0.113.0/24",
"description": "Restrict SSH to office network"
}'
# Close unnecessary ports
curl -X DELETE http://localhost:3000/api/nodes/web-server-01/resources/firewall/rule-123456
Troubleshooting
Instance Launch Failures
# Check credential validity
curl "http://localhost:3000/api/explorer/check-credentials?provider=AWS"
# Verify instance type availability
curl http://localhost:3000/api/nodes/instance-types/AWS/us-east-1
# Check security group limits
echo "Check provider console for account limits"
Connection Issues
# Test SSH connection
curl -X POST http://localhost:3000/api/nodes/test-connection \
-H "Content-Type: multipart/form-data" \
-F "host=1.2.3.4" \
-F "user=ubuntu" \
-F "ansible_ssh_private_key_file=@/path/to/key"
# Verify infrastructure state
curl http://localhost:3000/api/nodes/infrastructure/web-server-01
Next Steps
Now that you can manage cloud infrastructure, explore:
Remember to regularly review your infrastructure costs, security settings, and performance metrics to ensure optimal operation.