runpodinfra


Namerunpodinfra JSON
Version 1.9.99 PyPI version JSON
download
home_pagehttps://runpod.io
SummaryThe Runpod Pulumi provider provides resources to interact with Runpod's native APIs.
upload_time2024-07-03 16:53:56
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseApache-2.0
keywords pulumi runpod gpus ml ai
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ---
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](https://www.runpod.io) resources.
The Runpod provider must be configured with Runpod's API keys to deploy and update resources in Runpod.

## Pulumi guide
Create an empty directory and navigate inside

```bash
mkdir -p empty
cd empty
```

Create a new pulumi stack:
```
    pulumi new
```

A dropdown box will appear. Please select a minimal project from in there. For example, if you prefer using Go, you would select the following:
```bash
    go                             A minimal Go Pulumi program
```

Then populate the entrypoint file (__main__.py/main.go/index.ts) with the your data. Please use the guide below to understand more about what parameters are possible for each resource. For Python, please remember to activate the virtual environment.

## Config

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

```bash
  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 docs/installation-configuration.md file. 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.

2. Set your API keys using the process shown above. 

3. Install the official Go package:

```
    go get github.com/runpod/pulumi-runpod-native/sdk/go/runpod@v1.9.98
```
Replace the version above to any that you want. We advise you to pin a certain version as there will be fewer breaking changes.

4. Use this example as a simple building guide for your example project:

```go
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(5),
			DataCenterId: pulumi.String("EU-RO-1"),
		})
		if err != nil {
			return err
		}
		myRandomPod, err := runpod.NewPod(ctx, "myRandomPod", &runpod.PodArgs{
			CloudType: pulumi.String("ALL"),
			NetworkVolumeId: testNetworkStorage.NetworkStorage.ApplyT(func(networkStorage runpod.NetworkStorageType) (*string, error) {
				return &networkStorage.Id, nil
			}).(pulumi.StringPtrOutput),
			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 4090"),
			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
		}
		myTemplate, err := runpod.NewTemplate(ctx, "myTemplate", &runpod.TemplateArgs{
			ContainerDiskInGb:       pulumi.Int(5),
			DockerArgs:              pulumi.String("python3 -m http.server 8080"),
		    Env: runpod.PodEnvArray{
				&runpod.PodEnvArgs{
					Key:   pulumi.String("JUPYTER_PASSWORD"),
					Value: pulumi.String("rns1hunbsstltcpad22d"),
				},
			},
			ImageName:       pulumi.String("runpod/serverless-hello-world:latest"),
			IsServerless:    pulumi.Bool(true),
			Name:            pulumi.String("Testing Pulumi V1"),
			Readme:          pulumi.String("## Hello, World!"),
			VolumeInGb:      pulumi.Int(0),
		})

		if err != nil {
			return err
		}

		myEndpoint, err := runpod.NewEndpoint(ctx, "myEndpoint", &runpod.EndpointArgs{
			GpuIds:         pulumi.String("AMPERE_16"),
			Name:           pulumi.String("Pulumi Endpoint Test V2 -fb"),
			TemplateId:     myTemplate.Template.Id(),
			WorkersMax:     pulumi.Int(2),
			WorkersMin:     pulumi.Int(1),
			IdleTimeout:    pulumi.Int(6),
			Locations:      pulumi.String("EU-RO-1"),
			NetworkVolumeId: testNetworkStorage.NetworkStorage.Id(),
			ScalerType:     pulumi.String("QUEUE_DELAY"),
			ScalerValue:    pulumi.Int(4),
		})

		if err != nil {
			return err
		}

		ctx.Export("pod", myRandomPod.Pod.Id())
		ctx.Export("networkStorage", testNetworkStorage.NetworkStorage.Id())
		ctx.Export("template", myTemplate.Template.Id())
		ctx.Export("endpoint", myEndpoint.Endpoint.Id())
		return nil
	})
}
```

5. PULUMI UP
Create your resources using the command below:

```
    pulumi up
```

6. 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](https://github.com/runpod/pulumi-runpod-native/tree/main/docs).

            

Raw data

            {
    "_id": null,
    "home_page": "https://runpod.io",
    "name": "runpodinfra",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "pulumi runpod gpus ml ai",
    "author": null,
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/76/2a/c42bdfd8c0e83ad3e80607fccdc6a302a7c478655583092370508117841d/runpodinfra-1.9.99.tar.gz",
    "platform": null,
    "description": "---\ntitle: Runpod\nmeta_desc: Provides an overview of the Runpod Provider for Pulumi.\nlayout: package\n---\n\nThe Runpod provider for Pulumi can be used to provision [Runpod](https://www.runpod.io) resources.\nThe Runpod provider must be configured with Runpod's API keys to deploy and update resources in Runpod.\n\n## Pulumi guide\nCreate an empty directory and navigate inside\n\n```bash\nmkdir -p empty\ncd empty\n```\n\nCreate a new pulumi stack:\n```\n    pulumi new\n```\n\nA dropdown box will appear. Please select a minimal project from in there. For example, if you prefer using Go, you would select the following:\n```bash\n    go                             A minimal Go Pulumi program\n```\n\nThen populate the entrypoint file (__main__.py/main.go/index.ts) with the your data. Please use the guide below to understand more about what parameters are possible for each resource. For Python, please remember to activate the virtual environment.\n\n## Config\n\nTo begin with, please set your runpod API key to use with Pulumi.\n\n```bash\n  pulumi config set --secret runpod:token\n```\n\n## Example\n\nThis 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 docs/installation-configuration.md file. If you have any problems in doing so, please contact support@runpod.io.\n\n1. Create a new Pulumi Go example:\n```\n    pulumi new\n```\nSelect either the Go template or Runpod's Go template.\n\n2. Set your API keys using the process shown above. \n\n3. Install the official Go package:\n\n```\n    go get github.com/runpod/pulumi-runpod-native/sdk/go/runpod@v1.9.98\n```\nReplace the version above to any that you want. We advise you to pin a certain version as there will be fewer breaking changes.\n\n4. Use this example as a simple building guide for your example project:\n\n```go\npackage main\n\nimport (\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n\t\"github.com/runpod/pulumi-runpod-native/sdk/go/runpod\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\ttestNetworkStorage, err := runpod.NewNetworkStorage(ctx, \"testNetworkStorage\", &runpod.NetworkStorageArgs{\n\t\t\tName:         pulumi.String(\"testStorage1\"),\n\t\t\tSize:         pulumi.Int(5),\n\t\t\tDataCenterId: pulumi.String(\"EU-RO-1\"),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tmyRandomPod, err := runpod.NewPod(ctx, \"myRandomPod\", &runpod.PodArgs{\n\t\t\tCloudType: pulumi.String(\"ALL\"),\n\t\t\tNetworkVolumeId: testNetworkStorage.NetworkStorage.ApplyT(func(networkStorage runpod.NetworkStorageType) (*string, error) {\n\t\t\t\treturn &networkStorage.Id, nil\n\t\t\t}).(pulumi.StringPtrOutput),\n\t\t\tGpuCount:          pulumi.Int(1),\n\t\t\tVolumeInGb:        pulumi.Int(50),\n\t\t\tContainerDiskInGb: pulumi.Int(50),\n\t\t\tMinVcpuCount:      pulumi.Int(2),\n\t\t\tMinMemoryInGb:     pulumi.Int(15),\n\t\t\tGpuTypeId:         pulumi.String(\"NVIDIA GeForce RTX 4090\"),\n\t\t\tName:              pulumi.String(\"RunPod Pytorch\"),\n\t\t\tImageName:         pulumi.String(\"runpod/pytorch\"),\n\t\t\tDockerArgs:        pulumi.String(\"\"),\n\t\t\tPorts:             pulumi.String(\"8888/http\"),\n\t\t\tVolumeMountPath:   pulumi.String(\"/workspace\"),\n\t\t\tEnv: runpod.PodEnvArray{\n\t\t\t\t&runpod.PodEnvArgs{\n\t\t\t\t\tKey:   pulumi.String(\"JUPYTER_PASSWORD\"),\n\t\t\t\t\tValue: pulumi.String(\"rns1hunbsstltcpad22d\"),\n\t\t\t\t},\n\t\t\t},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tmyTemplate, err := runpod.NewTemplate(ctx, \"myTemplate\", &runpod.TemplateArgs{\n\t\t\tContainerDiskInGb:       pulumi.Int(5),\n\t\t\tDockerArgs:              pulumi.String(\"python3 -m http.server 8080\"),\n\t\t    Env: runpod.PodEnvArray{\n\t\t\t\t&runpod.PodEnvArgs{\n\t\t\t\t\tKey:   pulumi.String(\"JUPYTER_PASSWORD\"),\n\t\t\t\t\tValue: pulumi.String(\"rns1hunbsstltcpad22d\"),\n\t\t\t\t},\n\t\t\t},\n\t\t\tImageName:       pulumi.String(\"runpod/serverless-hello-world:latest\"),\n\t\t\tIsServerless:    pulumi.Bool(true),\n\t\t\tName:            pulumi.String(\"Testing Pulumi V1\"),\n\t\t\tReadme:          pulumi.String(\"## Hello, World!\"),\n\t\t\tVolumeInGb:      pulumi.Int(0),\n\t\t})\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tmyEndpoint, err := runpod.NewEndpoint(ctx, \"myEndpoint\", &runpod.EndpointArgs{\n\t\t\tGpuIds:         pulumi.String(\"AMPERE_16\"),\n\t\t\tName:           pulumi.String(\"Pulumi Endpoint Test V2 -fb\"),\n\t\t\tTemplateId:     myTemplate.Template.Id(),\n\t\t\tWorkersMax:     pulumi.Int(2),\n\t\t\tWorkersMin:     pulumi.Int(1),\n\t\t\tIdleTimeout:    pulumi.Int(6),\n\t\t\tLocations:      pulumi.String(\"EU-RO-1\"),\n\t\t\tNetworkVolumeId: testNetworkStorage.NetworkStorage.Id(),\n\t\t\tScalerType:     pulumi.String(\"QUEUE_DELAY\"),\n\t\t\tScalerValue:    pulumi.Int(4),\n\t\t})\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tctx.Export(\"pod\", myRandomPod.Pod.Id())\n\t\tctx.Export(\"networkStorage\", testNetworkStorage.NetworkStorage.Id())\n\t\tctx.Export(\"template\", myTemplate.Template.Id())\n\t\tctx.Export(\"endpoint\", myEndpoint.Endpoint.Id())\n\t\treturn nil\n\t})\n}\n```\n\n5. PULUMI UP\nCreate your resources using the command below:\n\n```\n    pulumi up\n```\n\n6. PULUMI DOWN\nIf you want to remove your resources, you can use the command below:\n\n```\n    pulumi down\n```\n\nIf you have any issues, please feel free to create an issue or reach out to us directly at support@runpod.io.\n\n> **Note:** For examples in TypeScript and Python, please visit the documentation inside the docs directory or click [here](https://github.com/runpod/pulumi-runpod-native/tree/main/docs).\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "The Runpod Pulumi provider provides resources to interact with Runpod's native APIs.",
    "version": "1.9.99",
    "project_urls": {
        "Homepage": "https://runpod.io",
        "Repository": "https://github.com/runpod/pulumi-runpod-native"
    },
    "split_keywords": [
        "pulumi",
        "runpod",
        "gpus",
        "ml",
        "ai"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "762ac42bdfd8c0e83ad3e80607fccdc6a302a7c478655583092370508117841d",
                "md5": "134267545f34f2c062cdd32d950017ec",
                "sha256": "4561fbd9432c3d6256f47fb3ba09f25a86f792ee09696c304505291b6bac0e21"
            },
            "downloads": -1,
            "filename": "runpodinfra-1.9.99.tar.gz",
            "has_sig": false,
            "md5_digest": "134267545f34f2c062cdd32d950017ec",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 19899,
            "upload_time": "2024-07-03T16:53:56",
            "upload_time_iso_8601": "2024-07-03T16:53:56.741538Z",
            "url": "https://files.pythonhosted.org/packages/76/2a/c42bdfd8c0e83ad3e80607fccdc6a302a7c478655583092370508117841d/runpodinfra-1.9.99.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-03 16:53:56",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "runpod",
    "github_project": "pulumi-runpod-native",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "runpodinfra"
}
        
Elapsed time: 0.47170s