Canister location persisted on NNS?

When I use dfx deploy I can specify the subnet where I want to deploy my canister. Now does IC persist this information in the NNS? Is there a way to query the NNS to determine which subnet a canister is deployed on at a later point in time? Thanks in advance.

The Registry Canister, which is one of the NNS Canisters, holds metadata of ICP canisters.

The canister exposes a get_subnet_for_canister` function where you can query the current subnet of a canister but not the history of subnets.

Reviewing the code for the function, you will see that it queries a routing table that includes the metadata of each canister for the latest IC version.

You would need to access routing tables for the previous IC versions to see the tables. I’ll have to check what’s the easiest way to do this. What language are you working in?

Thanks for the response. I use Rust.

Apologies I misspoke. You are unable to deploy an existing canister on a different subnet. Even if you rerun dfx deploy --network ic --subnet <subnet_id> with a different subnet_id, it will deploy on the subnet that it was originally deployed on.

Thanks for the reply. Sincerely appreciated.