VPC環境で利用できます。
ターゲットグループを作成します。
構文
createTargetGroup構文は次の通りです。
./ncloud vloadbalancer createTargetGroup \
--vpcNo <vpc-no> \
--targetGroupProtocolTypeCode <TCP|UDP|PROXY_TCP|HTTP|HTTPS> \
--healthCheckProtocolTypeCode <TCP|HTTP|HTTPS> \
[--targetGroupName <target-group-name>] \
[--targetTypeCode <VSVR>] \
[--targetGroupPort <target-group-port>] \
[--targetGroupDescription <target-group-description>] \
[--healthCheckPort <health-check-port>] \
[--healthCheckUrlPath <health-check-url-path>] \
[--healthCheckHttpMethodTypeCode <HEAD|GET>] \
[--healthCheckCycle <health-check-cycle>] \
[--healthCheckUpThreshold <health-check-up-threshold>] \
[--healthCheckDownThreshold <health-check-down-threshold>] \
[--targetNoList <target-no-list>] \
[--regionCode <KR|SGN|JPN>] \
[--output <json|xml>]
オプション
createTargetGroupの実行時に指定できるオプションについて説明します。
必須オプション
createTargetGroupの必須オプションです。
| オプション | タイプ | 必須の有無 | 説明 |
|---|---|---|---|
--vpcNo |
String | Required | VPC番号
|
--targetGroupProtocolTypeCode |
String | Required | ターゲットグループのプロトコルタイプ
|
--healthCheckProtocolTypeCode |
String | Required | ターゲットの状態を確認するためにヘルスチェックを実行する際に、ロードバランサが使用するプロトコル
|
--healthCheckHttpMethodTypeCode |
String | Conditional | ヘルスチェックを実行する際に使用する HTTPメソッドタイプ
|
任意オプション
createTargetGroupの任意オプションです。指定しない場合、オプションにはデフォルト値が適用されます。
| オプション | タイプ | 必須の有無 | 説明 |
|---|---|---|---|
--targetGroupName |
String | Optional | ターゲットグループの名前
|
--targetTypeCode |
String | Optional | ターゲットグループに追加されるターゲットのタイプ
|
--targetGroupPort |
Integer | Optional | ターゲットグループで使用するポート
|
--targetGroupDescription |
String | Optional | ターゲットグループの説明 (Byte)
|
--healthCheckPort |
Integer | Optional | ターゲットの状態を確認するためにヘルスチェックを実行する際にロードバランサが使用するポート
|
--healthCheckUrlPath |
String | Optional | ヘルスチェックの実行時に使用する URLパス
|
--healthCheckCycle |
Integer | Optional | ヘルスチェックの周期 (秒)
|
--healthCheckUpThreshold |
Integer | Optional | ターゲットの状態を正常と判断するために必要な連続ヘルスチェック成功回数
|
--healthCheckDownThreshold |
Integer | Optional | ターゲットの状態を異常と判断するために必要な連続ヘルスチェック失敗回数
|
--targetNoList |
List | Optional | ターゲットグループにバインドするターゲットリスト
|
共通オプション
vloadbalancerコマンドで共通して使用するオプションについては、Load Balancer (VPC)のオプションをご参照ください。
例
ターゲットグループの作成リクエストが成功すると、ターゲットグループの構成情報が返されます。
コマンド
コマンドの例は次の通りです。
./ncloud vloadbalancer createTargetGroup \
--vpcNo 12345678 \
--targetGroupProtocolTypeCode HTTP \
--healthCheckProtocolTypeCode HTTP \
--targetGroupName lb-test-tg \
--targetGroupPort 80 \
--targetGroupDescription "Test target group" \
--healthCheckHttpMethodTypeCode GET \
--regionCode KR \
--output json
出力
出力の例は次の通りです。
{
"createTargetGroupResponse": {
"totalRows": 1,
"targetGroupList": [
{
"targetGroupNo": "55667788",
"targetGroupName": "lb-test-tg",
"targetType": {
"code": "VSVR",
"codeName": "Server (VPC)"
},
"vpcNo": "12345678",
"targetGroupProtocolType": {
"code": "HTTP",
"codeName": "HTTP protocol"
},
"targetGroupPort": 80,
"targetGroupDescription": "Test target group",
"useStickySession": false,
"useProxyProtocol": false,
"algorithmType": {
"code": "RR",
"codeName": "Round Robin"
},
"createDate": "2026-07-07T17:08:44+0900",
"regionCode": "KR",
"loadBalancerInstanceNo": "",
"healthCheckProtocolType": {
"code": "HTTP",
"codeName": "HTTP protocol"
},
"healthCheckPort": 80,
"healthCheckUrlPath": "/",
"healthCheckHttpMethodType": {
"code": "GET",
"codeName": "HTTP GET Method"
},
"healthCheckCycle": 30,
"healthCheckUpThreshold": 2,
"healthCheckDownThreshold": 2,
"targetNoList": []
}
],
"requestId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"returnCode": "0",
"returnMessage": "success"
}
}