Dyno CLI and API Commands
Last updated October 16, 2024
The Heroku CLI and Platform API provide many useful commands for working with your dynos.
Dyno-Related CLI Commands
To view and modify your app’s dyno settings, you can use the Heroku CLI. It’s also possible to modify some of your app’s dyno settings with the Heroku Dashboard.
Task | Example | See Also |
---|---|---|
List the dynos for an app | heroku ps |
View Your App’s Dynos |
Start worker dynos | heroku ps:scale worker=2 |
Introspect |
Stop a particular process type * | heroku ps:stop worker |
Stop |
Stop a particular dyno * | heroku ps:stop worker.2 |
Stop |
Restart all dynos | heroku ps:restart |
Dyno Restarts |
Restart a particular dyno type | heroku ps:restart web |
Dyno Restarts |
Restart a particular dyno | heroku ps:restart web.1 |
Dyno Restarts |
Scale horizontally (Add more dynos) | heroku ps:scale web=2 |
Scaling |
Scale horizontally by incrementing the current number of dynos | heroku ps:scale web+5 |
Scaling |
Scale different dyno types horizontally at the same time | heroku ps:scale web=1 worker=5 |
Scaling |
Scale vertically (Use bigger dynos) | heroku ps:type worker=standard-2x |
Scaling |
Scale horizontally and vertically at the same time. This example scales the number of web dynos to 3 and resizes them to performance-l | heroku ps:scale web=3:performance-l |
Scaling |
Get help for the heroku ps command | heroku ps --help |
|
Launch a one-off dyno that runs bash in a console | heroku run bash |
One-Off Dynos |
Launch a one-off dyno that runs the “worker” process type that is present in your application’s Procfile | heroku run worker |
One-Off Dynos |
View logs | heroku logs or heroku logs --tail |
Logging |
*Running ps:stop
on dynos that are part of a scaled process automatically restart. In Private Spaces, ps:stop
terminates and replaces the dedicated instance running the dyno(s). To permanently stop dynos, scale down the process.
Dyno-Related API Endpoints
See the Heroku Platform API Reference for more information on these dyno-related endpoints:
- Dyno endpoint for creating and managing individual dynos
- Formation endpoint for managing your dyno formation, such as scaling horizontally or vertically.
- Dyno Size endpoint for retrieving details about dyno sizes available on Heroku