Skip to content

Deployment Diagram

c4.diagrams.deployment.DeploymentDiagram

Bases: Diagram

Represents a C4 Deployment Diagram.

A deployment diagram shows how software systems and containers are mapped onto infrastructure nodes, such as servers, devices, or cloud services.

c4.diagrams.deployment.Node

Bases: Boundary

Represents a deployment node in the C4 model.

A Node is a container for deployment elements and can optionally include a sprite for visual representation (e.g., server icon, cloud logo).

Nodes can be nested, and manage their own child elements.

__init__

__init__(
    label: Required[str] = REQUIRED,
    description: str | None = None,
    extensions: ElementExtensions | None = None,
    plantuml: NodeExtensions | None = None,
    alias: Maybe[str] = MISSING,
) -> None

Parameters:

Name Type Description Default
label Required[str]

Display name for the node. Required.

REQUIRED
description str | None

Optional description shown in the rendered diagram.

None
extensions ElementExtensions | None

Backend-specific extension data.

None
plantuml NodeExtensions | None

PlantUML-specific extension data.

None
alias Maybe[str]

Unique identifier for the node. If not provided, it is autogenerated from the label.

MISSING

set_property_header

set_property_header(*args: str) -> Self

Sets the column headers for the element's property table.

This must be called either before adding any property rows, or the header length must match the number of values.

Parameters:

Name Type Description Default
*args str

Column names to use as the property header.

()

Returns:

Type Description
Self

The updated diagram element.

Raises:

Type Description
ValueError

If header length does not match the number of values.

without_property_header

without_property_header() -> Self

Disables the rendering of the header row in the property table.

Returns:

Type Description
Self

The updated diagram element.

add_property

add_property(*args: str) -> Self

Adds a row to the property table.

The number of arguments must match the number of header columns.

Parameters:

Name Type Description Default
*args str

Values for each column in the property row.

()

Returns:

Type Description
Self

The updated diagram element.

Raises:

Type Description
ValueError

If the number of values does not match the header length.

c4.diagrams.deployment.DeploymentNode

Bases: Node

Represents a deployment-specific node in the C4 model.

Used to group containers or systems that are deployed together on a specific machine or environment (e.g., EC2 instance, on-prem server).

__init__

__init__(
    label: Required[str] = REQUIRED,
    description: str | None = None,
    extensions: ElementExtensions | None = None,
    plantuml: NodeExtensions | None = None,
    alias: Maybe[str] = MISSING,
) -> None

Parameters:

Name Type Description Default
label Required[str]

Display name for the deployment node. Required.

REQUIRED
description str | None

Optional description shown in the rendered diagram.

None
extensions ElementExtensions | None

Backend-specific extension data.

None
plantuml NodeExtensions | None

PlantUML-specific extension data.

None
alias Maybe[str]

Unique identifier for the deployment node. If not provided, it is autogenerated from the label.

MISSING