All Products
Search
Document Center

Cloud Enterprise Network:CreateTransitRouterVpcAttachment

Last Updated:Jun 10, 2026

Menyambungkan virtual private cloud (VPC) ke Router transit. Setelah terhubung, Router transit mengaktifkan komunikasi jaringan pribadi.

Deskripsi operasi

  • You can create a VPC connection for an Enterprise Edition transit router in one of two ways:

    • If you have an Enterprise Edition transit router in the target region, you can create a VPC connection by specifying VpcId, ZoneMappings.N.VSwitchId, ZoneMappings.N.ZoneId, TransitRouterId, and RegionId.

    • If you do not have an Enterprise Edition transit router in the target region, you can create a VPC connection by specifying VpcId, ZoneMappings.N.VSwitchId, ZoneMappings.N.ZoneId, CenId, and RegionId. When you create the VPC connection, the system automatically creates an Enterprise Edition transit router.

  • CreateTransitRouterVpcAttachment is an asynchronous operation. After you send a request, the system returns a VPC connection ID, and the connection is created in the background. Call the ListTransitRouterVpcAttachments operation to query the status of the VPC connection.

    • The Attaching state indicates that the VPC connection is being created. In this state, you can only query the VPC connection.

    • The Attached state indicates that the VPC connection has been created.

  • By default, a newly created VPC connection is not associated with any transit router route table for route learning or forwarding.

Prerequisites

Before you call this API operation to create a VPC connection, ensure the following prerequisites are met:

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

cen:CreateTransitRouterVpcAttachment

create

CenInstance

acs:cen:*:{#accountId}:ceninstance/{#ceninstanceId}

TransitRouter

acs:cen:*:{#accountId}:centransitrouter/{#TransitRouterId}

None None

Parameter permintaan

Parameter

Type

Required

Description

Example

ClientToken

string

No

Token klien yang digunakan untuk memastikan idempotensi permintaan.

Anda harus membuat nilai pada klien Anda yang unik di antara permintaan yang berbeda. Token hanya dapat berisi karakter ASCII.

Catatan

Jika Anda tidak menentukan parameter ini, sistem secara otomatis menggunakan ID permintaan sebagai token klien. ID permintaan bersifat unik untuk setiap permintaan.

02fb3da4-130e-11e9-8e44-001****

CenId

string

No

ID Instans CEN.

cen-j3jzhw1zpau2km****

TransitRouterId

string

No

ID Router transit Edisi Perusahaan.

tr-bp1su1ytdxtataupl****

RegionId

string

No

ID Wilayah tempat VPC di-deploy.

Anda dapat memanggil operasi DescribeChildInstanceRegions untuk mengkueri ID wilayah.

cn-hangzhou

TransitRouterAttachmentName

string

No

Nama koneksi VPC.

Nama harus terdiri dari 1 hingga 128 karakter, atau dapat kosong. Nama tidak boleh dimulai dengan http:// atau https://.

testname

TransitRouterAttachmentDescription

string

No

Deskripsi koneksi VPC.

Deskripsi harus terdiri dari 1 hingga 256 karakter, atau dapat kosong. Deskripsi tidak boleh dimulai dengan http:// atau https://.

testname

VpcId

string

Yes

ID VPC.

vpc-bp1kbjcre9vtsebo1****

VpcOwnerId

integer

No

ID akun Alibaba Cloud yang memiliki VPC. Nilai default adalah ID akun Alibaba Cloud saat ini.

Catatan

Parameter ini wajib diisi jika Anda menyambungkan instans jaringan lintas akun.

1250123456123456

ChargeType

string

No

Metode penagihan. Nilai default adalah POSTPAY (bayar sesuai pemakaian).

POSTPAY

DryRun

boolean

No

Apakah akan menjalankan dry run untuk memeriksa validitas permintaan tanpa membuat sumber daya. Pemeriksaan mencakup izin dan status instans. Nilai valid:

  • false (default): Mengirim permintaan normal. Jika permintaan lulus pemeriksaan, sistem akan membuat koneksi VPC.

  • true: Hanya mengirim permintaan dry run. Sistem memeriksa parameter yang diperlukan, format permintaan, dan izin. Koneksi VPC tidak dibuat. Jika pemeriksaan gagal, kesalahan akan dikembalikan. Jika pemeriksaan berhasil, kode kesalahan DryRunOperation akan dikembalikan.

false

ZoneMappings

array<object>

Yes

Pemetaan zona untuk koneksi VPC. Untuk setiap pemetaan, tentukan vSwitch di zona yang didukung oleh Router transit Edisi Perusahaan.

Anda dapat menentukan hingga 10 pemetaan zona.

object

No

A mapping between a vSwitch and a zone.

VSwitchId

string

Yes

The ID of the vSwitch.

vsw-bp1a214sbus8z3b54****

ZoneId

string

Yes

The ID of the zone. The zone must be supported by the Enterprise Edition transit router.

You can call the DescribeZones operation to query available zones.

cn-hangzhou-h

AutoPublishRouteEnabled

boolean

No

Apakah akan mengaktifkan Router transit Edisi Perusahaan untuk secara otomatis mengiklankan rute ke VPC.

  • false (default): Tidak secara otomatis mengiklankan rute.

  • true: Secara otomatis mengiklankan rute.

true

TransitRouterVPCAttachmentOptions

object

No

Properti koneksi VPC. Parameter ini sudah tidak digunakan lagi. Gunakan parameter Options sebagai gantinya.

string

No

The properties of the VPC connection. This parameter is deprecated. We recommend that you use the Options parameter instead.

ipv6Support: Specifies whether to enable IPv6. Valid values:

  • enable: Enables IPv6.

  • disable: Disables IPv6.

Catatan

Before you enable IPv6 for the VPC connection, make sure that IPv6 is also enabled for the VPC and its associated vSwitches. For more information, see AllocateVpcIpv6Cidr and CreateVSwitchCidrReservation.

disable

Tag

array<object>

No

Tag yang akan ditambahkan ke koneksi VPC.

Anda dapat menambahkan hingga 20 tag.

object

No

The key and value of the tag.

Key

string

No

The key of the tag.

The tag key cannot be an empty string. The key can be up to 64 characters long and cannot start with aliyun or acs:. It cannot contain http:// or https://.

tagtest

Value

string

No

The value of the tag.

The tag value can be an empty string or a string up to 128 characters long. It cannot start with aliyun or acs:, and cannot contain http:// or https://.

tagtest

Options

object

No

Ipv6Support

string

No

enable

ApplianceModeSupport

string

No

enable

Elemen respons

Element

Type

Description

Example

object

The response data.

TransitRouterAttachmentId

string

The ID of the VPC connection.

tr-attach-ia340z7xis7t5s****

RequestId

string

The request ID.

C087A369-82B9-43EF-91F4-4B63A9C6E6B6

Contoh

Respons sukses

JSONformat

{
  "TransitRouterAttachmentId": "tr-attach-ia340z7xis7t5s****",
  "RequestId": "C087A369-82B9-43EF-91F4-4B63A9C6E6B6"
}

Kode kesalahan

HTTP status code

Error code

Error message

Description

400 OperationUnsupported.TransitRouterRegionId The specified TransitRouterRegion does not support the operation.
400 NoPermission.AliyunServiceRoleForCEN You are not authorized to create the service linked role. Role Name: AliyunServiceRoleForCEN. Service Name: cen.aliyuncs.com. Make sure that the user has been granted the ram:CreateServiceLinkedRole permission.
400 IllegalParam.RegionId The Specified Parameter RegionId is illegal
400 MissingParam.CenIdOrRegionId Either CenId or RegionId must be specified.
400 IllegalParam.ZoneId The specified ZoneId is illegal.
400 IllegalParam.ChargeType The specified ChargeType is illegal.
400 InvalidTransitRouterId.NotFound The specified TransitRouterId is not found.
400 IncorrectStatus.VpcResource The resource is not in a valid state for the attachment operation.
400 IncorrectStatus.Vpc The resource is not in a valid state for the attachment operation.
400 IncorrectStatus.VpcOrVswitch The Vpc Or Vswith is not in a valid state for the attachment operation.
400 OperationNotSupport.VpcAutoRoutesPublish Auto publish vpc routes is not supported in this region.
400 InvalidOperation.VpnAssociated The operation is not supported because the VPC is associated with VPN.
400 Forbbiden.TransitRouterServiceNotOpen The user has not open transit router service.
400 IllegalParam.ZoneMappings The Specified Parameter ZoneMappings is illegal
400 OperationUnsupported.TransitRouterType The specified TransitRouterType does not support the operation.
400 InvalidCenId.NotFound CenId is not found.
400 IllegalParam.VSwitchId VSwitchId is illegal.
400 IncorrectStatus.TransitRouterInstance The status of TransitRouter is incorrect.
400 OperationUnsupported.CenFullLevel CEN full level does not support TransitRouter
400 IllegalParam.ServiceMode ServiceMode is illegal.
400 QuotaFull.ChildInstanceRelatedCen The childinstance has exceed the quota of the times that a childinstance can be attached as an attachment.
400 OperationUnsupported.CloudBoxVswNotSupport Cloud Box vsw does not support.
400 IncorrectStatus.TransitRouter The status of TransitRouter is incorrect.
400 Duplicated.ZoneMapping The parameter ZoneMapping is duplicated.
400 QuotaExceeded.CenQuotaVpcAttachPerTransitRouter The maximum number of VPC attachment per Transit Router is exceeded.
400 IncorrectStatus.VpcRouteTable The VPC route table is not in a desired state.
400 InvalidStatus.VpcAttachedFullModeCen The VPC has been attached to another CEN instance whose protection level is FULL.
400 Forbbiden.AttachChildInstanceAcrossBid VPCs that belong to another BID cannot be associated. You need to apply for cross-BID attaching.
400 InvalidOperation.VpcAutoRoutesPublishInOtherCEN The specified VPC already has its routes synchronized with another CEN instance.
400 QuotaExceeded.VpcAutoRoutesPublishPerTransitRouter The number of VPCs that have route synchronization enabled has reached the upper limit.
400 InsufficientIpAddr.vsw Insufficient available IP addresses in the vSwitch.
400 Forbidden.ResourceOwnerTransitRouterServiceNotOpen The resource owner user has not opened transit router service.
400 IllegalParam.TransitRouterRegionId TransitRouterRegionId is illegal.
400 InvalidTransitRouterMode.NeedUpgrade TransitRouter need to upgrade.
400 IllegalParam.Ipv6Support Ipv6Support is illegal. Valid Values are [enable, disable].
400 OperationFailed.VSwitchNotFound The specified vswitch not found.
400 OperationFailed.VSwitchIpv6CidrNotAllocated The specified vswitch does not have IPv6 address allocated.
400 Forbidden.ResourceOwnerTransitRouterServiceExpired The transit router service of the account to which the resource belongs has been suspended due to arrears. Please notify the other party to renew the service and try again.
400 Forbidden.TransitRouterServiceExpired The transit router service is out of service.
400 InvalidParameter Invalid parameter.
400 Unauthorized The AccessKeyId is unauthorized.
400 InvalidParameter.ResourceType The specified parameter ResourceType is invalid.
400 ParamExclusive.TransitRouterVPCAttachmentOptionsAndOptions When creating or modifying a VPC attachment, the input parameter TransitRouterVPCAttachmentOptions and Options cannot be used at the same time.
400 InvalidParameter.ApplianceModeSupport The specified parameter ApplianceModeSupport is invalid.
400 InvalidParameter.Ipv6Support The specified parameter Ipv6Support is invalid.
400 INVALID_OPERATION_RESOURCE_NOT_SUPPORT_APPLIANCE_MODE Only VPC attachment support appliance mode.
404 InvalidVSwitchId.NotFound The specified VSwitchId is not found.
409 InvalidOperation.CenInstanceStatus The CEN instance is not in a valid state for the operation.
409 IncorrectStatus.VpcSwitch The resource is not in a valid state for the attachment operation.

Lihat Error Codes untuk daftar lengkap.

Catatan rilis

Lihat Release Notes untuk daftar lengkap.