---
title: Fly.ioにRustFSをデプロイするメモ
summary: この記事では、Fly.ioにS3互換ストレージRustFSを無料枠でデプロイし、設定手順とコンソール・aws CLI利用方法を紹介します。
tags: ["RustFS", "S3", "Fly.io"]
categories: ["Middleware", "ObjectStorage", "RustFS"]
date: 2026-01-22T01:54:44.077Z
updated: 2026-01-22T02:46:46.841Z
---

[Fly.io](https://fly.io/)にS3互換のオブジェクトストレージ[RustFS](https://rustfs.com/)をデプロイします。無料枠に収まるサイズでデプロイします。

Fly.ioには`flyctl`コマンドでログイン済みとします。

次の`fly.toml`を作成します。

```toml
primary_region = 'nrt'

[experimental]
  cmd = ['--console-enable', '/data']

[build]
  image = 'rustfs/rustfs:latest'

[env]
  RUSTFS_ADDRESS = '0.0.0.0:9000'
  RUSTFS_CONSOLE_ADDRESS = '0.0.0.0:9001'
  RUSTFS_CONSOLE_ENABLE = 'true'

[[mounts]]
  source = 'rustfs_data'
  destination = '/data'

[[services]]
  protocol = 'tcp'
  internal_port = 9000

  [[services.ports]]
    port = 80
    handlers = ['http']

  [[services.ports]]
    port = 443
    handlers = ['tls', 'http']

[[services]]
  protocol = 'tcp'
  internal_port = 9001

  [[services.ports]]
    port = 9001
    handlers = ['http']

  [[services.ports]]
    port = 8443
    handlers = ['tls', 'http']

[[vm]]
  cpu_kind = 'shared'
  cpus = 1
  memory_mb = 256
```

次のコマンドでデプロイします。

```bash
flyctl apps create --name rustfs --machines
flyctl secrets set -a rustfs  RUSTFS_ACCESS_KEY=xxxxxxxxx
flyctl secrets set -a rustfs RUSTFS_SECRET_KEY=xxxxxxxxx
flyctl volumes create rustfs_data -a rustfs --size 3 --region nrt
flyctl deploy -a rustfs
flyctl logs -a rustfs
```

URLは`flyctl status -a rustfs`の`Hostname`で確認できます。

- `https://<Hostname>` … S3 API の URL  
- `https://<Hostname>:8443` … Console の URL

です。

Console にアクセスします。ログインするには右上の⚙️マークをクリックして、"Server Address" に S3 API の URL を指定する必要があります。

![image](https://s3.ik.am/ikam/_/1769046343247_rustfs-ui-1.png)

![image](https://s3.ik.am/ikam/_/1769046346616_rustfs-ui-2.png)

これで、Secret に設定した ACCESS_KEY と SECRET_KEY でログインできます。

`aws` CLI では次のようにアクセスできます。

```bash
aws configure --profile rustfs
# ACCESS_KEY と SECRET_KEY を設定。Region は何でも良い
aws --profile rustfs --endpoint-url https://<Hostname> s3 ls
```
