|
| 1 | +--- |
| 2 | +title: Cloud resource management |
| 3 | +--- |
| 4 | + |
| 5 | +import Tabs from '@theme/Tabs'; |
| 6 | +import TabItem from '@theme/TabItem'; |
| 7 | + |
| 8 | +This tutorial shows an example of cloud resource management schema, which provides a vendor-agnostic way to model cloud infrastructure across AWS, GCP, and Azure. You'll load sample cloud data and explore how Infrahub can serve as a unified inventory for multi-cloud environments. |
| 9 | + |
| 10 | +## Overview |
| 11 | + |
| 12 | +The cloud schema enables you to track: |
| 13 | + |
| 14 | +- **Cloud providers** - AWS, GCP, Azure, or other cloud platforms |
| 15 | +- **Cloud accounts** - AWS accounts, GCP projects, Azure subscriptions |
| 16 | +- **Regions and availability zones** - Geographic locations and fault domains |
| 17 | +- **Virtual networks** - VPCs (AWS), VPC networks (GCP), VNets (Azure) |
| 18 | +- **Subnets** - Network segments within virtual networks |
| 19 | +- **Security groups** - Network access control rules (Security Groups, Firewall Rules, NSGs) |
| 20 | +- **Compute instances** - Virtual machines across all providers |
| 21 | +- **Network infrastructure** - Internet gateways, NAT gateways, route tables, elastic IPs |
| 22 | +- **Network interfaces** - ENIs, NICs attached to instances |
| 23 | + |
| 24 | +This vendor-agnostic model allows you to manage multi-cloud infrastructure from a single source of truth, with consistent naming and relationships regardless of the underlying cloud provider. |
| 25 | + |
| 26 | +## Prerequisites |
| 27 | + |
| 28 | +Before starting this tutorial, ensure you have: |
| 29 | + |
| 30 | +- Completed the [installation guide](./install.mdx) and have Infrahub running |
| 31 | +- Loaded the bootstrap data and schemas |
| 32 | +- Access to the Infrahub web interface at `http://localhost:8000` |
| 33 | + |
| 34 | +## Loading cloud demo data |
| 35 | + |
| 36 | +The demo includes sample data for all three major cloud providers with realistic infrastructure examples. |
| 37 | + |
| 38 | +The easiest way to load the cloud demo is using the provided invoke task: |
| 39 | + |
| 40 | +```bash |
| 41 | +uv run invoke demo-cloud |
| 42 | +``` |
| 43 | + |
| 44 | +This command: |
| 45 | + |
| 46 | +1. Creates a new branch named `demo-cloud` |
| 47 | +2. Loads all schemas (including the cloud schema) |
| 48 | +3. Loads cloud object files with sample data for AWS, GCP, and Azure |
| 49 | +4. Displays a URL to view the cloud resources |
| 50 | + |
| 51 | +## Exploring cloud resources |
| 52 | + |
| 53 | +After loading the demo data, navigate to the cloud resources in the Infrahub web interface. |
| 54 | + |
| 55 | +### Viewing all cloud resources |
| 56 | + |
| 57 | +1. Ensure you're on the correct branch (for example, `demo-cloud`) |
| 58 | +2. Navigate to **Cloud Resource** in the left sidebar menu |
| 59 | +3. You'll see a list of all cloud resource types |
| 60 | + |
| 61 | +Or access the cloud resources directly: |
| 62 | + |
| 63 | +```text |
| 64 | +http://localhost:8000/objects/CloudResource?branch=demo-cloud |
| 65 | +``` |
| 66 | + |
| 67 | +### Sample data structure |
| 68 | + |
| 69 | +The demo includes a comprehensive multi-cloud environment: |
| 70 | + |
| 71 | +#### Cloud providers (3) |
| 72 | + |
| 73 | +- Amazon Web Services (AWS) |
| 74 | +- Google Cloud Platform (GCP) |
| 75 | +- Microsoft Azure |
| 76 | + |
| 77 | +#### Cloud accounts (12) |
| 78 | + |
| 79 | +Each provider has production, staging, and development accounts: |
| 80 | + |
| 81 | +- `opsmill-aws-production`, `opsmill-aws-staging`, `opsmill-aws-dev` |
| 82 | +- `opsmill-gcp-production`, `opsmill-gcp-staging`, `opsmill-gcp-dev` |
| 83 | +- `opsmill-azure-production`, `opsmill-azure-staging`, `opsmill-azure-dev` |
| 84 | + |
| 85 | +#### Regions and availability zones |
| 86 | + |
| 87 | +- **AWS**: US East (N. Virginia), US West (Oregon), EU West (Ireland) |
| 88 | +- **GCP**: US Central (Iowa), US East (South Carolina), Europe West (Belgium) |
| 89 | +- **Azure**: East US, West US 2, West Europe |
| 90 | + |
| 91 | +Each region includes 3 availability zones. |
| 92 | + |
| 93 | +#### Virtual networks (12) |
| 94 | + |
| 95 | +VPCs and VNets across all accounts with various configurations: |
| 96 | + |
| 97 | +- Production VPCs with public and private subnets |
| 98 | +- Staging and development networks |
| 99 | +- DNS support and hostname configuration |
| 100 | + |
| 101 | +#### Compute instances (19) |
| 102 | + |
| 103 | +Various instance types across all providers: |
| 104 | + |
| 105 | +- Web servers, application servers, database servers |
| 106 | +- Linux and Windows instances |
| 107 | +- Different instance sizes (t3.large, m5.xlarge, n1-standard-2, Standard_D2s_v3, etc.) |
| 108 | + |
| 109 | +#### Network infrastructure |
| 110 | + |
| 111 | +- Internet gateways for public connectivity |
| 112 | +- NAT gateways for private subnet outbound access |
| 113 | +- Route tables for traffic routing |
| 114 | +- Elastic/static IP addresses |
| 115 | +- Network interfaces with security group associations |
| 116 | + |
| 117 | +## Schema architecture |
| 118 | + |
| 119 | +The cloud schema uses a hierarchical structure with clear relationships: |
| 120 | + |
| 121 | +```text |
| 122 | +CloudProvider |
| 123 | + └── CloudAccount |
| 124 | + └── CloudVirtualNetwork |
| 125 | + ├── CloudSubnet |
| 126 | + ├── CloudSecurityGroup |
| 127 | + ├── CloudInternetGateway |
| 128 | + └── CloudRouteTable |
| 129 | +
|
| 130 | +CloudRegion |
| 131 | + └── CloudAvailabilityZone |
| 132 | + └── CloudInstance |
| 133 | + └── CloudNetworkInterface |
| 134 | +``` |
| 135 | + |
| 136 | +### Key relationships |
| 137 | + |
| 138 | +- **CloudAccount** belongs to a **CloudProvider** (parent relationship) |
| 139 | +- **CloudRegion** is associated with a **CloudProvider** |
| 140 | +- **CloudAvailabilityZone** belongs to a **CloudRegion** (parent relationship) |
| 141 | +- **CloudVirtualNetwork** is associated with a **CloudAccount** and **CloudRegion** |
| 142 | +- **CloudSubnet** belongs to a **CloudVirtualNetwork** (parent relationship) |
| 143 | +- **CloudInstance** is associated with a **CloudAccount**, **CloudAvailabilityZone**, and **CloudSubnet** |
| 144 | +- **CloudSecurityGroup** can be attached to **CloudInstance** and **CloudNetworkInterface** |
| 145 | + |
| 146 | +### Common attributes |
| 147 | + |
| 148 | +All cloud resources inherit from the `CloudResource` generic, providing: |
| 149 | + |
| 150 | +- `name` - Resource name |
| 151 | +- `description` - Optional description |
| 152 | +- `cloud_id` - Provider-specific resource identifier (ARN, resource ID, etc.) |
| 153 | +- `status` - Operational status (active, stopped, provisioning, terminating, error) |
| 154 | +- `tags` - Optional tags for categorization |
| 155 | + |
| 156 | +## Use cases |
| 157 | + |
| 158 | +### Multi-cloud inventory |
| 159 | + |
| 160 | +Use Infrahub as a single source of truth for all cloud resources: |
| 161 | + |
| 162 | +- Track resources across AWS, GCP, and Azure in one place |
| 163 | +- Maintain consistent naming conventions |
| 164 | +- Link cloud resources to on-premises infrastructure |
| 165 | + |
| 166 | +### Security auditing |
| 167 | + |
| 168 | +Query security groups and their associations: |
| 169 | + |
| 170 | +- Identify instances with specific security group configurations |
| 171 | +- Audit network access rules across all clouds |
| 172 | +- Track public IP assignments |
| 173 | + |
| 174 | +### Capacity planning |
| 175 | + |
| 176 | +Analyze compute resources across your cloud footprint: |
| 177 | + |
| 178 | +- Count instances by type, region, or provider |
| 179 | +- Track resource utilization patterns |
| 180 | +- Plan for growth and optimization |
| 181 | + |
| 182 | +### Network documentation |
| 183 | + |
| 184 | +Document your cloud network architecture: |
| 185 | + |
| 186 | +- Map virtual networks, subnets, and routing |
| 187 | +- Track NAT and internet gateway configurations |
| 188 | +- Document network interface assignments |
| 189 | + |
| 190 | +## Next steps |
| 191 | + |
| 192 | +For more information on Infrahub concepts, see: |
| 193 | + |
| 194 | +- **[Understanding the concepts](./concepts.mdx)** - Core Infrahub patterns |
| 195 | +- **[Developer guide](./developer-guide.mdx)** - Extending schemas and creating transforms |
0 commit comments