Skip to content

Canister Settings Reference

Complete reference for all canister settings available in icp-cli.

Overview

Canister settings control resource allocation, behavior, and runtime configuration. They can be specified:

  1. At the canister level in icp.yaml or canister.yaml
  2. At the environment level to override per-environment

Settings

compute_allocation

Guaranteed percentage of compute capacity.

PropertyValue
TypeInteger
Range0-100
Default0 (best effort)
settings:
compute_allocation: 10

Higher values guarantee more compute but cost more cycles.

memory_allocation

Fixed memory reservation in bytes.

PropertyValue
TypeInteger
UnitBytes
DefaultDynamic allocation
settings:
memory_allocation: 4294967296 # 4GB

If not set, the canister uses dynamic memory allocation.

freezing_threshold

Time in seconds before the canister freezes due to low cycles.

PropertyValue
TypeInteger
UnitSeconds
Default2592000 (30 days)
settings:
freezing_threshold: 7776000 # 90 days

The canister freezes if its cycles balance would be exhausted within this threshold.

reserved_cycles_limit

Maximum cycles the canister can hold in reserve.

PropertyValue
TypeInteger
UnitCycles
DefaultNo limit
settings:
reserved_cycles_limit: 1000000000000 # 1T cycles

wasm_memory_limit

Maximum heap size for the WASM module.

PropertyValue
TypeInteger
UnitBytes
DefaultPlatform default
settings:
wasm_memory_limit: 1073741824 # 1GB

wasm_memory_threshold

Memory threshold that triggers low-memory callbacks.

PropertyValue
TypeInteger
UnitBytes
DefaultNone
settings:
wasm_memory_threshold: 536870912 # 512MB

log_visibility

Controls who can read canister logs.

PropertyValue
TypeString
Valuescontrollers, public
Defaultcontrollers
settings:
log_visibility: public

environment_variables

Runtime environment variables accessible to the canister.

PropertyValue
TypeObject (string keys, string values)
DefaultNone
settings:
environment_variables:
API_URL: "https://api.example.com"
DEBUG: "false"
FEATURE_FLAGS: "advanced=true"

Environment variables allow the same WASM to run with different configurations.

Full Example

canisters:
- name: backend
build:
steps:
- type: script
commands:
- cargo build --target wasm32-unknown-unknown --release
- cp target/wasm32-unknown-unknown/release/backend.wasm "$ICP_WASM_OUTPUT_PATH"
settings:
compute_allocation: 5
memory_allocation: 2147483648 # 2GB
freezing_threshold: 2592000 # 30 days
reserved_cycles_limit: 5000000000000
wasm_memory_limit: 1073741824 # 1GB
wasm_memory_threshold: 536870912 # 512MB
log_visibility: controllers
environment_variables:
ENV: "production"
API_BASE_URL: "https://api.example.com"

Environment Overrides

Override settings per environment:

canisters:
- name: backend
settings:
compute_allocation: 1 # Default
environments:
- name: production
network: mainnet
canisters: [backend]
settings:
backend:
compute_allocation: 20 # Production override
freezing_threshold: 7776000 # 90 days
environment_variables:
ENV: "production"

CLI Commands

View settings:

Terminal window
icp canister settings show my-canister

Update settings:

Terminal window
icp canister settings update my-canister --compute-allocation 10

Sync settings from configuration:

Terminal window
icp canister settings sync my-canister

See Also