All Products
Search
Document Center

Server Load Balancer:LoadBalancerJoinSecurityGroup

Last Updated:Jun 10, 2026

Mengasosiasikan grup keamanan dengan Instans Network Load Balancer (NLB).

Deskripsi operasi

  • Make sure that you have created a security group. For more information about how to create a security group, see CreateSecurityGroup.

  • An NLB instance can be associated with up to four security groups.

  • You can query the security groups that are associated with an NLB instance by calling the GetLoadBalancerAttribute operation.

  • LoadBalancerJoinSecurityGroup is an asynchronous operation. After a request is sent, the system returns a request ID and runs the task in the background. You can call the GetJobStatus operation to query the status of a task.

    • If the task is in the Succeeded state, the security group is associated.

    • If the task is in the Processing state, the security group is being associated. In this case, you can perform only query operations.

Coba sekarang

Coba API ini di OpenAPI Explorer tanpa perlu penandatanganan manual. Panggilan yang berhasil akan secara otomatis menghasilkan contoh kode SDK sesuai dengan parameter Anda. Unduh kode tersebut dengan kredensial bawaan yang aman untuk penggunaan lokal.

Test

RAM authorization

Tabel berikut menjelaskan otorisasi yang diperlukan untuk memanggil API ini. Anda dapat menentukannya dalam kebijakan Resource Access Management (RAM). Kolom pada tabel dijelaskan sebagai berikut:

  • Action: Aksi yang dapat digunakan dalam elemen Action pada pernyataan kebijakan izin RAM untuk memberikan izin guna melakukan operasi tersebut.

  • API: API yang dapat Anda panggil untuk melakukan aksi tersebut.

  • Access level: Tingkat akses yang telah ditentukan untuk setiap API. Nilai yang valid: create, list, get, update, dan delete.

  • Resource type: Jenis resource yang mendukung otorisasi untuk melakukan aksi tersebut. Ini menunjukkan apakah aksi tersebut mendukung izin tingkat resource. Resource yang ditentukan harus kompatibel dengan aksi tersebut. Jika tidak, kebijakan tersebut tidak akan berlaku.

    • Untuk API dengan izin tingkat resource, jenis resource yang diperlukan ditandai dengan tanda bintang (*). Tentukan Nama Sumber Daya Alibaba Cloud (ARN) yang sesuai dalam elemen Resource pada kebijakan.

    • Untuk API tanpa izin tingkat resource, ditampilkan sebagai All Resources. Gunakan tanda bintang (*) dalam elemen Resource pada kebijakan.

  • Condition key: Kunci kondisi yang didefinisikan oleh layanan. Kunci ini memungkinkan kontrol granular, berlaku baik hanya untuk aksi maupun untuk aksi yang terkait dengan resource tertentu. Selain kunci kondisi spesifik layanan, Alibaba Cloud menyediakan serangkaian common condition keys yang berlaku di semua layanan yang didukung RAM.

  • Dependent action: Aksi dependen yang diperlukan untuk menjalankan aksi tersebut. Untuk menyelesaikan aksi tersebut, pengguna RAM atau role RAM harus memiliki izin untuk melakukan semua aksi dependen.

Action

Access level

Resource type

Condition key

Dependent action

nlb:LoadBalancerJoinSecurityGroup

update

*LoadBalancer

acs:nlb:{#regionId}:{#accountId}:loadbalancer/{#LoadBalancerId}

*SecurityGroup

acs:ecs:{#regionId}:{#accountId}:securitygroup/{#SecurityGroupId}

None None

Parameter permintaan

Parameter

Type

Required

Description

Example

SecurityGroupIds

array

Yes

ID grup keamanan Instans.

string

No

The security group ID of the instance.

sg-bp1fg655nh68xyz9****

LoadBalancerId

string

Yes

ID Instans NLB yang ingin Anda tambahkan ke grup keamanan.

nlb-83ckzc8d4xlp8o****

DryRun

boolean

No

Apakah akan menjalankan dry run tanpa mengirim permintaan aktual. Nilai valid:

  • true: Melakukan prapemeriksaan permintaan tanpa menjalankan operasi. Sistem memeriksa parameter yang diperlukan, sintaks permintaan, dan batasan. Jika permintaan gagal dalam dry run, Paket kesalahan dikembalikan. Jika permintaan lolos dry run, kode kesalahan DryRunOperation dikembalikan.

  • false (default): Menjalankan dry run lalu mengirim permintaan aktual. Jika permintaan lolos dry run, kode status HTTP 2xx dikembalikan dan operasi dijalankan.

true

ClientToken

string

No

Token klien yang digunakan untuk memastikan idempotensi permintaan.

Anda dapat menggunakan klien untuk menghasilkan token. Pastikan token unik di antara permintaan yang berbeda. Token klien hanya dapat berisi karakter ASCII.

Catatan

Jika Anda tidak menentukan parameter ini, sistem menggunakan ID permintaan sebagai token klien. ID permintaan berbeda untuk setiap permintaan.

123e4567-e89b-12d3-a456-426655440000

RegionId

string

No

ID Wilayah Instans NLB.

Anda dapat memanggil operasi DescribeRegions untuk mengkueri daftar Wilayah terbaru.

cn-hangzhou

Elemen respons

Element

Type

Description

Example

object

Associates the NLB instance with a security group.

RequestId

string

The request ID.

CEF72CEB-54B6-4AE8-B225-F876FF7BA984

JobId

string

The ID of the asynchronous task.

72dcd26b-f12d-4c27-b3af-18f6aed5****

Contoh

Respons sukses

JSONformat

{
  "RequestId": "CEF72CEB-54B6-4AE8-B225-F876FF7BA984",
  "JobId": "72dcd26b-f12d-4c27-b3af-18f6aed5****"
}

Kode kesalahan

HTTP status code

Error code

Error message

Description

400 SystemBusy System is busy, please try again later.
400 QuotaExceeded.QuotaInsufficient The quota of %s is exceeded, usage %s/%s. The quota is insufficient, currently used %s/%s. Please modify the quota size in the quota center.
400 Conflict.SecurityGroup The SecurityGroup [%s] is conflict. The specific resource is conflict.
400 Mismatch.%s The %s is mismatched for %s and %s.
400 OperationDenied.%s The operation is not allowed because of %s.
400 TagInvokeError listTagsByResourceIds: InvalidResourceId.NotFound : The specified ResourceIds are not found in our records.
400 Conflict.Lock The Lock [%s] is conflict. The specific resource is conflict.
400 Mismatch.vpc The Vpc is mismatched for %s and %s.
400 DryRunOperation Request validation has been passed with DryRun flag set. Request validation has been passed with DryRun flag set.
400 ResourceInCreating.loadbalancer The specified resource of loadbalancer is creating, please try again later. The specified resource of loadbalancer is creating, please try again later.
400 ResourceInConfiguring.loadbalancer The specified resource of loadbalancer is being configured, please try again later. The specified resource of loadbalancer is being configured, please try again later.
403 Forbidden.NoPermission Authentication is failed for NoPermission. Authentication is failed for NoPermission.
403 Forbidden.SecurityGroup Authentication is failed for SecurityGroup. Authentication is failed for SecurityGroup.
404 ResourceNotFound.loadBalancer The specified resource of loadbalancer is not found. The specified load balancer resource was not found. Please check the input parameters.
404 ResourceNotFound.SecurityGroup The specified resource of SecurityGroup is not found. The specified SecurityGroup resource was not found. Please check the input parameters.

Lihat Error Codes untuk daftar lengkap.

Catatan rilis

Lihat Release Notes untuk daftar lengkap.