Skip to main content

The Runpod Pulumi provider provides resources to interact with Runpod's native APIs.

Project description


title: Runpod meta_desc: Provides an overview of the Runpod Provider for Pulumi. layout: package

The Runpod provider for Pulumi can be used to provision Runpod resources. The Runpod provider must be configured with Runpod's API keys to deploy and update resources in Runpod.

Config

To begin with, please set your runpod API key to use with Pulumi.

  pulumi config set --secret runpod:token

Example

This is an example of how to deploy it over Golang. We also serve pulumi over Typescript and Python. For more examples, please navigate to the examples directory or the documents inside docs. If you have any problems in doing so, please contact support@runpod.io.

  1. Create a new Pulumi Go example:
    pulumi new

Select either the Go template or Runpod's Go template.

  1. Set your API keys using the config shown above.

  2. Install the official Go package:

    go get github.com/runpod/pulumi-runpod-native/sdk/go/runpod@v1.1.8

Replace the version above to any that you want. We advise you to pin a certain version as there will be fewer breaking changes.

  1. Use this example as a simple building guide for your example project:
package main

import (
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/runpod/pulumi-runpod-native/sdk/go/runpod"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		testNetworkStorage, err := runpod.NewNetworkStorage(ctx, "testNetworkStorage", &runpod.NetworkStorageArgs{
			Name:         pulumi.String("testStorage1"),
			Size:         pulumi.Int(20),
			DataCenterId: pulumi.String("US-NJ"),
		})
		if err != nil {
			return err
		}

		myRandomPod, err := runpod.NewPod(ctx, "myRandomPod", &runpod.PodArgs{
			CloudType:         pulumi.String("ALL"),
			NetworkVolumeId:   testNetworkStorage.NetworkStorage.Id(),
			GpuCount:          pulumi.Int(1),
			VolumeInGb:        pulumi.Int(50),
			ContainerDiskInGb: pulumi.Int(50),
			MinVcpuCount:      pulumi.Int(2),
			MinMemoryInGb:     pulumi.Int(15),
			GpuTypeId:         pulumi.String("NVIDIA GeForce RTX 3070"),
			Name:              pulumi.String("RunPod Pytorch"),
			ImageName:         pulumi.String("runpod/pytorch"),
			DockerArgs:        pulumi.String(""),
			Ports:             pulumi.String("8888/http"),
			VolumeMountPath:   pulumi.String("/workspace"),
			Env: runpod.PodEnvArray{
				&runpod.PodEnvArgs{
					Key:   pulumi.String("JUPYTER_PASSWORD"),
					Value: pulumi.String("rns1hunbsstltcpad22d"),
				},
			},
		})
		if err != nil {
			return err
		}

		ctx.Export("pod", myRandomPod)
		ctx.Export("networkStorage", testNetworkStorage)
		return nil
	})
}
  1. PULUMI UP Create your resources using the command below:
    pulumi up
  1. PULUMI DOWN If you want to remove your resources, you can use the command below:
    pulumi down

If you have any issues, please feel free to create an issue or reach out to us directly at support@runpod.io.

Note: For examples in TypeScript and Python, please visit the documentation inside the docs directory or click here.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

runpodinfra-1.9.98.tar.gz (18.6 kB view details)

Uploaded Source

File details

Details for the file runpodinfra-1.9.98.tar.gz.

File metadata

  • Download URL: runpodinfra-1.9.98.tar.gz
  • Upload date:
  • Size: 18.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for runpodinfra-1.9.98.tar.gz
Algorithm Hash digest
SHA256 a5168ebd92e3dae6c5ca6cdbd6a4df2929629abd07dbb8840938a9e458ca7255
MD5 63fcbc86563afe0c071a37c454bbb749
BLAKE2b-256 7b10498c97ce35b3905f62cf5f3b25e6640b84c313b930ae313700ca5bad0547

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page