Community Blog From Atomic Operation to Template-based Deployment: New Modes of Automatic Cloud Resource Deployment

From Atomic Operation to Template-based Deployment: New Modes of Automatic Cloud Resource Deployment

This article introduces new modes of automatic cloud resource deployment based on Resource Orchestration Service (ROS), Terraform hosting, and ROS CDK.

This article introduces new modes of automatic cloud resource deployment based on Resource Orchestration Service (ROS), Terraform hosting, and ROS CDK.

On May 29, at the sub-forum of the Alibaba Cloud Developer Conference on On-Cloud Infrastructure Optimization for Application Development, Wang Binxin, a Technical Expert from Alibaba Cloud, delivered a speech. His speech is themed New Modes of Automatic Cloud Resource Deployment, which elaborated on new modes of automatic deployment of cloud resources. These automatic deployment modes are based on ROS, Terraform hosting, and ROS CDK.

This article is based on Wang Binxin's speech.


Current Deployment Modes of Cloud Resources

Challenges from Traditional Modes of Cloud Resource Deployment


Most users deploy resources on the cloud through traditional modes, such as the console, APIs, and SDKs. Such modes face challenges from four aspects, including scale, efficiency, compliance, and cost-effectiveness.

  1. In terms of scale, the development of businesses brings about more resources, which poses challenges to resource deployment and management.
  2. In terms of efficiency, as the scale of resources increases, manual batch deployment becomes impractical.
  3. In terms of compliance, how can we ensure that all changes to the infrastructure comply with organizational management specifications?
  4. In terms of cost-effectiveness, manual deployment cannot make full use of the elasticity on the cloud, and its cost can be reduced further.

Automatic Resource Deployment Modes of Alibaba Cloud

ROS Core Benefits


Facing the challenges of traditional deployment modes, we wondered if we could help our customers automate the deployment of cloud resources. Alibaba Cloud ROS is developed based on the idea of Infrastructure as Code (IaC). It allows developers and administrators to orchestrate resources on the cloud using templates to achieve automatic deployment.

Compared with manual deployment, automatic deployment using ROS brings the following benefits:

  • Efficiency Improvement: It can improve the deployment efficiency of complex solutions, such as SAP, MSP, ISV, and onECS services.
  • Architecture Optimization: ROS provides a wide range of best practice templates from Alibaba Cloud, and users can deploy solution-level architectures without a wealth of architecture experience.
  • Process Control: The IT administrators manage the infrastructures in a unified manner to avoid various risks and standardize the IT management process based on the combination of template-based auditing and CI/CD.
  • Cost Reduction: The automatic deployment mode enables users to deploy and release resources on-demand, utilizing the elasticity on the cloud to reduce costs substantially.

Working Procedure and Core Functions of ROS


The process of automatic deployment using ROS is very simple:

  1. Write the template based on the ROS template syntax and define the cloud resources to be created.
  2. Create a resource stack using the template in the ROS console to execute the deployment. The stack is a collection of resources that are defined in the template.
  3. In the ROS console, view the resource stack and check the status. Users can also go to the corresponding resource console.

Note: The ROS service is free and integrates identity authentication and security auditing functions. The result of resource creation is visual. It also supports multi-account and cross-region deployment as well as detecting and rectifying the differences between stacks and actual resources.

Is there any other way to implement automatic deployment besides using ROS templates?

New Mode 1: Terraform Hosting

What Is Terraform?


Like ROS, Terraform is an automatic orchestration tool based on the idea of IaC. Terraform uses Hashicorp Configuration Language (HCL) to describe infrastructure resources. The syntax is shown in the figure above.

Terraform & ROS


Terraform and ROS are automatic orchestration tools based on the same idea, so they share the same goal of creating a better deployment experience on the cloud for users.

They have a lot in common. For example, the configuration file of Terraform corresponds to the ROS template, the state of Terraform is the equivalent of the resource stack in ROS, and the CLI program of Terraform is the orchestration engine of ROS.

Both options have their respective advantages. Terraform has a simpler syntax and is well suited to multiple clouds. ROS provides free service hosting with cloud-native authentication and auditing capabilities.

How can we combine their advantages? The result is Terraform hosting.

Terraform Hosting


When using Terraform locally, users must download the corresponding Terraform CLI based on the current operating system, write templates, manage the versions of various Providers, and manage files, such as status files.

When performing the Terraform management function, users only need to write a Terraform template in the ROS console to deploy Terraform directly and then manage the resources defined in the template through the resource stack. ROS is responsible for the management at the underlying level.


In terms of the principle, the ROS console combines Terraform templates and converts them into templates that conform to the ROS syntax specification. Then, the ROS server verifies the syntax and generates the tenant information before transferring them to the ROS Terraform service for resource deployment.

Scheduled Deployment and Multi-Cloud Management Scenarios


We can use Terraform hosting in many scenarios.

Scenario 1: Scheduled Resource Deployment

Conventionally, when using Terraform for scheduled resources deployment, users need to create a local scheduled task and run Terraform CLI to achieve scheduled resource deployment. However, on the cloud, we can do this in a different way.

  • Write a Terraform template in advance and declare the cloud resources to be deployed.
  • Write an OOS O&M template to declare that the template calls ROS to deploy resources.
  • Set the execution mode of OOS to scheduled execution. By doing so, OOS periodically triggers ROS, and ROS would deploy resources using the Terraform hosting function.

Scenario 2: Multi-Cloud Management

Users may want to deploy resources of various cloud platforms, such as Alibaba Cloud and AWS, and get visualized results and feedback at the same time. They can write Terraform templates directly to declare various cloud resources and use the Terraform hosting function of ROS to deploy the resources.

A Summary of Terraform Hosting


Terraform hosting allows users to use Terraform directly on the cloud and provides users with the same console experience as the ROS templates. It is also compatible with the ROS native API and provides unified identity authentication and permission control. Compared with using Terraform locally, users do not need to manage multiple Providers and various Terraform CLI versions.

New Mode 2: ROS CDK

Disadvantages of Existing Way of Resource Definition


Users can write an ROS template directly or use a visual editor to generate a template for resources deployment, which can improve resource deployment efficiency significantly. However, this resource deployment method also has some disadvantages:

  • Lack of support for procedural languages
  • Low write efficiency in complex scenarios
  • Less program-friendly
  • Poor dynamic support

In response to these problems, how can we go further and solve these deficiencies on the template?

What Is ROS CDK?


ROS CDK is a command-line tool and multi-language SDK provided by ROS. It defines cloud resources in an advanced and object-oriented abstract mode so that users can build their cloud resources quickly.

ROS CDK uses applications as the entry to resource management. A single application manages multiple resource stacks, and each resource stack contains multiple components. A component can be regarded as a component of cloud resources and can contain one or more resources.

We can choose a programming language we are familiar with (TypeScript, JavaScript, Java, Python, or C#) to write application code for declaring the resources we want to deploy. ROS CDK will convert the project code into an ROS template and use the template for automatic deployment.

Procedure and Project Lifecycle


The procedure for using ROS CDK is simple:

  1. Initialize the project and configure the Alibaba Cloud AccessKey.
  2. Write resource code and test cases for local testing.
  3. Use the CDK CLI or a direct program to deploy resources and manage the resource stack.

In the deployment phase, CDK will instantiate all types of resource objects based on the resource code written by users. Then, some adjustments will be made before the final state in the preparation phase (usually completed by the framework automatically.) Next, various resource attributes will be verified to ensure correct deployment. Finally, an ROS template is synthesized and used to deploy the resource stack.

Sample Code and Template


In the preceding figure, the resource code of ROS CDK is on the left side, where one VPC is declared, and three VSwitches are dynamically generated in a loop. On the right is the ROS template generated by ROS CDK. This shows that ROS CDK can simplify template development in dynamic generation scenarios.

Continuous Deployment through the Integration of Application with CDK


Let's assume that we need to implement a CI/CD system to deploy a resource architecture that uses API Gateway to provided APIs and functions of Function Compute to provide business logic. To do this, we need to deploy the resources in test, pre-release, and online environments, respectively. The resources must be supported when transferring from the test environment to the pre-release environment and then to the online environment.

For such a resource architecture, if we use ROS templates directly, we need to prepare three templates for the three environments. At the same time, templates must be dynamically joined for resource deployment between two environments, which is not friendly to the application. We recommend ROS CDK so applications can specify variables in different environments and produce resources that can meet the dynamic deployment requirements.

Summary of ROS CDK


Compared with resource deployment by using ROS templates directly, ROS CDK allows developers to choose a programming language they are familiar with and use its dynamic characteristics to achieve complex orchestration. ROS CDK can be integrated into applications easily to facilitate resource deployment in applications.



As an increasing number of enterprises begin their migration to the cloud, the way enterprises deploy cloud resources has changed from manual deployment to automatic deployment, from a single cloud to multiple clouds, and from atomic operations to template-based deployment. As the popularity of IaC rises, resource deployment modes vary according to different scenarios. In general, the following four deployment modes are recommended:

  1. For freshman users that only need to manage a limited number of resources, using the console is the simplest way of deploying resources.
  2. For IT administrators of enterprises that need to manage large-scale resources on the cloud, ROS templates are the most effective way to manage infrastructure.
  3. For O&M or R&D personnel that need to implement the resource deployment logic in the business system, ROS CDK will be the best choice.
  4. For multi-cloud administrators that need to visually manage resources on multiple clouds, such as Alibaba Cloud, AWS, and Azure, the ROS Terraform hosting feature is the perfect option.
0 0 0
Share on

Alibaba Cloud ECS

33 posts | 12 followers

You may also like