Object storage
Infrahub provides an interface to store and retrieve files or objects in object storage. Object storage is used internally within Infrahub to store rendered artifacts, but you can also use it to store any text-based file or content.
You can interact with object storage through the REST API and Python SDK. For practical steps, see the object storage guide and the object storage Python SDK guide.
Supported storage backends
Infrahub supports two storage backends:
- Local storage (configured by default)
- AWS S3 (or S3-compatible) storage
You configure the backend by setting the appropriate environment variables. These variables are typically set in your Docker Compose YAML file or in the deployment environment for your containers. See the Infrahub configuration reference for a full list of options.
Local storage
By default, Infrahub uses local storage for artifacts and files. No additional configuration is required unless you want to change the storage location.
To explicitly configure local storage, set the following environment variables in your Docker Compose YAML file or deployment environment:
# ... other configuration ...
INFRAHUB_STORAGE_DRIVER: "local"
INFRAHUB_STORAGE_LOCAL_PATH: "/opt/infrahub/storage"
# ... other configuration ...
All Infrahub API servers and task workers must have access to the specified directory.
AWS S3 storage
To use AWS S3 or any S3-compatible storage, set the following environment variables in your Docker Compose YAML file or deployment environment:
# ... other configuration ...
INFRAHUB_STORAGE_DRIVER: "s3"
AWS_ACCESS_KEY_ID: "my_access_key"
AWS_SECRET_ACCESS_KEY: "secret_access_key"
INFRAHUB_STORAGE_BUCKET_NAME: "my-infrahub-bucket"
INFRAHUB_STORAGE_ENDPOINT_URL: "s3.eu-central-1.amazonaws.com"
# ... other configuration ...
For all available configuration options and environment variables, refer to the Infrahub configuration reference.
You can switch between storage backends by changing the value of INFRAHUB_STORAGE_DRIVER
and updating the relevant environment variables in your deployment configuration.
If you change the storage driver (for example, from local
to s3
or vice versa), existing artifacts will not be automatically migrated.
To regenerate artifacts:
- You must either delete the old artifacts, or
- Manually update their checksum values and regenerate them.
Failing to do so may result in missing or stale artifact files.
Object model
Objects or files stored within object storage are identified by a unique identifier (UUID). This identifier is assigned when the object is created. All interactions with the object use this identifier.
For more details on configuration options, see the Infrahub configuration reference.