You can write a Resource Orchestration Service template to automatically create ENS instances.
Supported resources
-
Resource Orchestration Service (ROS) simplifies cloud resource management. You can create a template to define Alibaba Cloud resources, such as ECS instances and ApsaraDB RDS instances, and their dependencies. The ROS engine automatically creates and configures all resources defined in the template. For more information, see What is Resource Orchestration Service?
-
ROS supports the following ENS resources, including regular and data resources.
-
Regular resources:
-
ALIYUN::ENS::Disk: Creates a pay-as-you-go or subscription data disk.
-
ALIYUN::ENS::DiskInstanceAttachment: Attaches a data disk to an ENS instance.
-
ALIYUN::ENS::Instance: Creates an ENS instance.
-
ALIYUN::ENS::InstanceSecurityGroupAttachment: Adds an ENS instance to a specified security group.
-
ALIYUN::ENS::KeyPair: Imports the public key of an RSA key pair.
-
ALIYUN::ENS::Network: Creates a VPC.
-
ALIYUN::ENS::NetworkAcl: Creates a network ACL rule.
-
ALIYUN::ENS::NetworkAclAssociation: Associates a network ACL with a network.
-
ALIYUN::ENS::SecurityGroup: Creates a security group.
-
ALIYUN::ENS::Snapshot: Creates a snapshot.
-
ALIYUN::ENS::vSwitch: Creates a vSwitch.
-
-
Data resources:
-
DATASOURCE::ENS::Instances: Queries the details of one or more ENS instances.
-
-
Permissions
To create an ENS instance in this example, Resource Orchestration Service uses the credentials of the current console user. The user must have the following permission:
-
AliyunENSFullAccess: The permission to manage ENS resources.
Operating with an Alibaba Cloud account poses a high security risk. We recommend that you use a RAM user with only the minimum required permissions for API calls and routine operations. To learn how to grant a RAM user permissions to manage ENS resources, see System policies for ENS.
Procedure
-
Log on to the ROS console. In the top navigation bar, select a region from the Region drop-down list.
-
On the Stacks page, click Create Stack. In the Specify Template section, click Select an Existing Template.
Note-
If you select Create Template or ROS Infrastructure Composer, you are redirected to the corresponding page.
-
-
For Template Import Method, select Enter Template Content. For Template Content, select ROS and enter the code.
For more information about the syntax and parameters for creating an ENS instance, see ALIYUN::ENS::Instance. This example creates two instances.
-
Click Create to launch the stack.
-
After the stack is created, you can view the new instances by using OpenAPI, SDKs, or the ENS console.
In the navigation pane on the left of the ENS console, choose Compute & Image > Instances. On the Instances page, you can view the newly created instances. In the Status column, the instance status is Running.