-
Notifications
You must be signed in to change notification settings - Fork 17
/
ACS::ESS::RunCommandOnSpecifiedInstance.yml
71 lines (71 loc) · 1.97 KB
/
ACS::ESS::RunCommandOnSpecifiedInstance.yml
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
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
export COMMAND_IP="{{getInstanceIpAddress.ipAddress}}"
export ZONE_ID="{{getInstanceIpAddress.zoneId}}"
{{ commandContent }}
instanceId: '{{ commandInstanceId }}'
commandType: RunShellScript
Outputs:
invocationOutput:
Type: String
ValueSelector: .invocationOutput
Outputs:
invocationOutput:
Type: String
Value: '{{ runCommand.invocationOutput }}'