R
RunPod•2mo ago
neural-soupe

Use SDK to create Network Storage Volumes for Serverless Endpoints

Hello 👋 I am using the SDK to create a serverless endpoint. I know I can specify a volume ID when creating the endpoint via SDK, but is there a way to also programmatically create the network storage volume and push data to it (and then attach it to the endpoint)?
6 Replies
Eren
Eren•2mo ago
Yes you can use the GraphQL API call, sharing curl below, simply set your API key, size, data center, name and that is it. Returns the id of the volume on 200
curl --location curl --location 'https://api.runpod.io/graphql' \
\
--header 'Content-Type: application/json' \
\
--header 'Authorization: Bearer rpa_.....' \
\
--data '{"query":"mutation createNetworkVolume($input: CreateNetworkVolumeInput!) {\n createNetworkVolume(input: $input) {\n id\n name\n size\n dataCenterId\n __typename\n }\n}","variables":{"input":{"name":"volume-name","size":10,"dataCenterId":"EU-CZ-1"}}}' \
curl --location curl --location 'https://api.runpod.io/graphql' \
\
--header 'Content-Type: application/json' \
\
--header 'Authorization: Bearer rpa_.....' \
\
--data '{"query":"mutation createNetworkVolume($input: CreateNetworkVolumeInput!) {\n createNetworkVolume(input: $input) {\n id\n name\n size\n dataCenterId\n __typename\n }\n}","variables":{"input":{"name":"volume-name","size":10,"dataCenterId":"EU-CZ-1"}}}' \
Response:
{
"data": {
"createNetworkVolume": {
"id": "0i.....",
"name": "volume-name",
"size": 10,
"dataCenterId": "EU-CZ-1",
"__typename": "NetworkVolume"
}
}
}
{
"data": {
"createNetworkVolume": {
"id": "0i.....",
"name": "volume-name",
"size": 10,
"dataCenterId": "EU-CZ-1",
"__typename": "NetworkVolume"
}
}
}
neural-soupe
neural-soupeOP•2mo ago
Awesome, will test it out. Thanks!
yhlong00000
yhlong00000•2mo ago
We need to have this in main doc site😂 I will add it tmr
Eren
Eren•2mo ago
Many endpoints missing in docs site
yhlong00000
yhlong00000•2mo ago
Just updated our doc site, will try to release it today

Did you find this page helpful?