How-to: create a scale-to-zero endpoint scoped to a volume's datacentre
This is a worked task that spans a few commands. The reference pages
(rp doc serverless create, rp doc volume) document the individual flags;
this page shows them composed into one workflow.
Goal: deploy a serverless endpoint that scales to zero when idle and is automatically co-located with a network volume, so its workers read cached files from disk in the volume's own datacentre.
Steps
- Create (or reuse) a network volume. Its datacentre is what the endpoint will be pinned to:
$ rp volume create --name hf-cache --size 100 --dc EU-RO-1
- Create the endpoint.
--network-volumeattaches the volume by name and is the flag that actually scopes the endpoint to the volume's datacentre (it setsdataCenterIdsfrom the volume's datacentre).--gpus-from-volumeresolves in-stock GPU types from the account-wide serverless catalogue and overrides any--gpuyou passed:
$ rp serverless create --name my-endpoint --template tmpl_abc \
--network-volume hf-cache --gpus-from-volume hf-cache \
--workers-min 0 --workers-max 3 --idle 600 --flashboot
Notes
--workers-min 0is the scale-to-zero switch;--idle 600keeps workers warm for ten minutes before the last one scales down (ignored under--scaler-type REQUEST_COUNT);--flashbootspeeds cold starts.- The endpoint is idempotent by
--name: re-running the samecreateprints the existing endpoint's id and skips the POST. --network-volumeand--gpus-from-volumeare distinct roles:--gpus-from-volumeonly takes effect when a volume is also attached (--network-volume/--network-volume-id), since that is what supplies the datacentre. Without an attached volume,--gpus-from-volumealone leaves the GPU pool empty and the create fails. When both--gpuand--gpus-from-volumeare given,--gpus-from-volumewins.- GPU availability is account-wide, not datacentre-specific, so the resolved
types are not guaranteed to be the only stock in that datacentre — they are
simply the highest-priority in-stock types from the catalogue. The full
placement story is in
Scope a serverless endpoint to a network volume's datacentre;
for the flag-by-flag reference,
rp doc serverless create.