> For the complete documentation index, see [llms.txt](https://docs.roboflow.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.roboflow.com/reference/ja/inference/inference-cli/cloud.md).

# クラウドにデプロイ

inference cloud を使って、Roboflow Inference コンテナを AWS と GCP の CPU または GPU 仮想マシンにデプロイします。

Roboflow Inference コンテナをクラウド上の仮想マシンにデプロイできます。これらの VM は内部で CPU または GPU ベースの Inference Server を実行するように構成されているため、OS、GPU ドライバー、Docker のインストールを気にする必要はありません。Inference CLI は現在、Roboflow Inference のコンテナイメージを Google Cloud（GCP）または Amazon Cloud（AWS）上で動作する仮想マシンにデプロイすることをサポートしています。

Inference CLI は、仮想マシンをデプロイしたいプロジェクトに対応するクラウド CLI が設定済みであることを前提としています。設定手順を読んで、 [Google gcloud CLI](https://cloud.google.com/sdk/docs/install) または [Amazon AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html).

Roboflow Inference のクラウドデプロイは、 [SkyPilot プロジェクト](https://github.com/skypilot-org/skypilot).

{% hint style="warning" %}
以下のコマンドを実行するには、 `cloud-deploy` extras がインストールされている必要があります:

```bash
pip install "inference-cli[cloud-deploy]"
```

{% endhint %}

{% hint style="success" %}
コマンドの詳細を確認するには、次を実行します:

```bash
inference cloud --help
```

各サブコマンドについてもヘルプガイドがあります:

```bash
inference cloud deploy --help
```

{% endhint %}

## `inference cloud deploy`

AWS または GCP に GPU または CPU の推論をデプロイします:

```bash
# AWS の GPU 対応 VM に Roboflow Inference GPU コンテナをデプロイ
inference cloud deploy --provider aws --compute-type gpu
```

```bash
# GCP の CPU 専用 VM に Roboflow Inference CPU コンテナをデプロイ
inference cloud deploy --provider gcp --compute-type cpu
```

デプロイ完了後に表示される「cluster name」に注意してください。このハンドルは、その後の多くのコマンドで使用します。deploy コマンドは、VM に関する役立つデバッグ情報とコスト情報も表示します。

クラウド VM に Inference をデプロイすると、次の形式のエンドポイントも出力されます `http://1.2.3.4:9001`；このエンドポイントに対して推論を実行できます。

ポート 9001 は自動的に開放されることに注意してください。これがクラウドやプロジェクトで許容されるかどうかは、セキュリティ管理者に確認してください。

## `inference cloud status`

デプロイの状態を確認するには、次を実行します:

```bash
inference cloud status
```

## デプロイの停止と開始

次のコマンドでデプロイを開始・停止できます:

```bash
inference cloud start <deployment_handle>
```

と

```bash
# VM を停止します。VM が停止している間はディスクストレージ分のみ課金されます
inference cloud stop <deployment_handle>
```

## `inference cloud undeploy`

デプロイを削除（undeploy）するには、次を実行します:

```bash
inference cloud undeploy <deployment_handle>
```

## クラウドデプロイに SSH 接続する

次のコマンドでクラウドデプロイに SSH 接続できます:

```bash
ssh <deployment_handle>
```

必要な SSH キーは自動的に `~/.ssh/config`に追加されるため、手動で設定する必要はありません。

## クラウドデプロイのカスタマイズ

Roboflow Inference のクラウドデプロイは、社内でテスト済みのテンプレートに基づいて VM を作成します。

高度なユースケースでは、独自の [sky YAML](https://skypilot.readthedocs.io/en/latest/reference/yaml-spec.html) テンプレートをコマンドラインで渡すことで、テンプレートをカスタマイズできます:

```bash
inference cloud deploy --custom /path/to/sky-template.yaml
```

Roboflow CLI に保存されている標準テンプレートをダウンロードし、必要に応じて変更することもできます:

```bash
# このコマンドは標準の gcp/cpu sky テンプレートを出力します。
inference cloud deploy --dry-run --provider gcp --compute-type cpu
```

その後、変更内容に基づいてカスタムテンプレートをデプロイできます。

また、 [sky CLI](https://skypilot.readthedocs.io/en/latest/reference/cli.html) を使ってデプロイを制御し、より高度な機能にアクセスすることもできます。

Roboflow Inference deploy は現在 AWS と GCP をサポートしています。ぜひ [Inference GitHub リポジトリ](https://github.com/roboflow/inference/issues) で issue を作成し、他のクラウドプロバイダーのサポートをご希望ください。

{% hint style="info" %}
Roboflow にサーバーの運用とスケーリングを任せたい場合は、こちらをご覧ください [専用デプロイメント](https://docs.roboflow.com/deployment/roboflow-cloud/dedicated-deployments).
{% endhint %}
