

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# CLI コマンド構文
<a name="cli-command-syntax"></a>

CLI コマンドは、次の構文を使用して使用できます。

```
aws-vpn-client <COMMAND> [OPTIONS]
```

CLI ツールでは、次のコマンドがサポートされています。

```
Usage: aws-vpn-client <COMMAND>

Commands:
  connect                Connect a profile through the AWS VPN Client
  disconnect             Disconnect a profile from the AWS VPN Client
  delete-profile         Delete a profile from the AWS VPN Client
  import-profile         Import a VPN connection profile
  list-profiles          List all VPN profiles
  get-config             Get configuration for a profile
  put-preference         Put a preference value
  list-preferences       List all preferences
  get-connection-status  Get the current connection status for a VPN profile
  list-connections       List all active VPN connections
  send-diagnostic-logs   Send diagnostic logs to AWS for troubleshooting
  help                   Print this message or the help of the given subcommand(s)

Options:
  -h, --help     Print help
  -V, --version  Print version
```

## 接続
<a name="cli-cmd-connect"></a>

### 説明
<a name="cli-cmd-connect-description"></a>

プロファイルへの VPN 接続を確立します。

### 概要
<a name="cli-cmd-connect-synopsis"></a>

```
aws-vpn-client connect
  --profile-name <PROFILE>
  [--auth-user-pass <AUTH_USER_PASS>]
```

### オプション
<a name="cli-cmd-connect-options"></a>

`--profile-name` (文字列)  
接続するプロファイルの名前。このオプションは必須です。

`--auth-user-pass` (文字列)  
ユーザー名 (1 行目）、パスワード (2 行目）、オプションの MFA コード (3 行目) を含むファイルへのパス。このオプションは必須ではありません。

### 例
<a name="cli-cmd-connect-examples"></a>

**例: VPN プロファイルに接続する**

次の`connect`例では、プロファイルへの VPN 接続を確立します。

```
aws-vpn-client connect --profile-name "Production-VPN"
```

出力:

```
{
  "status": "Connected"
}
```

## 切断する
<a name="cli-cmd-disconnect"></a>

### 説明
<a name="cli-cmd-disconnect-description"></a>

アクティブな VPN 接続を終了します。

### 概要
<a name="cli-cmd-disconnect-synopsis"></a>

```
aws-vpn-client disconnect
  --profile-name <PROFILE_NAME>
```

### オプション
<a name="cli-cmd-disconnect-options"></a>

`--profile-name` (文字列)  
切断する接続済みプロファイルの名前。このオプションは必須です。

### 例
<a name="cli-cmd-disconnect-examples"></a>

**例: VPN プロファイルからの切断**

次の の`disconnect`例では、VPN 接続を終了します。成功時の出力はありません。

```
aws-vpn-client disconnect --profile-name "Production-VPN"
```

**例: 切断エラー**

次の`disconnect`例は、プロファイルが接続されていない場合のエラーを示しています。

```
aws-vpn-client disconnect --profile-name "Production-VPN"
```

出力:

```
{
  "status": "Error",
  "message": "Profile is not connected"
}
```

## import-profile
<a name="cli-cmd-import-profile"></a>

### 説明
<a name="cli-cmd-import-profile-description"></a>

VPN 接続プロファイルをインポートします。

### 概要
<a name="cli-cmd-import-profile-synopsis"></a>

```
aws-vpn-client import-profile
  --profile-name <PROFILE_NAME>
  --config-path <CONFIG_PATH>
  [--global]
```

### オプション
<a name="cli-cmd-import-profile-options"></a>

`--profile-name` (文字列)  
インポートされたプロファイルのカスタム名。このオプションは必須です。

`--config-path` (文字列)  
OpenVPN 設定ファイル (.ovpn) へのパス。このオプションは必須です。

`--global` (ブーリアン)  
すべてのユーザーが利用できるグローバルプロファイルとして をインポートします。このオプションには管理者権限が必要です。

### 例
<a name="cli-cmd-import-profile-examples"></a>

**例: プロファイルをインポートする**

次の の`import-profile`例では、VPN 接続プロファイルをインポートします。

```
aws-vpn-client import-profile --profile-name "Production-VPN" --config-path /path/to/vpn-config.ovpn
```

出力:

```
{
  "status": "Success"
}
```

**例: グローバルプロファイルをインポートする**

次の の`import-profile`例では、グローバルプロファイルをインポートします。これには管理者権限が必要です。

```
sudo aws-vpn-client import-profile --profile-name "Company-VPN" --config-path /path/to/config.ovpn --global
```

出力:

```
{
  "status": "Success"
}
```

**例: インポートエラーと無効なファイルパス**

次の`import-profile`例は、設定ファイルが見つからない場合のエラーを示しています。

```
aws-vpn-client import-profile --profile-name "test" --config-path /invalid/path.ovpn
```

出力:

```
{
  "status": "Error",
  "message": "Failed to read OpenVPN config file: No such file or directory (os error 2)"
}
```

## delete-profile
<a name="cli-cmd-delete-profile"></a>

### 説明
<a name="cli-cmd-delete-profile-description"></a>

クライアントからプロファイルを削除します。

### 概要
<a name="cli-cmd-delete-profile-synopsis"></a>

```
aws-vpn-client delete-profile
  --profile-name <PROFILE_NAME>
```

### オプション
<a name="cli-cmd-delete-profile-options"></a>

`--profile-name` (文字列)  
削除するプロファイルの名前。このオプションは必須です。

### 例
<a name="cli-cmd-delete-profile-examples"></a>

**例: プロファイルを削除する**

次の の`delete-profile`例では、VPN プロファイルを削除します。成功時の出力はありません。

```
aws-vpn-client delete-profile --profile-name "Production-VPN"
```

**例: 存在しないプロファイルでエラーを削除する**

次の`delete-profile`例は、プロファイルが存在しない場合のエラーを示しています。

```
aws-vpn-client delete-profile --profile-name "nonexistent"
```

出力:

```
{
  "status": "Error",
  "message": "Profile not found"
}
```

## プロファイルのリスト
<a name="cli-cmd-list-profiles"></a>

### 説明
<a name="cli-cmd-list-profiles-description"></a>

すべての VPN プロファイルを一覧表示します。

### 概要
<a name="cli-cmd-list-profiles-synopsis"></a>

```
aws-vpn-client list-profiles
```

### 例
<a name="cli-cmd-list-profiles-examples"></a>

**例: すべての VPN プロファイルを一覧表示する**

次の の`list-profiles`例では、インポートされたすべての VPN プロファイルを一覧表示します。

```
aws-vpn-client list-profiles
```

出力:

```
[
  {
    "profile-name": "Production-VPN",
    "owned-by": "jdoe",
    "auth-type": "saml",
    "imported-at": "2026-07-21T13:04:42-07:00"
  },
  {
    "profile-name": "Staging-VPN",
    "owned-by": "jdoe",
    "auth-type": "ma",
    "imported-at": "2026-07-22T10:30:00-07:00"
  }
]
```

**注記**  
グローバルプロファイル ( でインポート`--global`) には `owned-by`フィールドがありません。

## get-config
<a name="cli-cmd-get-config"></a>

### 説明
<a name="cli-cmd-get-config-description"></a>

プロファイルの OpenVPN 設定を取得します。

### 概要
<a name="cli-cmd-get-config-synopsis"></a>

```
aws-vpn-client get-config
  --profile-name <PROFILE_NAME>
```

### オプション
<a name="cli-cmd-get-config-options"></a>

`--profile-name` (文字列)  
設定を取得するプロファイルの名前。このオプションは必須です。

### 例
<a name="cli-cmd-get-config-examples"></a>

**例: OpenVPN 設定を取得する**

次の の`get-config`例では、プロファイルの OpenVPN 設定を取得します。

```
aws-vpn-client get-config --profile-name "Production-VPN"
```

出力:

```
client
dev tun
proto udp
remote cvpn-endpoint-0123456789abcdef0.prod.clientvpn.us-east-1.amazonaws.com 443
remote-random-hostname
resolv-retry infinite
nobind
remote-cert-tls server
cipher AES-256-GCM
verb 3
<ca>
-----BEGIN CERTIFICATE-----
...
-----END CERTIFICATE-----
</ca>
auth-user-pass
reneg-sec 0
```

## get-connection-status
<a name="cli-cmd-get-connection-status"></a>

### 説明
<a name="cli-cmd-get-connection-status-description"></a>

VPN プロファイルの現在の接続ステータスを取得します。

### 概要
<a name="cli-cmd-get-connection-status-synopsis"></a>

```
aws-vpn-client get-connection-status
  --profile-name <PROFILE_NAME>
  [--show-details]
```

### オプション
<a name="cli-cmd-get-connection-status-options"></a>

`--profile-name` (文字列)  
接続ステータスを取得するプロファイルの名前。このオプションは必須です。

`--show-details` (ブーリアン)  
出力に接続バイト統計を含めます。

### 例
<a name="cli-cmd-get-connection-status-examples"></a>

**例: 接続ステータスの取得**

次の の`get-connection-status`例では、プロファイルの接続ステータスを取得します。

```
aws-vpn-client get-connection-status --profile-name "Production-VPN"
```

出力:

```
{
  "connection-status": "Connected",
  "latest-connection-attempt": {
    "initiated-by": "jdoe",
    "updated-at": "2026-07-24T15:50:36-07:00"
  }
}
```

**例: 詳細を含む接続ステータスを取得する**

次の`get-connection-status`例には、 `--show-details`オプションを使用したバイト統計が含まれています。

```
aws-vpn-client get-connection-status --profile-name "Production-VPN" --show-details
```

出力:

```
{
  "connection-status": "Connected",
  "latest-connection-attempt": {
    "initiated-by": "jdoe",
    "updated-at": "2026-07-24T15:50:36-07:00",
    "details": {
      "tunnel-bytes-in": 0,
      "tunnel-bytes-out": 0,
      "transport-bytes-in": 9674,
      "transport-bytes-out": 11413
    }
  }
}
```

## list-connections
<a name="cli-cmd-list-connections"></a>

### 説明
<a name="cli-cmd-list-connections-description"></a>

すべてのアクティブな VPN 接続を一覧表示します。

### 概要
<a name="cli-cmd-list-connections-synopsis"></a>

```
aws-vpn-client list-connections
```

### 例
<a name="cli-cmd-list-connections-examples"></a>

**例: アクティブな接続を一覧表示する**

次の の`list-connections`例では、すべてのアクティブな VPN 接続を一覧表示します。

```
aws-vpn-client list-connections
```

出力:

```
[
  {
    "profile-name": "Production-VPN",
    "initiated-by": "jdoe",
    "connection-status": "Connected",
    "last-updated-at": "2026-07-24T15:50:36-07:00"
  }
]
```

**例: アクティブな接続がない**

次の`list-connections`例は、アクティブな接続がない場合の出力を示しています。

```
aws-vpn-client list-connections
```

出力:

```
[]
```

## put-preference
<a name="cli-cmd-put-preference"></a>

### 説明
<a name="cli-cmd-put-preference-description"></a>

グローバル設定のプリファレンスを設定します。ほとんどの設定には管理者権限が必要です。

### 概要
<a name="cli-cmd-put-preference-synopsis"></a>

```
aws-vpn-client put-preference
  --key <PREFERENCE_KEY>
  --value <PREFERENCE_VALUE>
```

### オプション
<a name="cli-cmd-put-preference-options"></a>

`--key` (文字列)  
設定する設定キーの名前。このオプションは必須です。

`--value` (文字列)  
設定キーに設定する値。このオプションは必須です。

次の設定キーを使用できます。

`enable-telemetry`  
テレメトリ (true/false) を有効または無効にします。

`enable-user-profile-management`  
エンドユーザーによるプロファイルのインポートまたは削除 (true/false) を許可または禁止します。

`max-connections`  
同時接続の最大数 (整数、1～5)。

### 例
<a name="cli-cmd-put-preference-examples"></a>

**例: 設定する**

次の の`put-preference`例では、接続の最大数を設定します。これには管理者権限が必要です。成功時の出力はありません。

```
sudo aws-vpn-client put-preference --key max-connections --value 4
```

**例: 管理者権限のないエラー**

次の`put-preference`例は、管理者権限なしで コマンドを実行するときのエラーを示しています。

```
aws-vpn-client put-preference --key max-connections --value 4
```

出力:

```
{
  "status": "Error",
  "message": "Permission denied: admin privileges required"
}
```

**例: 無効な値を持つエラー**

次の`put-preference`例は、無効な値を指定した場合のエラーを示しています。

```
sudo aws-vpn-client put-preference --key max-connections --value 8
```

出力:

```
{
  "status": "Error",
  "message": "Preference value is invalid"
}
```

## list-preferences
<a name="cli-cmd-list-preferences"></a>

### 説明
<a name="cli-cmd-list-preferences-description"></a>

すべてのグローバル設定設定と現在の値を表示します。

### 概要
<a name="cli-cmd-list-preferences-synopsis"></a>

```
aws-vpn-client list-preferences
```

### 例
<a name="cli-cmd-list-preferences-examples"></a>

**例: すべての設定を一覧表示する**

次の の`list-preferences`例では、すべてのグローバル設定設定とその現在の値を表示します。

```
aws-vpn-client list-preferences
```

出力:

```
{
  "enable-telemetry": true,
  "enable-user-profile-management": true,
  "max-connections": 1
}
```

## send-diagnostic-logs
<a name="cli-cmd-send-diagnostic-logs"></a>

### 説明
<a name="cli-cmd-send-diagnostic-logs-description"></a>

診断ログを収集し、トラブルシューティング AWS のために に送信します。

### 概要
<a name="cli-cmd-send-diagnostic-logs-synopsis"></a>

```
aws-vpn-client send-diagnostic-logs
```

### 例
<a name="cli-cmd-send-diagnostic-logs-examples"></a>

**例: 診断ログを送信する**

次の の`send-diagnostic-logs`例では、診断ログを収集して送信します AWS。

```
aws-vpn-client send-diagnostic-logs
```

出力:

```
{
  "reference-id": "us-west-2:78ff6531-5dc4-c706-7149-e6cfd8adadc7/2026-07-24-16-03-55.zip"
}
```

**注記**  
問題をレポートするときに、 AWS サポートと`reference-id`値を共有します。

## 終了コード
<a name="cli-cmd-exit-codes"></a>

 AWS クライアント VPN CLI ツールは、次の終了コードを返します。


| 終了コード | 意味 | 
| --- | --- | 
| 0 | 成功 | 
| 1 | 一般的なエラー | 
| 2 | 無効なコマンド構文 | 