You can create templates in Resource Orchestration Service (ROS) to define Alibaba Cloud Elastic Compute Service (ECS) resources, such as ECS instances and security groups, and the dependencies between the resources. The orchestration engine of ROS creates and configures all resources based on the templates to implement automated deployment and O&M. This topic describes how to use a ROS template to automatically create an ECS instance.
ROS is an Alibaba Cloud service that helps simplify the management of cloud computing resources. For more information, see What is ROS?
Supported ECS resources
The resources that can be orchestrated by using ROS include regular and data source resources. For more information, see ECS.
Example
This section describes how to create an ECS instance based on a predefined ROS template.
Permissions
By default, ROS uses the credentials of the user logged on to the ROS console. If you log on to the ROS console by using an Alibaba Cloud account, you do not need to obtain the permissions described in the following table. If you log on to the ROS console as a RAM user, the user must obtain the required permissions. The following table describes the permissions.
Alibaba Cloud service | Required permission |
Virtual Private Cloud | AliyunVPCFullAccess: the permissions to query VPCs and vSwitches and create elastic IP addresses (EIPs). |
Elastic Compute Service | AliyunECSFullAccess: the permissions to create and manage ECS resources, such as ECS instances. |
Resource Orchestration Service | AliyunROSFullAccess: the permissions to create and manage ROS resources, such as stacks. |
Elastic IP Address | AliyunEIPFullAccess: the permissions to create and manage EIPs. |
Required resources
The following figure shows the architecture of resources required by the Elastic Compute Service instance that you want to create.
Region: Select the region in which you want to create an ECS instance. The region that you select in the ECS console is automatically used. You do not need to specify a region.
Network and zone: Alibaba Cloud provides a default VPC per region and a default vSwitch per zone in each default VPC.
Instance type: Select an instance type, such as an instance type that has 2 vCPUs and 4 GiB of memory.
Image: Select an image, such as an Alibaba Cloud Linux image or a Windows Server image. An image contains the operating system and provisioned data that are required to start and run an ECS instance.
Storage: Configure Elastic Block Storage (EBS) devices as the system disk and data disks of the ECS instance based on your business requirements.
EIP: Create an EIP for the ECS instance. The instance can be accessed by using the EIP.
Security group: Select or create a security group for the ECS instance. A security group serves as a virtual firewall to control inbound and outbound traffic for ECS instances.
Key pair: Select or create a key pair for the ECS instance. Alibaba Cloud provides the secure and convenient key pair-based authentication method for logons to ECS instances. Key pairs are security credentials used for authentication. After you create a key pair, the public key is stored on the ECS instance, and the private key is stored on your on-premises computer.
The preceding resources correspond to the following Resource Orchestration Service resources:
Region: The region that you select in the ROS console is automatically used. You do not need to specify a region.
Network and zone: ALIYUN::ECS::VPC.
Instance type: DATASOURCE::ECS::Instance.
Image: DATASOURCE::ECS::Images.
Storage: ALIYUN::ECS::Disk.
EIP: ALIYUN::VPC::EIP.
Security group: ALIYUN::ECS::SecurityGroup.
Key pair: DATASOURCE::ECS::KeyPair.
Create a stack
Click Quick Deploy and perform the following operations.
Log on to the ROS console. In the top navigation bar, select a region from the Region drop-down list.
In the left-side navigation pane, click Stacks. On the Stacks page, choose
. On the Create Stack page, configure the Specify Template parameter. In this example, the Specify Template parameter is set to Use a Sample Template. In this case, you must select a sample template provided by ROS from the Sample Templates drop-down list.Confirm the template content in the Template Content code editor and click Next.
In this example, a sample template that uses an existing VPC, vSwitch, and security group is selected to create two ECS instances and associate EIPs with the instances. The following code snippets show the sample template content in the YAML and JSON formats:
Follow the on-screen instructions to configure the parameters, such as VPC ID, VSwitch Availability Zone, VSwitch ID, and Business Security Group ID, based on your business requirements. Then, click Create to create a stack.
View the result.
When the stack is created, ECS instances are created based on the template specified in the stack and enter the
Running
state. You can view the instances in the ECS console, by calling an API operation, or by using an SDK.
References
ROS allows you to deploy resources with a few clicks in various scenarios, such as environment building, website building, application building, and Artificial Intelligence Generated Content (AIGC) practices. For information about more use cases for ROS, see the following topics: