All Products
Search
Document Center

Resource Orchestration Service:PreviewStack

Last Updated:Jun 10, 2026

Mempratinjau informasi tentang stack yang ingin Anda buat atau perbarui berdasarkan templat. Anda dapat memanggil operasi ini untuk memverifikasi apakah Sumber daya templat valid.

Deskripsi operasi

In this example, a stack named MyStack is created in the China (Hangzhou) region and previewed. The TemplateBody parameter of the stack is set to {"ROSTemplateFormatVersion":"2015-09-01"}.

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

ros:PreviewStack

get

*Stack

acs:ros:{#regionId}:{#accountId}:stack/{#StackId}

Template

acs:ros:{#regionId}:{#accountId}:template/{#TemplateId}

None None

Parameter permintaan

Parameter

Type

Required

Description

Example

DisableRollback

boolean

No

Apakah akan menonaktifkan rollback untuk Sumber daya ketika stack gagal dibuat. Nilai valid:

  • true

  • false (default).

false

TimeoutInMinutes

integer

No

Periode waktu habis untuk membuat stack.

Unit: menit.

Nilai default: 60.

60

TemplateBody

string

No

Struktur yang berisi badan templat. Badan templat harus memiliki panjang 1 hingga 524.288 byte. Jika panjang badan templat melebihi batas atas, kami menyarankan Anda menambahkan parameter ke badan permintaan HTTP POST untuk mencegah kegagalan permintaan akibat URL yang terlalu panjang.

Catatan

Anda harus dan hanya dapat menentukan salah satu parameter berikut: TemplateBody, TemplateURL, TemplateId, dan TemplateScratchId.

{"ROSTemplateFormatVersion":"2015-09-01"}

StackPolicyURL

string

No

URL file yang berisi Kebijakan tumpukan. URL harus mengarah ke Kebijakan yang berada di server web HTTP atau HTTPS atau di bucket Object Storage Service (OSS), seperti oss://ros/stack-policy/demo atau oss://ros/stack-policy/demo?RegionId=cn-hangzhou. File Kebijakan dapat memiliki panjang hingga 16.384 byte. Jika Anda tidak menentukan ID Wilayah Bucket OSS, nilai RegionId yang digunakan.

Catatan

Anda hanya dapat menentukan salah satu dari StackPolicyBody dan StackPolicyURL.

URL dapat memiliki panjang hingga 1.350 byte.

oss://ros-stack-policy/demo

RegionId

string

Yes

ID Wilayah stack. Anda dapat memanggil operasi DescribeRegions untuk mengkueri daftar Wilayah terbaru.

cn-hangzhou

StackPolicyBody

string

No

Struktur yang berisi badan Kebijakan tumpukan. Badan Kebijakan tumpukan harus memiliki panjang 1 hingga 16.384 byte.

Catatan

Anda hanya dapat menentukan salah satu dari StackPolicyBody dan StackPolicyURL.

{"Statement": [{"Action": "Update:*", "Resource": "*", "Effect": "Allow", "Principal": "*"}]}

StackName

string

No

Nama stack. Anda dapat menggunakan parameter ini untuk mempratinjau stack yang ingin Anda buat. Nama dapat memiliki panjang hingga 255 karakter, dan dapat berisi angka, huruf, tanda hubung (-), dan garis bawah (_). Nama harus dimulai dengan angka atau huruf.

Catatan

Anda harus dan hanya dapat menentukan salah satu dari StackName dan StackId.

MyStack

ClientToken

string

No

token Klien yang digunakan untuk memastikan idempotensi permintaan. Anda dapat menggunakan Klien untuk menghasilkan token, tetapi Anda harus memastikan bahwa token unik di antara permintaan yang berbeda. token dapat memiliki panjang hingga 64 karakter, dan dapat berisi huruf, angka, garis bawah (_), dan tanda hubung (-). Untuk informasi lebih lanjut, lihat Memastikan idempotensi.

123e4567-e89b-12d3-a456-42665544****

TemplateURL

string

No

URL file yang berisi badan templat. URL harus mengarah ke templat yang berada di server web HTTP atau HTTPS atau di Bucket OSS, seperti oss://ros/template/demo atau oss://ros/template/demo?RegionId=cn-hangzhou. Badan templat dapat memiliki panjang hingga 524.288 byte. Jika Anda tidak menentukan ID Wilayah Bucket OSS, nilai RegionId yang digunakan.

Catatan

Anda harus dan hanya dapat menentukan salah satu parameter berikut: TemplateBody, TemplateURL, TemplateId, dan TemplateScratchId.

oss://ros-template/demo

TemplateId

string

No

ID templat. Parameter ini berlaku untuk Templat bersama dan privat.

Catatan

Anda harus dan hanya dapat menentukan salah satu parameter berikut: TemplateBody, TemplateURL, TemplateId, dan TemplateScratchId.

5ecd1e10-b0e9-4389-a565-e4c15efc****

TemplateVersion

string

No

Versi templat. Parameter ini hanya berlaku ketika TemplateId ditentukan.

v1

Parameters

array<object>

No

Parameter stack.

object

No

ParameterKey

string

Yes

The name of the parameter N. If you do not specify the name and value of a parameter, Resource Orchestration Service (ROS) uses the default name and value that are specified in the template. Maximum value of N: 200.

Catatan

If you specify Parameters, you must specify Parameters.N.ParameterKey.

ALIYUN::AccountId

ParameterValue

string

Yes

The value of parameter N. Maximum value of N: 200.

Catatan

If you specify Parameters, you must specify Parameters.N.ParameterValue.

151266687691****

Parallelism

integer

No

Jumlah maksimum operasi serentak yang dapat dilakukan pada Sumber daya. Parameter ini hanya berlaku untuk Tumpukan Terraform.

Secara default, parameter ini kosong. Anda dapat mengatur parameter ini ke bilangan bulat yang lebih besar dari atau sama dengan 0.

Catatan

Jika Anda mengatur parameter ini ke bilangan bulat yang lebih besar dari 0, bilangan bulat tersebut yang digunakan. Jika Anda mengatur parameter ini ke 0 atau membiarkan parameter ini kosong, nilai default Terraform yang digunakan. Pada umumnya, nilai default Terraform adalah 10.

1

TemplateScratchId

string

No

ID skenario.

Untuk informasi lebih lanjut tentang cara mengkueri ID skenario, lihat ListTemplateScratches.

Catatan

Anda harus dan hanya dapat menentukan salah satu parameter berikut: TemplateBody, TemplateURL, TemplateId, dan TemplateScratchId.

ts-aa9c62feab844a6b****

TemplateScratchRegionId

string

No

ID Wilayah skenario. Nilai default sama dengan nilai RegionId.

Anda dapat memanggil operasi DescribeRegions untuk mengkueri daftar Wilayah terbaru.

cn-hangzhou

StackId

string

No

ID stack. Anda dapat menggunakan parameter ini untuk mempratinjau stack yang ingin Anda perbarui.

Catatan
  • Anda harus dan hanya dapat menentukan salah satu dari StackName dan StackId.

  • Pada skenario di mana Anda mempratinjau stack yang ingin Anda buat atau perbarui, Anda tidak dapat mempratinjau Sumber daya di tumpukan bersarangnya.

4a6c9851-3b0f-4f5f-b4ca-a14bf691****

EnablePreConfig

boolean

No

Apakah akan mengkueri parameter yang ingin Anda gunakan dalam Pemeriksaan Awal kepatuhan.

Nilai valid:

  • true

  • false (default).

false

TaintResources

array

No

Sumber daya yang ditandai sebagai tainted.

string

No

The resource marked as tainted.

  • For a ROS stack, you must specify the resource name as the parameter value. Example: my_vpc.

  • For a Terraform stack, you must specify the resource type and the resource name as the parameter value. Example: alicloud_vpc.my_vpc.

my_vpc

UsePreviousParameters

boolean

No

Apakah akan menggunakan nilai parameter yang terakhir digunakan.

Nilai valid:

  • true: Parameter yang terakhir digunakan akan digunakan kembali.

  • false: Parameter yang terakhir digunakan tidak akan digunakan kembali.

true

Untuk informasi lebih lanjut tentang parameter permintaan umum, lihat Parameter umum.

Elemen respons

Element

Type

Description

Example

object

RequestId

string

The request ID.

B288A0BE-D927-4888-B0F7-B35EF84B6E6F

Stack

object

The information about the stack that is previewed.

TemplateDescription

string

The description of the template.

One ECS instance.

Parameters

array<object>

The parameters of the stack.

object

ParameterKey

string

The name of the parameter.

ALIYUN::AccountId

ParameterValue

string

The value of the parameter.

151266687691****

Description

string

The description of the stack.

One ECS instance.

DisableRollback

boolean

Indicates whether rollback is disabled for the resources when the stack fails to be created.

false

StackName

string

The stack name.

MyStack

TimeoutInMinutes

integer

The timeout period for creating the stack.

Unit: minutes.

60

StackPolicyBody

object

The structure that contains the stack policy body.

{ "Statement": [ { "Action": "Update:*", "Resource": "*", "Effect": "Allow", "Principal": "*" }, { "Action": "Update:*", "Resource": "LogicalResourceId/apple1", "Effect": "Deny", "Principal": "*" } ] }

Resources

array<object>

The resources in the stack.

array<object>

LogicalResourceId

string

The logical ID of the resource.

WebServer

AcsResourceType

string

The resource type of an Alibaba Cloud service.

ACS::ECS::Instance

ResourceType

string

The resource type.

ALIYUN::ECS::Instance

Description

string

The description of the resource.

ECS instance.

Stack

object

The information about the nested stack. The data structure of the value is the same as the data structure of the entire response.

{}

RequiredBy

array

The resources on which the stack depends.

string

The resource on which the stack depends.

["Resource1", "Resource2"]

Properties

object

The resource properties.

{ "DiskMappings": [ { "Category": "cloud_ssd", "Size": "20" } ], "SystemDisk_Category": "cloud_ssd", "InstanceChargeType": "PostPaid", "AutoRenew": "False", "WillReplace": true, "ImageId": "centos_7", "InstanceType": "ecs.g6.large", "AllocatePublicIP": true, "AutoRenewPeriod": 1, "IoOptimized": "optimized", "ZoneId": "cn-beijing-g", "VSwitchId": "", "SecurityGroupId": "", "Period": 1, "InternetChargeType": "PayByTraffic", "SystemDiskCategory": "cloud_efficiency", "InternetMaxBandwidthOut": 1, "VpcId": "", "InternetMaxBandwidthIn": 200, "PeriodUnit": "Month" }

Action

string

The action that is performed on the resource. Valid values:

  • Add

  • Modify

  • Remove

  • None

Add

Replacement

string

Indicates whether a replacement update is performed on the template. Valid values:

  • True: A replacement update is performed on the template.

  • False: A change is made on the template.

  • Conditional: A replacement update may be performed on the template. You can check whether a replacement update is performed when the template is in use.

Catatan

This parameter is returned only if Action is set to Modify.

False

PhysicalResourceId

string

The physical ID of the resource.

This parameter is returned only if Action is set to Modify or Remove.

i-a1b2c3***

RegionId

string

The region where the stack resides.

cn-hangzhou

Log

object

The log that is generated when the stack is run.

TerraformLogs

array<object>

The Terraform logs. This parameter is returned only if the stack is a Terraform stack.

Catatan

This parameter contains the logs of previewing the stack.

object

Command

string

The name of the Terraform command that is run. Valid values:

  • apply

  • plan

  • destroy

  • version

For more information about Terraform commands, see Basic CLI Features.

apply

Stream

string

The output stream. Valid values:

  • stdout: standard output stream

  • stderr: standard error stream

stdout

Content

string

The content of the output stream that is returned after the command is run.

Apply complete! Resources: 42 added, 0 changed, 0 destroyed.

Contoh

Respons sukses

JSONformat

{
  "RequestId": "B288A0BE-D927-4888-B0F7-B35EF84B6E6F",
  "Stack": {
    "TemplateDescription": "One ECS instance.",
    "Parameters": [
      {
        "ParameterKey": "ALIYUN::AccountId",
        "ParameterValue": "151266687691****"
      }
    ],
    "Description": "One ECS instance.",
    "DisableRollback": false,
    "StackName": "MyStack",
    "TimeoutInMinutes": 60,
    "StackPolicyBody": {
      "Statement": [
        {
          "Action": "Update:*",
          "Resource": "*",
          "Effect": "Allow",
          "Principal": "*"
        },
        {
          "Action": "Update:*",
          "Resource": "LogicalResourceId/apple1",
          "Effect": "Deny",
          "Principal": "*"
        }
      ]
    },
    "Resources": [
      {
        "LogicalResourceId": "WebServer",
        "AcsResourceType": "ACS::ECS::Instance",
        "ResourceType": "ALIYUN::ECS::Instance",
        "Description": "ECS instance.",
        "Stack": {},
        "RequiredBy": [
          "[\"Resource1\", \"Resource2\"]"
        ],
        "Properties": {
          "DiskMappings": [
            {
              "Category": "cloud_ssd",
              "Size": "20"
            }
          ],
          "SystemDisk_Category": "cloud_ssd",
          "InstanceChargeType": "PostPaid",
          "AutoRenew": "False",
          "WillReplace": true,
          "ImageId": "centos_7",
          "InstanceType": "ecs.g6.large",
          "AllocatePublicIP": true,
          "AutoRenewPeriod": 1,
          "IoOptimized": "optimized",
          "ZoneId": "cn-beijing-g",
          "VSwitchId": "",
          "SecurityGroupId": "",
          "Period": 1,
          "InternetChargeType": "PayByTraffic",
          "SystemDiskCategory": "cloud_efficiency",
          "InternetMaxBandwidthOut": 1,
          "VpcId": "",
          "InternetMaxBandwidthIn": 200,
          "PeriodUnit": "Month"
        },
        "Action": "Add",
        "Replacement": "False",
        "PhysicalResourceId": "i-a1b2c3***"
      }
    ],
    "RegionId": "cn-hangzhou",
    "Log": {
      "TerraformLogs": [
        {
          "Command": "apply",
          "Stream": "stdout",
          "Content": "Apply complete! Resources: 42 added, 0 changed, 0 destroyed."
        }
      ]
    }
  }
}

Kode kesalahan

Lihat Error Codes untuk daftar lengkap.

Catatan rilis

Lihat Release Notes untuk daftar lengkap.