-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathACS::ECS::CopyImage.yml
131 lines (131 loc) · 3.22 KB
/
ACS::ECS::CopyImage.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
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
FormatVersion: OOS-2019-06-01
Description:
name-en: ACS::ECS::CopyImage
name-zh-cn: 复制镜像(ECS)
en: Cross Region copy images
zh-cn: 跨区地域复制镜像
Parameters:
imageId:
Label:
en: ImageId
zh-cn: 镜像ID
Type: String
AssociationProperty: 'ALIYUN::ECS::Image::ImageId'
AssociationPropertyMetadata:
RegionId: regionId
regionId:
Label:
en: SourceRegionId
zh-cn: 源地域ID
AssociationProperty: ALIYUN::ECS::RegionId
Type: String
MinLength: 1
MaxLength: 30
targetRegionId:
Label:
en: TargetRegionId
zh-cn: 目标地域ID
Type: String
AssociationProperty: ALIYUN::ECS::RegionId
MinLength: 1
MaxLength: 30
targetImageName:
Label:
en: TargetImageName
zh-cn: 目标镜像名称
Type: String
Default: '{{ imageId }}-{{ACS::ExecutionId}}'
encrypted:
Label:
en: WhetherEncrypted
zh-cn: 是否加密复制后的镜像
Type: Boolean
Default: false
KMSKeyId:
Label:
en: KMSKeyIdOfEncrypted
zh-cn: 加密镜像使用的密钥ID
Type: String
Default: ""
targetImageDescription:
Label:
en: TargetImageDescription
zh-cn: 目标镜像描述
Type: String
Default: ''
tags:
Label:
en: Tags
zh-cn: 镜像标签
Type: Json
AssociationProperty: Tags
AssociationPropertyMetadata:
ShowSystem: false
Default: []
Tasks:
- Name: whetherToCopyImage
Action: 'ACS::Choice'
Description:
en: Whether to copy image by target region id
zh-cn: 是否根据目标地域ID复制镜像
Properties:
DefaultTask: copyImage
Choices:
- When:
'Fn::Equals':
- '{{ regionId }}'
- '{{ targetRegionId }}'
NextTask: 'ACS::END'
- Name: copyImage
Action: 'ACS::ExecuteAPI'
Description:
en: Copies image
zh-cn: 复制镜像
Properties:
Service: ECS
API: CopyImage
Parameters:
RegionId: '{{ regionId }}'
ImageId: '{{ imageId }}'
DestinationRegionId: '{{ targetRegionId }}'
DestinationImageName: '{{ targetImageName }}'
Encrypted: '{{ encrypted }}'
Tags: '{{ tags }}'
DestinationDescription: '{{targetImageDescription}}'
KMSKeyId:
'Fn::If':
- 'Fn::Equals':
- false
- '{{ encrypted }}'
- Null
- '{{ KMSKeyId }}'
Outputs:
imageId:
ValueSelector: ImageId
Type: String
imageIdWithRegion:
Type: List
ValueSelector: .|(.ImageId),"{{ targetRegionId }}"
- Name: untilCopyImageReady
Action: 'ACS::WaitFor'
Description:
en: Waits for copied image available
zh-cn: 等待复制的镜像可用
Properties:
Service: ECS
API: DescribeImages
Parameters:
RegionId: '{{ targetRegionId }}'
ImageId: '{{ copyImage.imageId }}'
DesiredValues:
- Available
PropertySelector: 'Images.Image[].Status'
Retries: 296
MaxRetryInterval: 300
Outputs:
imageId:
Value: '{{ copyImage.imageId }}'
Type: String
imageIdWithRegion:
Type: List
Value: '{{ copyImage.imageIdWithRegion }}'