Building reusable cloud APIs with Crossplane Compositions

Crossplane turns Kubernetes into a control plane for cloud infrastructure — but the real power for platform teams comes from Compositions: a way to design reusable, opinionated infrastructure APIs that developers consume as simple Kubernetes resources. This article walks through the what, the why, and a compact “get started” pattern using Compositions to provision an RDS database and an S3 bucket behind a single, developer-friendly Composite resource.

Why Compositions matter

Crossplane’s composition model and patterns are documented in the official guides and include templated YAML, CEL transforms, and composition functions for advanced logic. (docs.crossplane.io)

Key concepts (brief)

Why GitOps + Crossplane is a natural fit Crossplane plays well with GitOps operators (Flux, ArgoCD): Git becomes the source of truth for both application and infra manifests, and Crossplane reconciles the cluster-side resources with the cloud. Several community and vendor guides show practical Flux + Crossplane workflows that let teams manage infrastructure entirely from Git. (oneuptime.com)

A compact example: one composite that creates an RDS + S3 bundle Imagine a Composite resource called StorageDB that provisions:

At a high level you need:

  1. An XRD that defines the API surface developers will use.
  2. A Composition that maps fields from the composite to provider-managed resources.
  3. A Provider (provider-aws) and ProviderConfig so Crossplane can create AWS resources.

Minimal XRD (conceptual)

apiVersion: apiextensions.crossplane.io/v1
kind: CompositeResourceDefinition
metadata:
  name: storagedatabases.example.org
spec:
  group: example.org
  names:
    kind: StorageDatabase
    plural: storagedatabases
  claimNames:
    kind: StorageDBClaim
    plural: storagedbclaims
  versions:
    - name: v1
      served: true
      referenceable: true
      schema:
        openAPIV3Schema:
          properties:
            spec:
              properties:
                engine:
                  type: string
                size:
                  type: string
                bucketName:
                  type: string

Compact Composition (conceptual)

apiVersion: apiextensions.crossplane.io/v1
kind: Composition
metadata:
  name: storagedb-composition
spec:
  compositeTypeRef:
    apiVersion: example.org/v1
    kind: StorageDatabase
  resources:
    - name: db
      base:
        apiVersion: database.aws.crossplane.io/v1beta1
        kind: RDSInstance
        spec:
          forProvider:
            allocatedStorage: 20
            engine: mysql
            instanceClass: db.t3.medium
      patches:
        - fromFieldPath: "spec.engine"
          toFieldPath: "spec.forProvider.engine"
        - fromFieldPath: "spec.size"
          toFieldPath: "spec.forProvider.instanceClass"
    - name: bucket
      base:
        apiVersion: s3.aws.crossplane.io/v1beta1
        kind: Bucket
        spec:
          forProvider:
            acl: private
      patches:
        - fromFieldPath: "spec.bucketName"
          toFieldPath: "spec.forProvider.name"

Notes

How to wire credentials and install providers

A few practical tips from experience

Where Compositions shine (and where to be cautious)

Resources and where to read next

Parting thought Compositions let platform teams model infrastructure as higher-level Kubernetes APIs — think of them as building a bespoke, versioned “infrastructure API” tailored to your organization. The initial investment in designing XRDs and safe compositions pays off in developer velocity and predictable, auditable infrastructure deployments. Crossplane’s documentation and community guides make the path practical: start with a focused composite (like StorageDB above), validate provider behavior, and iterate toward a curated platform API that keeps app teams productive and operations predictable. (docs.crossplane.io)