# Could we deploy a canister on a specified subnet?

**URL:** <https://forum.dfinity.org/t/could-we-deploy-a-canister-on-a-specified-subnet/7936>\
**Category:** Developers\
**Created:** [October 15, 2021, 8:02am UTC](https://forum.dfinity.org/t/could-we-deploy-a-canister-on-a-specified-subnet/7936 "2021-10-15T08:02:52Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![link2020](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/link2020/32/3418_2.png) [@link2020](https://forum.dfinity.org/u/link2020)\
**Post date:** [October 15, 2021, 8:02am UTC](https://forum.dfinity.org/t/could-we-deploy-a-canister-on-a-specified-subnet/7936/1 "2021-10-15T08:02:52Z")

</div>

Could we deploy a canister on a specified subnet?  
If we can, when can we deploy a canister on a specified subnet？

---

<div class="post-metadata">

**Author:** ![akhilesh.singhania](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/akhilesh.singhania/32/487_2.png) [@akhilesh.singhania](https://forum.dfinity.org/u/akhilesh.singhania)\
**Post date:** [October 15, 2021, 8:11am UTC](https://forum.dfinity.org/t/could-we-deploy-a-canister-on-a-specified-subnet/7936/2 "2021-10-15T08:11:34Z")

</div>

This is currently not possible but we recognise that this is a problem. We hope to be able to allow users to deploy canisters to specific subnets in the near future.

---

<div class="post-metadata">

**Author:** ![saikatdas0790](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/saikatdas0790/32/17147_2.png) [@saikatdas0790](https://forum.dfinity.org/u/saikatdas0790)\
**Post date:** [October 18, 2021, 5:20pm UTC](https://forum.dfinity.org/t/could-we-deploy-a-canister-on-a-specified-subnet/7936/3 "2021-10-18T17:20:57Z")

</div>

This would be the opposite of the serverless philosophy. Ideally, I’d want to just deploy to the IC and have it figure out the details. I imagine people want to deploy to specific subnets to subvert the issues plaguing pjljw or the like. While other seemingly empty subnets are available.

---

<div class="post-metadata">

**Author:** ![alexa.smith](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/alexa.smith/32/21_2.png) [@alexa.smith](https://forum.dfinity.org/u/alexa.smith)\
**Post date:** [October 18, 2021, 8:31pm UTC](https://forum.dfinity.org/t/could-we-deploy-a-canister-on-a-specified-subnet/7936/4 "2021-10-18T20:31:02Z")

</div>

While not a perfect solution, you can use the `dfx ledger create-canister` command to create an empty canister (which will be created on a random subnet), check on ic.rocks or the ICA dashboard to see where the canister has been created, and if it was created on a desired subnet, deploy a cycles wallet to that canister using `dfx identity --network ic deploy-wallet <canister id>`. Once the cycles wallet is deployed, any canisters created from that cycles wallet will be on the same subnet. I’ve done this and it works! More info on the `create-canister` command here: [dfx ledger :: Internet Computer](https://smartcontracts.org/docs/developers-guide/cli-reference/dfx-ledger.html#create-canister)

---

<div class="post-metadata">

**Author:** ![nomeata](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/nomeata/32/733_2.png) [@nomeata](https://forum.dfinity.org/u/nomeata)\
**Post date:** [October 19, 2021, 9:09am UTC](https://forum.dfinity.org/t/could-we-deploy-a-canister-on-a-specified-subnet/7936/5 "2021-10-19T09:09:16Z")

</div>

> [@alexa.smith](#):
>
> Once the cycles wallet is deployed, any canisters created from that cycles wallet will be on the same subnet.

I consider this a bug (or missing feature): If I create a new canister through a wallet, and the subnet with that wallet is already full, or generally more busy than some other subnet, then I would expect the new canister to be transparently be installed on that subnet (echoing @saikatdas0790’s sentiments). At least “create that canister wherever possible” should be the default, and “create that canister on the same subnet as canister X” or “create this canister on a subnet _other_ than canister X, Y, Z (for load balancing)” or “create this canister on a subnet with at least _n_ nodes” or other subnet indications an optional setting. And I hope we aim for such declarative settings, and not just a blunt and inflexible “create on subnet X”.

---

<div class="post-metadata">

**Author:** ![Hazel](https://avatars.discourse-cdn.com/v4/letter/h/e56c9b/32.png) [@Hazel](https://forum.dfinity.org/u/Hazel)\
**Post date:** [December 14, 2021, 1:51pm UTC](https://forum.dfinity.org/t/could-we-deploy-a-canister-on-a-specified-subnet/7936/6 "2021-12-14T13:51:19Z")

</div>

👋 hey all! Just wanted to check the status of this.

---

<div class="post-metadata">

**Author:** ![diegop](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/diegop/32/569_2.png) [@diegop](https://forum.dfinity.org/u/diegop)\
**Post date:** [December 14, 2021, 3:04pm UTC](https://forum.dfinity.org/t/could-we-deploy-a-canister-on-a-specified-subnet/7936/7 "2021-12-14T15:04:00Z")

</div>

Good question. Let me ping internally as well.

---

<div class="post-metadata">

**Author:** ![bogwar](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/bogwar/32/2161_2.png) [@bogwar](https://forum.dfinity.org/u/bogwar)\
**Post date:** [December 14, 2021, 3:29pm UTC](https://forum.dfinity.org/t/could-we-deploy-a-canister-on-a-specified-subnet/7936/8 "2021-12-14T15:29:04Z")

</div>

We have a proposed feature to allow the caller to specify a subnetwork on which to install a newly created canister. The feature would also require to expose via the dashboard a variety of attributes of subnetworks (like replication factor, availability of threshold ECDSA on that subnetwork, subnetwork load etc), which should allow for a somewhat informed decision.

---

<div class="post-metadata">

**Author:** ![Hazel](https://avatars.discourse-cdn.com/v4/letter/h/e56c9b/32.png) [@Hazel](https://forum.dfinity.org/u/Hazel)\
**Post date:** [December 14, 2021, 10:21pm UTC](https://forum.dfinity.org/t/could-we-deploy-a-canister-on-a-specified-subnet/7936/9 "2021-12-14T22:21:30Z")

</div>

Wonderful, would I be able to use this feature on chain? For me this is critical.

Also, is there a timeline associated with this or is it just proposed?

---

<div class="post-metadata">

**Author:** ![bogwar](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/bogwar/32/2161_2.png) [@bogwar](https://forum.dfinity.org/u/bogwar)\
**Post date:** [December 15, 2021, 8:39am UTC](https://forum.dfinity.org/t/could-we-deploy-a-canister-on-a-specified-subnet/7936/10 "2021-12-15T08:39:06Z")

</div>

Yes, canisters should be able to make such canister creation requests – however in the first iteration it is likely that a canister would not be able read up-to-date subnetwork info so that may need to be fed “manually”. In the long term, we should expose subnetwork info on chain (there’s more than one usecase for this).  
There is no timeline unfortunately at the moment.

---

<div class="post-metadata">

**Author:** ![h1teshtr1path1](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/h1teshtr1path1/32/24662_2.png) [@h1teshtr1path1](https://forum.dfinity.org/u/h1teshtr1path1)\
**Post date:** [April 16, 2022, 5:52pm UTC](https://forum.dfinity.org/t/could-we-deploy-a-canister-on-a-specified-subnet/7936/11 "2022-04-16T17:52:13Z")

</div>

I want some extra information for this, im unable to check wallet\_create\_canister method in motoko , do you have some example for that, already tried to use it according to docs, getting some error…  
if you could help with that :  
[Blog for error](https://forum.dfinity.org/t/syntax-error-with-wallet-create-canister/12193)

---

<div class="post-metadata">

**Author:** ![tokuryoo](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/tokuryoo/32/3369_2.png) [@tokuryoo](https://forum.dfinity.org/u/tokuryoo)\
**Post date:** [March 28, 2023, 12:00pm UTC](https://forum.dfinity.org/t/could-we-deploy-a-canister-on-a-specified-subnet/7936/12 "2023-03-28T12:00:24Z")

</div>

Just wanted to check the status of this.

---

<div class="post-metadata">

**Author:** ![h1teshtr1path1](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/h1teshtr1path1/32/24662_2.png) [@h1teshtr1path1](https://forum.dfinity.org/u/h1teshtr1path1)\
**Post date:** [March 28, 2023, 12:12pm UTC](https://forum.dfinity.org/t/could-we-deploy-a-canister-on-a-specified-subnet/7936/13 "2023-03-28T12:12:34Z")

</div>

In case if it helps, we can create new canisters in the subnet of an already existing canister. Meaning, you can use management canisters create\_canister method from an already existing canister, and new canisters will get created in the same subnet.

---

<div class="post-metadata">

**Author:** ![Vivienne](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/vivienne/32/29170_2.png) [@Vivienne](https://forum.dfinity.org/u/Vivienne)\
**Post date:** [March 28, 2023, 12:15pm UTC](https://forum.dfinity.org/t/could-we-deploy-a-canister-on-a-specified-subnet/7936/14 "2023-03-28T12:15:42Z")

</div>

No specific subnet is possible (yet?), but you can [choose the subnet type](https://internetcomputer.org/docs/current/references/cli-reference/dfx-ledger#dfx-ledger-create-canister) with `dfx ledger create-canister --subnet-type <type>`

To see available options, use `dfx ledger --network ic show-subnet-types`. No option means `application`

---

<div class="post-metadata">

**Author:** ![tokuryoo](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/tokuryoo/32/3369_2.png) [@tokuryoo](https://forum.dfinity.org/u/tokuryoo)\
**Post date:** [March 29, 2023, 1:44am UTC](https://forum.dfinity.org/t/could-we-deploy-a-canister-on-a-specified-subnet/7936/15 "2023-03-29T01:44:52Z")

</div>

Thank you very much. I am amazed. But it is not the best for me.

---

<div class="post-metadata">

**Author:** ![tokuryoo](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/tokuryoo/32/3369_2.png) [@tokuryoo](https://forum.dfinity.org/u/tokuryoo)\
**Post date:** [March 29, 2023, 2:04am UTC](https://forum.dfinity.org/t/could-we-deploy-a-canister-on-a-specified-subnet/7936/16 "2023-03-29T02:04:38Z")

</div>

@Vivienne  
Should I do create-canister and then deploy-wallet?  
If I do dfx deploy, will it deploy to the same subnet as the one the wallet was deployed to?

> dfx identity --network ic deploy-wallet

---

<div class="post-metadata">

**Author:** ![Vivienne](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/vivienne/32/29170_2.png) [@Vivienne](https://forum.dfinity.org/u/Vivienne)\
**Post date:** [March 29, 2023, 8:19am UTC](https://forum.dfinity.org/t/could-we-deploy-a-canister-on-a-specified-subnet/7936/17 "2023-03-29T08:19:44Z")

</div>

> [@tokuryoo](#):
>
> Should I do create-canister and then deploy-wallet?

Only if you want your cycles wallet to be on that subnet as well. It’s a little bit more expensive, but I don’t think that’s a reason not to.

> [@tokuryoo](#):
>
> If I do dfx deploy, will it deploy to the same subnet as the one the wallet was deployed to?

- If the canisters are already created, it will deploy to the already created ones, no matter which subnet they are on.
- If the canisters don’t exist yet, it will create them on the same subnet as your default wallet
- If the canisters don’t exist yet, and you use `dfx deploy --wallet <some wallet id>` it will create the canisters on the same subnet as `<some wallet id>` is located in

---

<div class="post-metadata">

**Author:** ![tokuryoo](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/tokuryoo/32/3369_2.png) [@tokuryoo](https://forum.dfinity.org/u/tokuryoo)\
**Post date:** [March 30, 2023, 3:50am UTC](https://forum.dfinity.org/t/could-we-deploy-a-canister-on-a-specified-subnet/7936/18 "2023-03-30T03:50:19Z")

</div>

@Vivienne  
Thank you for your reploy. I understood.  
Do you think the following way is also possible?

dfx ledger create-canister --subnet-type fiduciary  
I secure a CanisterID with the above. I run dfx deploy using the Application Subnet wallet, specifying the CanisterID in canister\_ids.json. The new canister is deployed to the fiduciary.

Is the CanisterID unique across all subnets?

---

<div class="post-metadata">

**Author:** ![Vivienne](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/vivienne/32/29170_2.png) [@Vivienne](https://forum.dfinity.org/u/Vivienne)\
**Post date:** [March 30, 2023, 10:19am UTC](https://forum.dfinity.org/t/could-we-deploy-a-canister-on-a-specified-subnet/7936/19 "2023-03-30T10:19:44Z")

</div>

> [@tokuryoo](#):
>
> I secure a CanisterID with the above. I run dfx deploy using the Application Subnet wallet, specifying the CanisterID in canister\_ids.json. The new canister is deployed to the fiduciary.

Yes, this works exactly the way you described

> [@tokuryoo](#):
>
> Is the CanisterID unique across all subnets?

Yes

---

<div class="post-metadata">

**Author:** ![gravity\_vi](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/gravity_vi/32/35810_2.png) [@gravity\_vi](https://forum.dfinity.org/u/gravity_vi)\
**Post date:** [January 16, 2024, 4:42pm UTC](https://forum.dfinity.org/t/could-we-deploy-a-canister-on-a-specified-subnet/7936/20 "2024-01-16T16:42:07Z")

</div>

is there a way to create canister on different subnet programmatically using ic-cdk?

[Next page](https://forum.dfinity.org/t/could-we-deploy-a-canister-on-a-specified-subnet/7936.md?page=2)
