Chapter 9: Cloud Infrastructure

Updated

October 31, 2026

Chapter 9: Cloud Infrastructure

Ubuntu is the default operating system for hyperscale public clouds, powering over 60% of all Linux workloads running across Amazon Web Services (AWS), Microsoft Azure, Google Cloud Platform (GCP), Oracle Cloud Infrastructure (OCI), and IBM Cloud.

The foundation of this ubiquity is cloud-init—the industry-standard instance initialization system created by Canonical—combined with cloud-optimized kernels, customized virtual machine images, and declarative Infrastructure-as-Code (IaC) tooling.

This chapter explores how to architect, automate, cost-optimize, and scale cloud infrastructure using Ubuntu 26.04 LTS.


Cloud-Init: The Backbone of Cloud Instances

When a virtual instance boots on AWS, Azure, or OpenStack, the hypervisor attaches virtual CD-ROMs or exposes a link-local metadata service (http://169.254.169.254).

Cloud-init runs during early userspace, interrogating this metadata to configure hostnames, network interfaces, SSH keys, storage filesystems, and initial packages:

┌────────────────────────────────────────────────────────────────────────┐
│                   CLOUD-INIT BOOTSTAGE EXECUTION TIMELINE              │
│                                                                        │
│   1. Generator (early boot): Inspects kernel commandline & datasources │
│   2. Local Stage: Identifies metadata source; writes fallback network  │
│   3. Network Stage: Applies static IPs/DHCP via Netplan; fetches keys  │
│   4. Config Stage: Creates users, sets up disk partitions and mounts   │
│   5. Final Stage: Runs package upgrades and custom runcmd user-data    │
└────────────────────────────────────────────────────────────────────────┘

Production User-Data Directive Example

#cloud-config
# Production user-data for Ubuntu 26.04 web cluster
package_update: true
package_upgrade: true

packages:
  - nginx
  - prometheus-node-exporter
  - ufw

users:
  - name: opsadmin
    gecos: Ops Administrator
    sudo: ALL=(ALL) NOPASSWD:ALL
    shell: /bin/bash
    ssh_authorized_keys:
      - ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIExampleAdminKey opsadmin@corp

write_files:
  - path: /etc/nginx/conf.d/status.conf
    permissions: '0644'
    content: |
      server {
          listen 127.0.0.1:8081;
          location /stub_status {
              stub_status on;
          }
      }

runcmd:
  - [ ufw, default, deny, incoming ]
  - [ ufw, default, allow, outgoing ]
  - [ ufw, allow, 22/tcp ]
  - [ ufw, allow, 80/tcp ]
  - [ ufw, allow, 443/tcp ]
  - [ ufw, --force, enable ]
  - [ systemctl, restart, nginx ]

Ubuntu Images Across Cloud Platforms

Canonical curates dedicated cloud kernels tuned for the virtualization hardware of each major platform:

Cloud Platform Specialized Kernel Package Optimizations & Acceleration
AWS linux-aws Elastic Network Adapter (ENA), Nitro NVMe, Graviton ARM64 NEON/SVE2
Microsoft Azure linux-azure Hyper-V VMBus drivers, Accelerated Networking (MANA), CVM SEV-SNP
Google Cloud linux-gcp Google Virtual NIC (gVNIC), Titanium DPU offloads, Confidential Space
Oracle (OCI) linux-oracle High-bandwidth RoCEv2 networking for bare-metal GPU clusters

Ubuntu Pro for Cloud Subscriptions

In public clouds, Ubuntu Pro can be consumed directly through cloud marketplace billing without negotiating separate contracts: - Zero-Friction Billing: Metered by the minute directly on your AWS, Azure, or GCP cloud invoice. - Full Coverage: Delivers security patching across 35,000+ packages in universe (including Python, Node.js, Redis, and Kafka runtimes). - FIPS 140-3 Modules: Certified cryptographic modules for regulated government and financial institutions.


Infrastructure as Code: Terraform and Pulumi

Modern cloud infrastructure is declared in version-controlled code rather than manual consoles.

Provisioning Ubuntu 26.04 via Terraform (AWS)

# main.tf
terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 5.0"
    }
  }
}

provider "aws" {
  region = "us-east-1"
}

data "aws_ssm_parameter" "ubuntu_2604" {
  name = "/aws/service/canonical/ubuntu/server/26.04/stable/current/amd64/hvm/ebs-gp3/ami-id"
}

resource "aws_instance" "web" {
  ami           = data.aws_ssm_parameter.ubuntu_2604.value
  instance_type = "t3.medium"

  user_data = file("${path.module}/user-data.yaml")

  root_block_device {
    volume_size           = 30
    volume_type           = "gp3"
    encrypted             = true
    delete_on_termination = true
  }

  tags = {
    Name = "u26-production-web"
    Tier = "Frontend"
  }
}

Provisioning via Pulumi (Python)

# __main__.py
import pulumi
import pulumi_aws as aws

ami = aws.ssm.get_parameter(
    name="/aws/service/canonical/ubuntu/server/26.04/stable/current/arm64/hvm/ebs-gp3/ami-id"
)

server = aws.ec2.Instance(
    "u26-arm-worker",
    instance_type="c7g.xlarge",
    ami=ami.value,
    user_data="""#cloud-config
package_upgrade: true
packages:
  - docker.io
""",
    tags={"Environment": "Production"},
)

pulumi.export("public_ip", server.public_ip)

Cloud Cost Optimization Strategies

Deploying cloud infrastructure efficiently requires deliberate systems engineering:

  1. Graviton & ARM64 Adoption:
    • Compiling workloads for ARM64 running on AWS Graviton, Azure Cobalt, or GCP Tau instances delivers up to 40% better price-performance compared to legacy x86 instances.
    • Ubuntu 26.04 provides parity across ARM64 package archives.
  2. Minimal Cloud Images:
    • Utilize ubuntu-minimal images (removing documentation, unused firmware, and graphical libraries) to shrink boot storage to 5 GB and accelerate launch latency to under 3 seconds.
  3. Automated Ephemeral Disks & Spot Fleet:
    • Utilize local NVMe instance store for temporary databases and caches, discarding expensive persistent cloud block storage (EBS/Managed Disks).

Auto-Scaling with Kubernetes on Cloud

In Kubernetes environments (EKS, AKS, GKE), Ubuntu 26.04 serves as the optimized node operating system:

┌────────────────────────────────────────────────────────────────────────┐
│                   KUBERNETES NODE AUTO-SCALING LOOP                    │
│                                                                        │
│   Workload Queue Surges ──► Pods enter Pending state                   │
│                                  │                                     │
│                                  ▼                                     │
│   Karpenter / Cluster Autoscaler detects capacity deficit              │
│                                  │                                     │
│                                  ▼                                     │
│   Launches Ubuntu 26.04 Minimal Node AMI via cloud-init               │
│                                  │                                     │
│                                  ▼                                     │
│   Node joins cluster; kubelet registers; Pods schedule in < 25s!       │
└────────────────────────────────────────────────────────────────────────┘

By pre-caching container images in the AMI snapshot, startup latency from instance launch to running application pods is minimized.


Chapter Summary

  • Cloud-init initializes cloud instances declaratively via link-local metadata across all major cloud providers.
  • Canonical provides cloud-specific kernels with vendor-tailored virtualization, storage, and networking drivers.
  • Ubuntu Pro marketplace subscriptions simplify enterprise compliance and security patching across public clouds.
  • Terraform and Pulumi automate reproducible Ubuntu 26.04 server provisioning as code.
  • ARM64 instances, minimal AMIs, and Karpenter auto-scaling maximize cloud performance while curbing infrastructure spend.