edit-icon download-icon

Manual

Last Updated: Apr 17, 2018

ROS

After installing and configuring aliyun-ros-cli, type ros to use this tool.

ros itself supports the following arguments:

Command Function
-h --help Displays help information.
--config [CONFIG_FILE] Specifies the configuration file to use. If no configuration file is specified, ros/ros.conf under the current directory is used by default.
--json Outputs query information in json format. Reading format is used if without this command.
--region-id [REGION_ID] Specifies region information. Region information in the configuration file is used if without this command.

Use JSON_INDENT in the configuration file to set indent for outputs in json format.

ros supports the following commands:

Command Function
set-userdata Sets the default configuration.
create-stack Creates stacks.
delete-stack Deletes stacks.
update-stack Updates stacks.
preview-stack Previews stacks.
abandon-stack Abandons stacks (under development).
list-stacks Lists eligible stacks.
describe-stack Lists details of the specified stacks.
list-resource Lists resource information of the specified stacks.
describe-resource Lists details of the specified resources.
resource-type Lists all resource types.
resource-type-detail Lists details of the specified resource types.
resource-type-template Lists template information of the specified resource types.
get-template Lists template information of the specified stacks.
validate-template Validates template information.
list-regions Lists all regions.
list-events Lists eligible events.

Stack management

Create a Stack

Create a stack by running the command ros create-stack, which includes the following arguments:

Command Function Note
--region-id Specifies the region where the stack resides. region-id fetches a value in this order of priority: value specified by the current command > value specified by the ros command > value specified by the configuration file.
--stack-name [STACK_NAME] Specifies the name of the stack to create. Required.
--template-url [TEMPLATE_URL] Specifies the template file of the stack to create. Required, and the template file must be in json format.
--parameters [PARAMETERS] Provides parameters required by the template. These parameters must be the same as those in the template, or server denial occurs. List these parameters as concatenated strings, such as key1=value1,key2=value2.
--disable-rollback [DISABLE_ROLLBACK] Specifies rollback policy. Default is true to disable rollback.
--timeout-in-minutes [TIMEOUT_IN_MINUTES] Specifies time-out length. Default is 60 (minutes).

This method returns the name and ID of the stack on success or an error message on failure.

Success example

  1. $ ./bin/ros create-stack --stack-name ros-cli-demo --template-url PATH\\TO\\template.json --parameters DBUser=demo,InstancePassword=Demo123456,DBPassword=Demo123456,DBRootPassword=Demo123456
  2. Succeed
  3. Id : ***
  4. Name : ros-cli-demo

Failure example

  1. $ ./bin/ros create-stack --stack-name ros-cli-demo --template-url PATH\\TO\\template.json --parameters DBUser=demo,InstancePassword=Demo123456,DBPassword=Demo123456,DBRootPassword=Demo123456
  2. Failed
  3. Message : The Stack (ros-cli-demo) already exists.
  4. Code : StackExists

Delete a Stack

Delete a stack by running the command ros delete-stack, which includes the following arguments:

Command Function Note
--region-id Specifies the region where the stack resides. Required.
--stack-name [STACK_NAME] Specifies the name of the stack. Required.
--stack-id [STACK_ID] Specifies the ID of the stack. Required.

This method returns no value on success or an error message on failure.

Success example

  1. $ ros delete-stack --region-id cn-beijing --stack-name test-6-21 --stack-id ***
  2. Succeed

Failure example

  1. $ ros delete-stack --region-id cn-beijing --stack-name test-6-21-1 --stack-id ***
  2. Failed
  3. Message : The Stack (test-6-21-1) could not be found.
  4. Code : StackNotFound

Update a Stack

Update a stack by running the command ros update-stack, which includes the following arguments:

Command Function Note
--region-id Specifies the region where the stack resides. Required.
--stack-name [STACK_NAME] Specifies the name of the stack to update. Required.
--stack-id [STACK_ID] Specifies the ID of the stack to update. Required.
--template-url [TEMPLATE_URL] Specifies the template file of the stack to update. Required, and the template file must be in json format.
--parameters [PARAMETERS] Provides parameters required by the template. These parameters must be the same as those in the template, or server denial occurs. List these parameters as concatenated strings, such as key1=value1,key2=value2.
--disable-rollback [DISABLE_ROLLBACK] Specifies rollback policy. Default is true to disable rollback.
--timeout-in-minutes [TIMEOUT_IN_MINUTES] Specifies time-out length. Default is 60 (minutes).

This method returns the name and ID of the stack on success or an error message on failure.

Success example

  1. $ ros update-stack --stack-name ros-cli-demo --template-url PATH\\TO\\template.json --parameters DBUser=demo,InstancePassword=Demo123456,DBPassword=Demo123456,DBRootPassword=Demo123456 --region-id cn-beijing --stack-id ***
  2. Succeed
  3. Id : ***
  4. Name : ros-cli-demo

Failure example

  1. $ ros update-stack --stack-name ros-cli-demo --template-url PATH\\TO\\template.json --parameters DBUser=demo,InstancePassword=Demo123456,DBPassword=Demo123456,DBRootPassword=Demo123456 --region-id cn-beijing --stack-id ***
  2. Failed
  3. Message : Updating a stack when it is in (UPDATE, IN_PROGRESS) is not supported.
  4. Code : NotSupported

Preview a Stack

Preview a stack by running the command ros preview-stack, which includes the following arguments:

Command Function Note
--region-id Specifies the region where the stack resides. region-id fetches a value in this order of priority: value specified by the current command > value specified by the ros command > value specified by the configuration file.
--stack-name [STACK_NAME] Specifies the name of the stack to preview. Required.
--template-url [TEMPLATE_URL] Specifies the template file of the stack to preview. Required, and the template file must be in json format.
--parameters [PARAMETERS] Provides parameters required by the template. These parameters must be the same as those in the template, or server denial occurs. List these parameters as concatenated strings, such as key1=value1,key2=value2.
--disable-rollback [DISABLE_ROLLBACK] Specifies rollback policy. Default is true to disable rollback.
--timeout-in-minutes [TIMEOUT_IN_MINUTES] Specifies time-out length. Default is 60 (minutes).

This method returns the information of the resource on success or an error message on failure.

Success example

  1. $ ros preview-stack --stack-name ros-cli-demo2 --template-url PATH\\TO\\template.json --parameters DBUser=demo,InstancePassword=Demo123456,DBPassword=Demo123456,DBRootPassword=Demo123456
  2. Id : None
  3. Name : ros-cli-demo2
  4. Description : Deploy LNMP(Linux+Nginx+MySQL+PHP) stack on 1 ECS instance. *** WARNING *** Only support CentOS-7.
  5. Region : cn-beijing
  6. DisableRollback : True
  7. TimeoutMins : 60
  8. Created : 2017-06-27T06:46:34.231047
  9. Updated : None
  10. Webhook : None
  11. TemplateDescription : Deploy LNMP(Linux+Nginx+MySQL+PHP) stack on 1 ECS instance. *** WARNING *** Only support CentOS-7.
  12. Parameters:
  13. SystemDiskCategory : ***
  14. ALIYUN::StackName : ros-cli-demo2
  15. ALIYUN::NoValue : None
  16. ALIYUN::StackId : None
  17. ALIYUN::Region : cn-beijing
  18. DBRootPassword : ******
  19. ImageId : ***
  20. InstancePassword : ******
  21. DBPassword : ******
  22. DBName : MyDatabase
  23. DBUser : ******
  24. ALIYUN::AccountId : ***
  25. InstanceType : ***
  26. NginxUrl : ***
  27. Resources:
  28. -----------------------------------------------------------------------
  29. Resource:
  30. StackName : None
  31. ResourceType : None
  32. ResourceName : None
  33. ResourceStatus : None
  34. ResourceStatusReason: None
  35. ResourceData : None
  36. Description : Deploy LNMP(Linux+Nginx+MySQL+PHP) stack on 1 ECS instance. *** WARNING *** Only support CentOS-7.
  37. ResourceAction : None
  38. PhysicalResourceId : None
  39. CreatedTime : None
  40. UpdatedTime : None
  41. DeletedTime : None
  42. RequiredBy:
  43. WebServer
  44. WebServerWaitCondition
  45. ...

The output is returned in json format.

  1. $ ros --json preview-stack --stack-name ros-cli-demo2 --template-url PATH\\TO\\template.json --parameters DBUser=demo,InstancePassword=Demo123456,DBPassword=Demo123456,DBRootPassword=Demo123456
  2. {
  3. "Created": "2017-06-27T06:48:52.893040",
  4. "Description": "Deploy LNMP(Linux+Nginx+MySQL+PHP) stack on 1 ECS instance. *** WARNING *** Only support CentOS-7.",
  5. "DisableRollback": true,
  6. "Id": "None",
  7. "Name": "ros-cli-demo2",
  8. "Parameters": {
  9. "ALIYUN::AccountId": "***",
  10. "ALIYUN::NoValue": "None",
  11. "ALIYUN::Region": "cn-beijing",
  12. "ALIYUN::StackId": "None",
  13. "ALIYUN::StackName": "ros-cli-demo2",
  14. "DBName": "MyDatabase",
  15. "DBPassword": "******",
  16. "DBRootPassword": "******",
  17. "DBUser": "******",
  18. "ImageId": "***",
  19. "InstancePassword": "******",
  20. "InstanceType": "***",
  21. "NginxUrl": "***",
  22. "SystemDiskCategory": "***"
  23. },
  24. "Region": "cn-beijing",
  25. "Resources": [
  26. {
  27. "Attributes": {
  28. "CurlCli": null
  29. },
  30. "CreatedTime": null,
  31. "DeletedTime": null,
  32. "Description": "",
  33. "Metadata": {},
  34. "PhysicalResourceId": "",
  35. "Properties": {},
  36. "RequiredBy": [
  37. "WebServerWaitCondition",
  38. "WebServer"
  39. ],
  40. ...
  41. }

Failure example

  1. $ ros preview-stack --stack-name ros-cli-demo2 --template-url PATH\\TO\\template.json --parameters DBUser=demo
  2. Something wrong:
  3. HTTP Status: 400 Error:UserParameterMissing The Parameter (DBRootPassword) was not provided. RequestID: None

Abandon a Stack

Abandon a stack by running the ros abandon-stack command, which includes the following arguments:

Command Function Note
--region-id Specifies the region where the stack resides. Required.
--stack-name [STACK_NAME] Specifies the name of the stack. Required.
--stack-id [STACK_ID] Specifies the ID of the stack. Required.

Failure example

  1. $ ros abandon-stack --stack-name ros-cli-demo --stack-id *** --region-id cn-beijing
  2. Failed
  3. Message : The server could not comply with the request since it is either malformed or otherwise incorrect.
  4. Code : HTTPBadRequest

List Stacks

View the list of stacks by running the ros list-stacks command, which includes the following arguments:

Command Function Note
--region-id Specifies the region where the stack resides. -
--stack-name [STACK_NAME] Specifies the name of the stack. -
--stack-id [STACK_ID] Specifies the ID of the stack. -
--status {CREATE_COMPLETE, CREATE_FAILED, CREATE_IN_PROGRESS, DELETE_COMPLETE, DELETE_FAILED, DELETE_IN_PROGRESS, ROLLBACK_COMPLETE, ROLLBACK_FAILED, ROLLBACK_IN_PROGRESS} Specifies the status of the stack. An assigned value must be used.
--page-number [PAGE_NUMBER] Type the number of the page on which the results display. Query results are displayed in a page. The value is 1 at the minimum and by default.
--page-size [PAGE_SIZE] Specifies the number of results to display per page. The value is 10 by default and not greater than 100.

The output for the current page location and the list of results is returned:

Success example

  1. $ ros list-stacks --page-number 2 --page-size 3
  2. Total Records: 8 Page: 2/3
  3. Id : ***
  4. Name : test_ros_condition_v1
  5. Description : None
  6. Region : cn-beijing
  7. Status : ROLLBACK_COMPLETE
  8. StatusReason : Stack ROLLBACK completed successfully
  9. TimeoutMins : 60
  10. DisableRollback : False
  11. Created : 2017-06-15T03:08:22
  12. Updated : None
  13. Id : ***
  14. Name : test_clouder_v1
  15. Description : None
  16. Region : cn-beijing
  17. Status : CREATE_COMPLETE
  18. StatusReason : Stack CREATE completed successfully
  19. TimeoutMins : 60
  20. DisableRollback : False
  21. Created : 2017-06-01T08:19:51
  22. Updated : None
  23. ...

Failure example

  1. $ ros list-stacks --page-number 2 --page-size 3 --region-id cn-beijing2
  2. Something wrong:
  3. SDK.InvalidRegionId Can not find endpoint to access.

Describe a Stack

Obtain the details of a stack by running the ros describe-stack command, which includes the following arguments:

Command Function Note
--stack-name [STACK_NAME] Specifies the name of the stack. Required.
--stack-id [STACK_ID] Specifies the ID of the stack. Required.

This method returns the details of the stack on success or an error message on failure.

Success example

  1. $ ros describe-stack --stack-name ros-cli-demo --stack-id ***
  2. Name : ros-cli-demo
  3. Id : ***
  4. Description : Deploy LNMP(Linux+Nginx+MySQL+PHP) stack on 1 ECS instance. *** WARNING *** Only support CentOS-7.
  5. Region : cn-beijing
  6. Status : UPDATE_COMPLETE
  7. StatusReason : Stack successfully updated
  8. DisableRollback : True
  9. TimeoutMins : 60
  10. Created : 2017-06-27T06:25:32
  11. Updated : 2017-06-27T06:31:37
  12. Webhook : None
  13. Parameters:
  14. SystemDiskCategory : ***
  15. ALIYUN::StackName : ros-cli-demo
  16. InstanceType : ***
  17. ALIYUN::NoValue : None
  18. ALIYUN::StackId : ***
  19. ALIYUN::Region : cn-beijing
  20. DBRootPassword : ******
  21. ImageId : ***
  22. InstancePassword : ******
  23. DBPassword : ******
  24. DBUser : ******
  25. ALIYUN::AccountId : ***
  26. DBName : MyDatabase
  27. NginxUrl : ***
  28. Outputs:
  29. NginxWebsiteURL : *** --- URL for newly created Nginx home page.

Failure example

  1. $ ros describe-stack --stack-name ros-cli-demo --stack-id ***
  2. Something wrong:
  3. HTTP Status: 404 Error:StackNotFound The Stack (ros-cli-demo) could not be found. RequestID: None

List Resources

List the resources of a stack by running the ros list-resources command, which includes the following arguments:

Command Function Note
--stack-name [STACK_NAME] Specifies the name of the stack. Required.
--stack-id [STACK_ID] Specifies the ID of the stack. Required.

This method returns the resource information of the stack on success or an error message on failure.

Success example

  1. $ ros list-resources --stack-name ros-cli-demo --stack-id ***
  2. Id : WebServerConditionHandle
  3. Name : WebServerConditionHandle
  4. Type : ALIYUN::ROS::WaitConditionHandle
  5. Status : CREATE_COMPLETE
  6. StatusReason : state changed
  7. ResourceData : None
  8. PhysicalId :
  9. Created : 2017-06-27T06:25:32
  10. Updated : 2017-06-27T06:25:33
  11. Deleted : None
  12. Id : SecurityGroup
  13. Name : SecurityGroup
  14. Type : ALIYUN::ECS::SecurityGroup
  15. Status : CREATE_COMPLETE
  16. StatusReason : state changed
  17. ResourceData : None
  18. PhysicalId : ***
  19. Created : 2017-06-27T06:25:32
  20. Updated : 2017-06-27T06:25:39
  21. Deleted : None
  22. Id : WebServer
  23. Name : WebServer
  24. Type : ALIYUN::ECS::Instance
  25. Status : UPDATE_COMPLETE
  26. StatusReason : state changed
  27. ResourceData : None
  28. PhysicalId : ***
  29. Created : 2017-06-27T06:25:32
  30. Updated : 2017-06-27T06:31:44
  31. Deleted : None
  32. ...

Failure example

  1. $ ros list-resources --stack-name ros-cli-demo --stack-id ***2
  2. Message : The Stack (ros-cli-demo) could not be found.
  3. Code : StackNotFound

Describe a Resource

Obtain the details of a stack resource by running the ros describe-resource command, which includes the following arguments:

Command Function Note
--stack-name [STACK_NAME] Specifies the name of the stack. Required.
--stack-id [STACK_ID] Specifies the ID of the stack. Required.
--resource-name [RESOUCE_NAME] Specifies the name of the resource. Required.

This method returns the details of the stack resource on success or an error message on failure.

Success example

  1. $ ros describe-resource --stack-name ros-cli-demo --stack-id *** --resource-name Vpc
  2. Id : Vpc
  3. Name : Vpc
  4. Type : ALIYUN::ECS::VPC
  5. Status : CREATE_COMPLETE
  6. StatusReason : state changed
  7. ResourceData : None
  8. PhysicalId : ***
  9. Created : 2017-06-27T06:25:32
  10. Updated : 2017-06-27T06:25:37
  11. Deleted : None

Failure example

  1. $ ros describe-resource --stack-name ros-cli-demo --stack-id *** --resource-name Vpc2
  2. Something wrong:
  3. HTTP Status: 404 Error:ResourceNotFound The Resource (Vpc2) could not be found in Stack ros-cli-demo. RequestID: None

Resource Type

Obtain resource type information by running the ros resource-type command, which includes the following arguments:

Command Function Note
--status {UNKNOWN, SUPPORTED, DEPRECATED, UNSUPPORTED, HIDDEN} Specifies resource status. The default is SUPPORTED.

This method returns resource type information on success or no output on failure.

Success example

  1. $ ros resource-type
  2. ALIYUN::CS::App
  3. ALIYUN::CS::Cluster
  4. ALIYUN::ECS::BandwidthPackage
  5. ALIYUN::ECS::Disk
  6. ALIYUN::ECS::DiskAttachment
  7. ALIYUN::ECS::EIP
  8. ALIYUN::ECS::EIPAssociation
  9. ALIYUN::ECS::ForwardEntry
  10. ALIYUN::ECS::Instance
  11. ALIYUN::ECS::InstanceClone
  12. ALIYUN::ECS::InstanceGroup
  13. ALIYUN::ECS::InstanceGroupClone
  14. ALIYUN::ECS::JoinSecurityGroup
  15. ALIYUN::ECS::NatGateway
  16. ALIYUN::ECS::PrepayInstance
  17. ALIYUN::ECS::PrepayInstanceGroupClone
  18. ALIYUN::ECS::Route
  19. ALIYUN::ECS::SNatEntry
  20. ALIYUN::ECS::SSHKeyPair
  21. ALIYUN::ECS::SSHKeyPairAttachment
  22. ALIYUN::ECS::SecurityGroup
  23. ALIYUN::ECS::SecurityGroupClone
  24. ALIYUN::ECS::SecurityGroupEgress
  25. ALIYUN::ECS::SecurityGroupIngress
  26. ALIYUN::ECS::VPC
  27. ALIYUN::ECS::VSwitch
  28. ALIYUN::ESS::ScalingConfiguration
  29. ALIYUN::ESS::ScalingGroup
  30. ALIYUN::ESS::ScalingGroupEnable
  31. ALIYUN::MEMCACHE::Instance
  32. ALIYUN::MONGODB::Instance
  33. ALIYUN::MONGODB::PrepayInstance
  34. ALIYUN::MarketPlace::Image
  35. ALIYUN::MarketPlace::ImageSubscription
  36. ALIYUN::MarketPlace::Order
  37. ALIYUN::OSS::Bucket
  38. ALIYUN::RAM::AccessKey
  39. ALIYUN::RAM::Group
  40. ALIYUN::RAM::ManagedPolicy
  41. ALIYUN::RAM::Role
  42. ALIYUN::RAM::User
  43. ALIYUN::RAM::UserToGroupAddition
  44. ALIYUN::RDS::DBInstance
  45. ALIYUN::RDS::DBInstanceParameterGroup
  46. ALIYUN::RDS::DBInstanceSecurityIps
  47. ALIYUN::RDS::PrepayDBInstance
  48. ALIYUN::REDIS::Instance
  49. ALIYUN::REDIS::PrepayInstance
  50. ALIYUN::ROS::WaitCondition
  51. ALIYUN::ROS::WaitConditionHandle
  52. ALIYUN::SLB::BackendServerAttachment
  53. ALIYUN::SLB::Listener
  54. ALIYUN::SLB::LoadBalancer
  55. ALIYUN::SLB::LoadBalancerClone
  56. ALIYUN::SLB::VServerGroup
  57. ALIYUN::SLS::ApplyConfigToMachineGroup
  58. ALIYUN::SLS::MachineGroup
  59. ALIYUN::VPC::PeeringRouterInterfaceBinding
  60. ALIYUN::VPC::PeeringRouterInterfaceConnection
  61. ALIYUN::VPC::RouterInterface

Resource Type Detail

Obtain the details of a resource type by running the ros resource-type-detail command, which includes the following arguments:

Command Function Note
--name [NAME] Specifies the name of the resource type. Required.

This method returns the details of the resource type on success or an error message on failure.

Success example

Because the attributes varies for each resource, the resource details are listed recursively in reading mode.

  1. $ ros resource-type-detail --name ALIYUN::ECS::Instance
  2. ===================================================
  3. ResourceType : ALIYUN::ECS::Instance
  4. ===================================================
  5. Attributes :
  6. -----------------------------------------------
  7. InstanceId :
  8. Description : The instance id of created ecs instance
  9. -----------------------------------------------
  10. HostName :
  11. Description : Host name of created instance.
  12. -----------------------------------------------
  13. ZoneId :
  14. Description : Zone id of created instance.
  15. ...

The output in json format:

  1. $ ros --json resource-type-detail --name ALIYUN::ECS::Instance
  2. {
  3. "Attributes": {
  4. "HostName": {
  5. "Description": "Host name of created instance."
  6. },
  7. "InnerIp": {
  8. "Description": "Inner IP address of the specified instance. Only for classical instance."
  9. },
  10. "InstanceId": {
  11. "Description": "The instance id of created ecs instance"
  12. },
  13. "PrivateIp": {
  14. "Description": "Private IP address of created ecs instance. Only for VPC instance."
  15. },
  16. "PublicIp": {
  17. "Description": "Public IP address of created ecs instance."
  18. },
  19. "ZoneId": {
  20. "Description": "Zone id of created instance."
  21. }
  22. },
  23. ...
  24. }

Failure example

  1. $ ros --json resource-type-detail --name ALIYUN::ECS::Instance2
  2. Something wrong:
  3. HTTP Status: 404 Error:ResourceTypeNotFound The Resource Type (ALIYUN::ECS::Instance2) could not be found. RequestID: None

Resource Type Template

Obtain the template of a resource type by running the ros resource-type-template command, which includes the following arguments:

Command Function Note
--name [NAME] Specifies the name of the resource type. Required.

This method returns the details of the resource template on success or an error message on failure.

Success example

  1. $ ros --json resource-type-template --name ALIYUN::ECS::Instance
  2. {
  3. "Outputs": {
  4. "HostName": {
  5. "Description": "Host name of created instance.",
  6. "Value": {
  7. "Fn::GetAtt": [
  8. "Instance",
  9. "HostName"
  10. ]
  11. }
  12. },
  13. ...
  14. }

Failure example

  1. $ ros resource-type-template --name ALIYUN::ECS::Instance2
  2. Something wrong:
  3. HTTP Status: 404 Error:ResourceTypeNotFound The Resource Type (ALIYUN::ECS::Instance2) could not be found. RequestID: None

Get a Template

Obtain the template of a stack by running the ros get-template command, which includes the following arguments:

Command Function Note
--stack-name [STACK_NAME] Specifies the name of the stack. Required.
--stack-id [STACK_ID] Specifies the ID of the stack. Required.

This method returns the template on success or an error message on failure.

Success example

  1. $ ros get-template --stack-name ros-cli-demo --stack-id ***
  2. ===================================================
  3. ROSTemplateFormatVersion : 2015-09-01
  4. ===================================================
  5. Resources :
  6. -----------------------------------------------
  7. WebServerConditionHandle :
  8. Type : ALIYUN::ROS::WaitConditionHandle
  9. -----------------------------------------------
  10. SecurityGroup :
  11. Type : ALIYUN::ECS::SecurityGroup
  12. Properties :
  13. SecurityGroupIngress :
  14. Priority : 1
  15. IpProtocol : all
  16. NicType : intranet
  17. SourceCidrIp : ***
  18. PortRange : -1/-1
  19. VpcId :
  20. Ref : Vpc
  21. SecurityGroupEgress :
  22. Priority : 1
  23. IpProtocol : all
  24. NicType : intranet
  25. PortRange : -1/-1
  26. DestCidrIp : ***
  27. ...

The output in json format:

  1. $ ros --json get-template --stack-name ros-cli-demo --stack-id ***
  2. {
  3. "Description": "Deploy LNMP(Linux+Nginx+MySQL+PHP) stack on 1 ECS instance. *** WARNING *** Only support CentOS-7.",
  4. "Outputs": {
  5. "NginxWebsiteURL": {
  6. "Description": "URL for newly created Nginx home page.",
  7. "Value": {
  8. "Fn::Join": [
  9. "",
  10. [
  11. "http://",
  12. {
  13. "Fn::GetAtt": [
  14. "WebServer",
  15. "PublicIp"
  16. ]
  17. },
  18. ":80/test.php"
  19. ]
  20. ]
  21. }
  22. }
  23. },
  24. ...

Failure example

  1. $ ros get-template --stack-name ros-cli-demo --stack-id ***
  2. Something wrong:
  3. HTTP Status: 404 Error:SDK.UnknownServerError Can not parse error message from server response. RequestID: None

Validate a Template

Validate the template of a stack by running the ros validate-template command, which includes the following arguments:

Command Function Note
--template-url [TEMPLATE_URL] Specifies the URL of the template. Required.

This method returns the template on success or an error message on failure.

Success example

  1. $ ros validate-template --template-url PATH\\TO\\template.json
  2. The template is ok:
  3. ===================================================
  4. Description : Deploy LNMP(Linux+Nginx+MySQL+PHP) stack on 1 ECS instance. *** WARNING *** Only support CentOS-7.
  5. ===================================================
  6. Parameters :
  7. -----------------------------------------------
  8. SystemDiskCategory :
  9. Description : System disk category: average cloud disk(cloud), efficient cloud disk(cloud_efficiency) or SSD cloud disk(cloud_ssd)
  10. Default : cloud_ssd
  11. Label : SystemDiskCategory
  12. NoEcho : false
  13. AllowedValues :
  14. cloud
  15. cloud_efficiency
  16. cloud_ssd
  17. Type : String
  18. ...

Failure example

  1. $ ros validate-template --template-url C:\\Users\\quming.ly\\Desktop\\nodejs.json
  2. Something wrong:
  3. HTTP Status: 400 Error:InvalidTemplateVersion The template version is invalid: "ROSTemplateFormatVersion: 2015-09-02". "ROSTemplateFormatVersion" should be: 2015-09-01 RequestID: None

Others

List Regions

List all regions without using any arguments.

Success example

  1. $ ros list-regions
  2. LocalName RegionId
  3. North China 1 cn-qingdao
  4. North China 2 cn-beijing
  5. North China 3 cn-zhangjiakou
  6. East China 1 cn-hangzhou
  7. East China 2 cn-shanghai
  8. South China 1 cn-shenzhen
  9. Hong Kong cn-hongkong
  10. Northwest Asia Pacific 1 (Tokyo) ap-northeast-1
  11. Southeast Asia Pacific 1 (Singapore) ap-southeast-1
  12. Southeast Asia Pacific 2 (Sydney) ap-southeast-2
  13. East USA 1 (Virginia) us-east-1
  14. West USA 1 (Silicon Valley) us-west-1
  15. East Middle East 1 (Dubai) me-east-1
  16. Central Europe 1 (Frankfurt) eu-central-1

The output in json format:

  1. $ ros --json list-regions
  2. {
  3. "Regions": [
  4. {
  5. "LocalName": "North China 1",
  6. "RegionId": "cn-qingdao"
  7. },
  8. {
  9. "LocalName": "North China 2",
  10. "RegionId": "cn-beijing"
  11. },
  12. {
  13. "LocalName": "North China 3",
  14. "RegionId": "cn-zhangjiakou"
  15. },
  16. {
  17. "LocalName": "East China 1",
  18. "RegionId": "cn-hangzhou"
  19. },
  20. {
  21. "LocalName": "East China 2",
  22. "RegionId": "cn-shanghai"
  23. },
  24. {
  25. "LocalName": "South China 1",
  26. "RegionId": "cn-shenzhen"
  27. },
  28. {
  29. "LocalName": "Hong Kong",
  30. "RegionId": "cn-hongkong"
  31. },
  32. {
  33. "LocalName": "Northwest Asia Pacific 1 (Tokyo)",
  34. "RegionId": "ap-northeast-1"
  35. },
  36. {
  37. "LocalName": "Southeast Asia Pacific 1 (Singapore)",
  38. "RegionId": "ap-southeast-1"
  39. },
  40. {
  41. "LocalName": "Southeast Asia Pacific 2 (Sydney)",
  42. "RegionId": "ap-southeast-2"
  43. },
  44. {
  45. "LocalName": "East USA 1 (Virginia)",
  46. "RegionId": "us-east-1"
  47. },
  48. {
  49. "LocalName": "West USA 1 (Silicon Valley)",
  50. "RegionId": "us-west-1"
  51. },
  52. {
  53. "LocalName": "East Middle East 1 (Dubai)",
  54. "RegionId": "me-east-1"
  55. },
  56. {
  57. "LocalName": "Central Europe 1 (Frankfurt)",
  58. "RegionId": "eu-central-1"
  59. }
  60. ]
  61. }

List Events

View the list of events by running the ros list-events command, which includes the following arguments:

Command Function Note
--stack-name [STACK_NAME] Specifies the name of the stack. -
--stack-id [STACK_ID] Specifies the ID of the stack. -
--resource-status {'COMPLETE', 'FAILED', 'IN_PROGRESS'} Specifies the status of the resource. An assigned value must be used.
--resource-name Specifies the resource to filter. -
--resource-type Specifies the resource type to filter. -
--page-number [PAGE_NUMBER] Type the number of the page on which the results display. Query results are displayed in a page. The value is 1 at the minimum and by default.
--page-size [PAGE_SIZE] Specifies the number of results to display per page. The value is 10 by default and not greater than 100.

The output for the current page location and the list of results is returned:

Success example

  1. $ ros list-events --stack-name ros-cli-demo --stack-id *** --page-number 2 --page-size 3 --resource-status COMPLETE
  2. Total Records: 12 Page: 2/4
  3. Time : 2017-06-27T06:31:21
  4. ResourceName : WebServer
  5. ResourceType : ALIYUN::ECS::Instance
  6. Type : None
  7. Status : UPDATE_COMPLETE
  8. StatusReason : state changed
  9. Time : 2017-06-27T06:28:14
  10. ResourceName : ros-cli-demo
  11. ResourceType : ALIYUN::ROS::Stack
  12. Type : None
  13. Status : CREATE_COMPLETE
  14. StatusReason : Stack CREATE completed successfully
  15. Time : 2017-06-27T06:28:14
  16. ResourceName : WebServerWaitCondition
  17. ResourceType : ALIYUN::ROS::WaitCondition
  18. Type : None
  19. Status : CREATE_COMPLETE
  20. StatusReason : state changed

Set Userdata

Set the default user configuration by running the set-userdata command.

Command Function Note
--key-id [KEY_ID] The default Alibaba Cloud AccessKey ID. -
--key-secret [KEY_SECRET] The default Alibaba Cloud AccessKeySecret. -
--region-id [REGION_ID] The default region-id. -
--json-indent [JSON_INDENT] Indent for JSON outputs. -
Thank you! We've received your feedback.