All Products
Search
Document Center

Cloud Control API:Manage resources by using Cloud Control API

Last Updated:Feb 25, 2025

This topic uses managing resources throughout the lifecycle of a virtual private cloud (VPC) to demonstrate how to call the Cloud Control API on OpenAPI Explorer.

Prerequisites

Log on to the OpenAPI Explorer. We recommend that you use a RAM user with the following permissions:

1. Permission to manage Cloud Control API. For more information, see Manage RAM users.

2. Permission to manage VPCs. For more information, see Use RAM to manage VPC permissions.

Procedure

You can call the Cloud Control API to create, access, update, list, and delete VPCs. If you need to integrate the Cloud Control API, refer to the sample codes in the OpenAPI Explorer.

1. Create a VPC

  1. Log on to the OpenAPI Explorer as a RAM user. Click Resource creation under VPC, set regionId and body parameters, and then click Initiate Call. You can select a language for the sample code on the right. The system automatically generates code for your reference.

    创建vpc.png

  2. View the results after a call is initiated.

    If an error is reported in the call, find the cause by referring to the log, API documentation, or common error codes in Diagnose. You can also contact us.

    If the call is successful, record resourceId in the returned results. Status code 200 indicates that the resource creation task is synchronous, while status code 202 indicates that the task is asynchronous. Query the task by using the returned taskId.

    Note

    Synchronous and asynchronous operations are two modes of task execution. The difference is that a synchronous operation returns after the task is completed, while an asynchronous operation returns without waiting for the task to finish.

    创建vpc返回.png

  3. In this example, the returned status code is 202, which indicates an asynchronous operation. You must query the task status based on the taskId. Record taskId and click Query task to go to the Get Task page.

    点击查询任务.png

  4. Enter taskId and click Initiate Call. View the call result. If the call is successful, the task status becomes Succeeded and the VPC is created.

    任务查询.png

  5. View the created VPC in the Alibaba Cloud Console.

    控制台查看.png

2. Access VPC resources

On the Get Resource page, enter Resource ID, select regionId, and click Initiate Call. The call is successful and the resource information is returned.

资源查询.png

3. Update VPC resources

On the Update Resource page, enter the Resource ID, select regionId, enter the parameter to be updated, and click Initiate Call. You can view the updated resources in the Alibaba Cloud Console or by calling the CloudMonitor API.

资源更新.png

4. Query VPCs

On the Get Resource page, select the regionId and click Initiate Call. View resources in the call results.

资源列举.png

5. Delete a VPC

  1. On the Delete Resource page, enter a Resource ID, select a regionId, and then click Initiate Call.

    资源删除.png

  2. If the call is successful and status code 202 is returned, it indicates that the call is asynchronous.

    Enter the taskId and click Initiate Call. If the task status is Succeeded, it indicates that the VPC resource has been deleted.

    删除任务查询.png

Sample code

Sample code repository: https://github.com/aliyun/cloud-control-api-demo

This repository provides sample codes of the Cloud Control API for you to query resource metadata and manage cloud resources.