All Products
Search
Document Center

Server Load Balancer:CreateLoadBalancer

Last Updated:Jun 11, 2026

Membuat instans Network Load Balancer (NLB) di wilayah tertentu.

Deskripsi operasi

  • When you create an NLB instance, the service-linked role AliyunServiceRoleForNlb is automatically created and assigned to you.

  • CreateLoadBalancer is an asynchronous operation. After you send a request, the system returns an instance ID and runs the task in the background. You can call GetLoadBalancerAttribute to query the status of an NLB instance.

    • If an NLB instance is in the Provisioning state, the NLB instance is being created.

    • If an NLB instance is in the Active state, the NLB instance is created.

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:CreateLoadBalancer

create

*LoadBalancer

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

*VSwitch

acs:vpc:{#regionId}:{#accountId}:vswitch/{#VSwitchId}

EipAddress

acs:vpc:{#regionId}:{#accountId}:eip/{#AllocationId}

*VPC

acs:vpc:{#regionId}:{#accountId}:vpc/{#VpcId}

  • nlb:AddressType
None

Parameter permintaan

Parameter

Type

Required

Description

Example

LoadBalancerType

string

No

Tipe instans Server Load Balancer (SLB). Atur nilainya menjadi network, yang menunjukkan instans NLB.

network

LoadBalancerName

string

No

Nama instans NLB.

Panjangnya harus 2 hingga 128 karakter, dapat berisi huruf, angka, titik (.), garis bawah (_), dan tanda hubung (-), serta harus diawali dengan huruf.

NLB1

AddressType

string

Yes

Tipe alamat IPv4 yang digunakan untuk instans NLB. Nilai valid:

  • Internet: Node instans NLB yang terhubung ke Internet memiliki alamat IP publik. Nama DNS instans NLB yang terhubung ke Internet dapat diresolusi secara publik ke alamat IP publik node. Oleh karena itu, instans NLB yang terhubung ke Internet dapat entri rute permintaan dari klien melalui Internet.

  • Intranet: Node instans NLB internal hanya memiliki alamat IP privat. Nama DNS instans NLB internal dapat diresolusi secara publik ke alamat IP privat node. Oleh karena itu, instans NLB internal hanya dapat entri rute permintaan dari klien yang memiliki akses ke virtual private cloud (VPC) untuk instans NLB.

Catatan

Untuk mengaktifkan alamat IPv6 publik pada instans NLB dual-stack, panggil operasi EnableLoadBalancerIpv6Internet.

Internet

AddressIpVersion

string

No

Versi alamat IP yang digunakan untuk instans NLB. Nilai valid:

  • ipv4 (default)

  • DualStack.

ipv4

VpcId

string

Yes

ID VPC tempat Anda ingin membuat instans NLB.

vpc-bp1b49rqrybk45nio****

ZoneMappings

array<object>

Yes

Pemetaan antara zona dan vSwitch. Instans NLB dapat diterapkan di hingga 10 zona. Jika wilayah mendukung dua zona atau lebih, tentukan setidaknya dua zona.

object

No

The mapping between the zone and the vSwitch. An NLB instance can be deployed in up to 10 zones. If the region supports two or more zones, you must specify at least two zones.

VSwitchId

string

Yes

The ID of the vSwitch in the zone. You can specify only one vSwitch (subnet) in each zone of an NLB instance. An NLB instance can be deployed in up to 10 zones. If the region supports two or more zones, you must specify at least two zones.

vsw-sersdf****

ZoneId

string

Yes

The ID of the zone where the NLB instance is deployed. An NLB instance can be deployed in up to 10 zones. If the region supports two or more zones, specify at least two zones.

You can call the DescribeZones operation to query the most recent zone list.

cn-hangzhou-a

PrivateIPv4Address

string

No

The private virtual IP address (VIP) of the IPv4 version. The private IPv4 address that the NLB instance uses to provide external services.

192.168.10.1

AllocationId

string

No

The ID of the elastic IP address (EIP) that is associated with the Internet-facing NLB instance. Each zone is assigned one EIP. An NLB instance can be deployed in up to 10 zones. If the region supports two or more zones, specify at least two zones.

eip-bp1aedxso6u80u0qf****

Ipv6Address

string

No

The VIP of the IPv6 version. The IPv6 address that the NLB instance uses to provide external services.

2408:400a:d5:3080:b409:840a:ca:e8e5

Ipv4LocalAddresses

array

No

The local IPv4 addresses. The IP addresses that the NLB instance uses to communicate with the backend servers. The number of IP addresses must be an even number, which must be at least 2 and at most 8.

string

No

The local IPv4 address.

192.168.10.2

Ipv6LocalAddresses

array

No

The local IPv6 addresses. The IP addresses that the NLB instance uses to communicate with the backend servers. The number of IP addresses must be an even number, which must be at least 2 and at most 8.

string

No

The local IPv6 address.

2408:400a:d5:3080:b409:840a:ca:e8e6

BandwidthPackageId

string

No

ID instans Internet Shared Bandwidth yang terkait dengan instans NLB yang terhubung ke Internet.

cbwp-bp1vevu8h3ieh****

LoadBalancerBillingConfig

object

No

Pengaturan penagihan instans NLB.

PayType

string

No

The billing method of the NLB instance.

Set the value to PostPay, which specifies the pay-as-you-go billing method.

PostPay

ResourceGroupId

string

No

ID kelompok sumber daya tempat instans berada.

rg-atstuj3rtop****

DryRun

boolean

No

Apakah akan menjalankan dry run tanpa benar-benar membuat permintaan. Nilai valid:

  • true: Hanya menjalankan dry run. Sistem memeriksa permintaan untuk potensi masalah, termasuk nilai parameter yang hilang, sintaks permintaan yang salah, dan batas layanan. Jika permintaan gagal dalam pemeriksaan, Paket kesalahan yang menentukan masalah akan dikembalikan. Jika permintaan lulus pemeriksaan, kode kesalahan DryRunOperation akan dikembalikan.

  • false (default): Memeriksa permintaan dan menjalankan operasi. Jika permintaan lulus pemeriksaan, kode status HTTP 2xx akan dikembalikan, dan operasi akan dijalankan.

false

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. Hanya karakter ASCII yang diizinkan.

Catatan

Jika Anda tidak menentukan parameter ini, nilai RequestId akan digunakan. Nilai RequestId berbeda untuk setiap permintaan.

123e4567-e89b-12d3-a456-426655440000

RegionId

string

No

ID wilayah tempat instans NLB diterapkan.

Anda dapat memanggil operasi DescribeRegions untuk mengkueri daftar wilayah terbaru.

cn-hangzhou

DeletionProtectionConfig

object

No

Konfigurasi fitur perlindungan penghapusan.

Enabled

boolean

No

Specifies whether to enable the deletion protection feature. Valid values:

  • true

  • false (default)

false

Reason

string

No

The reason why the deletion protection feature is enabled or disabled. The reason must be 2 to 128 characters in length, can contain letters, digits, periods (.), underscores (_), and hyphens (-), and must start with a letter.

Instance is running

ModificationProtectionConfig

object

No

Konfigurasi mode baca-saja konfigurasi.

Status

string

No

Specifies whether to enable the configuration read-only mode. Valid values:

  • NonProtection: does not enable the configuration read-only mode. You cannot set the Reason parameter. If the Reason parameter is set, the value is cleared.

  • ConsoleProtection: enables the configuration read-only mode. You can set the Reason parameter.

Catatan

If the parameter is set to ConsoleProtection, the configuration read-only mode is enabled. You cannot modify the configurations of the NLB instance in the NLB console. However, you can call API operations to modify the configurations of the NLB instance.

ConsoleProtection

Reason

string

No

The reason for enabling the configuration read-only mode. The reason must be 2 to 128 characters in length, can contain letters, digits, periods (.), underscores (_), and hyphens (-), and must start with a letter.

Catatan

This parameter takes effect only when Status is set to ConsoleProtection.

Business protection period

Tag

array<object>

No

Tag.

object

No

The tag.

Key

string

No

The key of the tag. The tag key can be up to 64 characters in length, cannot start with aliyun or acs:, and cannot contain http:// or https://. The tag key can contain letters, digits, and the following special characters: _ . : / = + - @

You can specify up to 20 tags in each call.

env

Value

string

No

The value of the tag. The tag value can be up to 128 characters in length, cannot start with acs: or aliyun, and cannot contain http:// or https://. The tag value can contain letters, digits, and the following special characters: _ . : / = + - @

You can specify up to 20 tags in each call.

product

Elemen respons

Element

Type

Description

Example

object

response

RequestId

string

The ID of the request.

CEF72CEB-54B6-4AE8-B225-F876FF7BA984

LoadbalancerId

string

The ID of the NLB instance.

nlb-83ckzc8d4xlp8o****

OrderId

integer

The ID of the order for the NLB instance.

20230000

Contoh

Respons sukses

JSONformat

{
  "RequestId": "CEF72CEB-54B6-4AE8-B225-F876FF7BA984",
  "LoadbalancerId": "nlb-83ckzc8d4xlp8o****",
  "OrderId": 20230000
}

Kode kesalahan

HTTP status code

Error code

Error message

Description

400 OperationDenied.OnlyPayByTrafficSupported The operation is not allowed because of OnlyPayByTrafficSupported.
400 OperationFailed.%s The operation failed because of %s.
400 Mismatch.ZoneIdAndVswitchId The ZoneIdAndVswitchId is mismatched for %s and %s.
400 QuotaExceeded.%s The quota of %s is exceeded, usage %s/%s.
400 DryRunOperation Request validation has been passed with DryRun flag set.
400 OperationDenied.OnlyPostPaidSupported The operation is not allowed because of OnlyPostPaidSupported.
400 OperationFailed.DuplicateZones. The operation failed because of Can not Specify duplicate zones.
400 ResourceNotEnough.VSwitchIp The specified resource of VSwitchIp is not enough.
400 DuplicatedParam.AllocationId The param of AllocationId is duplicated.
400 ResourceInConfiguring.VswitchId The specified resource of VswitchId is being configured, please try again later.
400 IllegalParam The param of %s is illegal.
400 OperationFailed.UnpaidBill The operation failed because of UnpaidBill.
400 OperationDenied.ServiceLinkedRoleNotExist The operation is not allowed because of ServiceLinkedRoleNotExist.
400 ResourceAlreadyAssociated.AllocationId The specified resource of %s is already associated.
400 OperationFailed.vSwitchNotSupportIpv6 The operation failed because of vSwitchNotSupportIpv6.
400 InvalidZones The current zone list is illegal.
400 QuotaExceeded.QuotaInsufficient The quota of %s is exceeded, usage %s/%s.
400 ResourceInUse.IP The specified resource of IP is in use.
400 OperationFailed.CreateOrderError Operation failed because CreateOrderError.
400 OperationFailed.NotExist.ResourceGroup Operation failed because ResourceGroup not exist.
400 IllegalParam.loadBalancerName Param loadBalancerName is illegal.
400 SystemBusy System is busy, please try again later.
400 MissingParam.%s The parameter of %s is missing.
400 IllegalParam.DeletionProtectionConfig DeletionProtectionConfig reason is illegal.
400 IllegalParam.ModificationProtectionConfig ModificationProtectionConfig reason is illegal.
400 Throttling.User Request was denied due to api flow control.
403 UnauthorizedZone The specified zone of %s is not authorized.
403 Forbidden.NoPermission Authentication is failed for NoPermission.
403 UnauthorizedRegion The specified region of %s is not authorized.
404 ResourceNotFound.VSwitch The specified resource of vSwitch is not found.
404 ResourceNotFound.Vpc The specified resource of Vpc is not found.

Lihat Error Codes untuk daftar lengkap.

Catatan rilis

Lihat Release Notes untuk daftar lengkap.