forked from aliyun/ros-templates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcdn-speeds-up-distribution-of-file-on-oss.yml
124 lines (124 loc) · 4.23 KB
/
cdn-speeds-up-distribution-of-file-on-oss.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
ROSTemplateFormatVersion: '2015-09-01'
Description:
zh-cn: 使用CDN加速OSS上存储的文件资源分发。
en: Use a CDN to speed up the distribution of file resources stored on OSS.
Parameters:
Scope:
Type: String
Label:
zh-cn: 加速区域
en: Acceleration area
Description:
zh-cn: 选择加速区域。加速区域为仅中国内地和全球时,服务域名必须备案。
en: Select the acceleration area. When the acceleration region is only in mainland
China and the world, the service domain name must be filed.
Default: domestic
AllowedValues:
- domestic
- overseas
- global
DomainName:
Type: String
Label:
zh-cn: 加速域名
en: Accelerated domain name
Description:
zh-cn: 加速域名是指接入CDN,用于加速源站的域名。请填写您账号下的域名。
en: Accelerated domain name refers to the domain name of the access CDN used to accelerate the source site. Please fill in the domain name under your account.
BucketName:
Type: String
Label:
en: Bucket Name
zh-cn: 存储空间名称
Description:
en: The name must be 3 to 63 bytes in length, The name must start and end with a lowercase letter or digit.The name can contain only lowercase letters, digits, and hyphens (-).;<br><b>note:<font color='blue'>A bucket name must be globally unique within OSS. Bucket names cannot be changed after the bucket is created.</b></font>
zh-cn: 长度为3~63个字符,必须以小写字母或数字开头和结尾,可以包含小写字母、数字和连字符(-);<br><b>注:<font color='blue'>需要全网唯一性,已经存在的不能在创建。</b></font>
AssociationProperty: AutoCompleteInput
AssociationPropertyMetadata:
Length: 6
Prefix: image-example-
CharacterClasses:
- Class: lowercase
min: 1
Resources:
OssBucket:
Type: ALIYUN::OSS::Bucket
DependsOn: AutoEnableOSS
Properties:
BucketName:
Ref: BucketName
DeletionForce: true
AutoEnableCDN:
Type: ALIYUN::ROS::AutoEnableService
Properties:
ServiceName: CDN
AutoEnableOSS:
Type: ALIYUN::ROS::AutoEnableService
Properties:
ServiceName: OSS
Domain:
Type: ALIYUN::CDN::Domain
Properties:
Sources:
Fn::Sub:
- '[{"content":"${content}", "type":"oss", "priority":"20", "port":80, "weight":"10"}]'
- content:
Fn::GetAtt:
- OssBucket
- DomainName
CdnType: web
Scope:
Ref: Scope
DomainName:
Ref: DomainName
DependsOn: AutoEnableCDN
DomainRecord:
Type: ALIYUN::DNS::DomainRecord
Properties:
Type: CNAME
RR:
Fn::Select:
- 0
- Fn::Split:
- .
- Ref: DomainName
Value:
Fn::GetAtt:
- Domain
- Cname
DomainName:
Fn::Join:
- .
- Fn::Select:
- '1:'
- Fn::Split:
- .
- Ref: DomainName
DependsOn: Domain
DomainConfig:
Type: ALIYUN::CDN::DomainConfig
Properties:
Functions: '[{"functionArgs":[{"argName":"file_type","argValue":"jpg,png,jpeg"},{"argName":"weight","argValue":"99"},{"argName":"ttl","argValue":"7776000"}],"functionName":"filetype_based_ttl_set"},{"functionArgs":[{"argName":"private_oss_auth","argValue":"on"},{"argName":"perm_private_oss_tbl","argValue":""}],"functionName":"l2_oss_key"},{"functionArgs":[{"argName":"filetype","argValue":"jpeg"},{"argName":"webp","argValue":"off"},{"argName":"orient","argValue":"off"},{"argName":"slim","argValue":90},{"argName":"enable","argValue":"on"}],"functionName":"image_transform"}]'
DomainNames:
Ref: Domain
DependsOn: DomainRecord
Outputs:
Cname:
Description: CNAME
Value:
Fn::GetAtt:
- Domain
- Cname
DomainName:
Description: DomainName
Value:
Ref: Domain
Metadata:
ALIYUN::ROS::Interface:
ParameterGroups:
- Parameters:
- Scope
- DomainName
- BucketName
TemplateTags:
- acs:technical-solution:cdn-and-video-cloud:文件下载加速及成本优化-tech_solu_38