--- title: "associatePublicIpWithServerInstance" slug: "cli-vserver-publicip-associatepublicipwithserverinstance" updated: 2026-09-17T10:11:03Z published: 2026-09-17T10:11:03Z canonical: "cli.ncloud-docs.com/cli-vserver-publicip-associatepublicipwithserverinstance" --- > ## Documentation Index > Fetch the complete documentation index at: https://cli.ncloud-docs.com/llms.txt > Use this file to discover all available pages before exploring further. # associatePublicIpWithServerInstance VPC環境で利用できます。 パブリック IPアドレスインスタンスをサーバインスタンスに割り当てます。 ## 構文 `associatePublicIpWithServerInstance`構文は次の通りです。 ``` ./ncloud vserver associatePublicIpWithServerInstance \ --publicIpInstanceNo \ --serverInstanceNo \ [--regionCode ] \ [--output ] ``` ## オプション `associatePublicIpWithServerInstance`の実行時に指定できるオプションについて説明します。 ### 必須オプション `associatePublicIpWithServerInstance`の必須オプションです。 | オプション | タイプ | 必須の有無 | 説明 | | --- | --- | --- | --- | | `--publicIpInstanceNo` | String | Required | パブリック IPアドレスインスタンス番号 - [getPublicIpInstanceList](/docs/ja/cli-vserver-publicip-getpublicipinstancelist)を参照 | | `--serverInstanceNo` | String | Required | サーバインスタンス番号 - [getServerInstanceList](/docs/ja/cli-vserver-server-getserverinstancelist)を参照 | ### 共通オプション `vserver`コマンドで共通して使用するオプションについては、[Server (VPC)のオプション](/docs/ja/cli-vserver#%EC%98%B5%EC%85%98)をご参照ください。 ## 例 パブリック IPアドレスの割り当てリクエストが成功すると、パブリック IPアドレスの構成情報と割り当てられたサーバ情報が返されます。 ### コマンド コマンドの例は次の通りです。 ``` ./ncloud vserver associatePublicIpWithServerInstance \ --publicIpInstanceNo 78901234 \ --serverInstanceNo 34567892 \ --regionCode KR \ --output json ``` ### 出力 出力の例は次の通りです。 ``` { "associatePublicIpWithServerInstanceResponse": { "totalRows": 1, "publicIpInstanceList": [ { "publicIpInstanceNo": "78901234", "publicIp": "203.0.113.10", "publicIpDescription": "Test public IP", "createDate": "2026-05-14T19:53:38+0900", "publicIpInstanceStatusName": "Configuring", "publicIpInstanceStatus": { "code": "RUN", "codeName": "実行中" }, "serverInstanceNo": "34567892", "serverName": "public-test-server", "privateIp": "192.0.2.6", "publicIpInstanceOperation": { "code": "SET", "codeName": "SETTING OP" } } ], "requestId": "d4e5f678-9012-3456-def0-456789012345", "returnCode": "0", "returnMessage": "success" } } ```