This topic describes how to create a stack by importing an existing resource in the
Resource Orchestration Service (ROS) console. An Elastic IP Address (EIP) resource
is used in the example.
Prerequisites
Before you import an EIP resource, make sure that the following operations are performed:
- Obtain the resource identifier property of EIP resources.
For EIP resources, AllocationId is the resource identifier property. It indicates
the ID of an EIP. For more information, see Obtain a resource identifier property for resource import.
- Obtain the ID of the EIP.
Log on to the EIP console to obtain the ID of the EIP that you want to import.
Procedure
- Log on to the ROS console.
- In the left-side navigation pane, click Stacks.
- In the upper-left corner of the page, select a region from the drop-down list.
Note Make sure that the resource that you want to import resides in the same region as
the stack.
- On the Stacks page, click Create Stack and select Use Existing Resources (Resource Import) from the drop-down list.
- In the Select Template step, click Select an Existing Template in the Specify Template section. Set Template Import Method to Enter Template Content. In the Template Content code editor, enter the following template content in the JSON format. Then, click
Next.
{
"ROSTemplateFormatVersion": "2015-09-01",
"Resources": {
"Eip": {
"Type": "ALIYUN::VPC::EIP",
"DeletionPolicy": "Retain",
"Properties": {
"Bandwidth": 5
}
}
},
"Outputs": {
"EipAddress": {
"Value": {
"Fn::GetAtt": [
"Eip",
"EipAddress"
]
}
},
"AllocationId": {
"Value": {
"Fn::GetAtt": [
"Eip",
"AllocationId"
]
}
}
}
}
Note The DeletionPolicy
parameter is set to Retain
, which indicates that the resource is retained when it is removed from a stack. To
prevent resources from being unexpectedly deleted, we recommend that you set the DeletionPolicy
parameter to Retain.
- In the Configure Template Parameters step, configure Stack Name and Change Set Name, and click Next.
- In the Identify Resources step, enter a resource identifier value such as
eip-bp140qv3j25nsfaqd****
, and click Next.
- In the Configure Stack step, configure related parameters and click Next.
In this example, use the default settings. For more information, see
Create a stack.
- In the Check and Confirm step, click Create Stack and Import Change Set.
- On the Change Sets tab of the stack management page, click Execute in the Actions column that corresponds to the change set to start the resource import.
Result
On the Stack Information tab, if Created After Resource Import is displayed to the right of Status in the Basic Information section, the resource is imported.
What to do next
To check whether the template of the imported resource matches the actual template,
click Drift Detection to the right of Drift Status on the Stack Information tab. For more information, see Detect drift on a stack.