Skip to main content

Models

Introduction

In Octo, models are the core building blocks on which all other concepts are built.

Since developers and DevOps engineers often view infrastructure very differently, developers need a higher-level, object-oriented abstraction to work with. Models provide this abstraction, encapsulating infrastructure in a way that feels natural to developers.

note

Models are designed to be simple and hierarchical, encapsulating lower-level infrastructure nodes.

Each model is represented as a graph node, and Octo defines only a small, consistent set of these nodes. With just this handful of nodes, any infrastructure can be expressed. This shared vocabulary ensures that developers have a common, unified understanding of the system.

Default Models

Octo provides a set of core models that act as the building blocks of infrastructure. Each model is represented as a node in the graph, and together they define Octo's base hierarchy.

This hierarchy is shipped as the default, but it is designed to be extended. When used with CDK libraries, developers can introduce new relationships or additional nodes, allowing the hierarchy to evolve and better represent custom infrastructure patterns.

An app is the starting node of your project, and is the root of the model tree. It is a logical grouping of infrastructure and services that together form an application. By definition, there can only be one app node per project.

Example

Here is how a typical model graph for a simple backend server with a database might appear.

  • This is an app with a single region, a single environment, and a default subnet.
  • It includes a single server with a single deployment.
  • An execution for this deployment is placed in this environment and subnet.
  • The server uses a build image to create the deployment and a run image to be used by the execution.
  • Additionally, there's a database service hosted elsewhere, which the execution utilizes to make database calls.
Was this visualization helpful?

The purpose of graphs in Octo is to ensure that everything in this model graph is self-explanatory. These core models serve as the fundamental building blocks of infrastructure, enabling developers to comprehend and intuitively interact with them.

Summary

We've covered Models - the building blocks that encapsulate the infrastructure for developers. We covered the role of the octo library, individual model nodes, their relationships to other model nodes, and how they can be stitched together to create a complex infrastructure.