-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathACS::ESS::RunCommandOnSpecifiedInstance.json
More file actions
97 lines (97 loc) · 2.56 KB
/
ACS::ESS::RunCommandOnSpecifiedInstance.json
File metadata and controls
97 lines (97 loc) · 2.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
{
"FormatVersion": "OOS-2019-06-01",
"Description": {
"en": "Run command on the specified scaling activity instance",
"zh-cn": "指定实例中执行命令",
"name-en": "ACS::ESS::RunCommandOnSpecifiedInstance",
"name-zh-cn": "在指定实例中执行命令"
},
"Parameters": {
"commandContent": {
"Description": {
"en": "Command content to run in ECS instance",
"zh-cn": "在ECS实例中执行的云助手命令"
},
"Type": "String",
"AssociationProperty": "Code",
"Default": "echo hello"
},
"regionId": {
"Description": {
"en": "The ID of region",
"zh-cn": "地域ID"
},
"Type": "String"
},
"instanceId": {
"Description": {
"en": "The ID ECS instance",
"zh-cn": "ECS实例ID"
},
"Type": "String"
},
"commandInstanceId": {
"Description": {
"en": "The ECS instance to run command",
"zh-cn": "执行命令的ECS实例"
},
"Type": "String"
}
},
"Tasks": [
{
"Name": "getInstanceIpAddress",
"Action": "ACS::ExecuteAPI",
"Description": {
"en": "Gets ECS instance ip address",
"zh-cn": "获取ECS实例IP"
},
"Properties": {
"Service": "ECS",
"API": "DescribeInstances",
"Parameters": {
"RegionId": "{{ regionId }}",
"InstanceIds": [
"{{ instanceId }}"
]
}
},
"Outputs": {
"ipAddress": {
"Type": "String",
"ValueSelector": ".Instances.Instance[]|.VpcAttributes.PrivateIpAddress.IpAddress[]"
},
"zoneId": {
"Type": "String",
"ValueSelector": ".Instances.Instance[]|.ZoneId"
}
}
},
{
"Name": "runCommand",
"Action": "ACS::ECS::RunCommandForLongTime",
"Description": {
"en": "Execute cloud assistant command",
"zh-cn": "执行云助手命令"
},
"Properties": {
"regionId": "{{ regionId }}",
"commandContent": "#!/bin/bash\nexport COMMAND_IP=\"{{getInstanceIpAddress.ipAddress}}\"\nexport ZONE_ID=\"{{getInstanceIpAddress.zoneId}}\"\n{{ commandContent }}",
"instanceId": "{{ commandInstanceId }}",
"commandType": "RunShellScript"
},
"Outputs": {
"invocationOutput": {
"Type": "String",
"ValueSelector": ".invocationOutput"
}
}
}
],
"Outputs": {
"invocationOutput": {
"Type": "String",
"Value": "{{ runCommand.invocationOutput }}"
}
}
}