ALIYUN::OSS::Bucket is used to create a bucket in Object Storage Service (OSS).
Syntax
{
"Type": "ALIYUN::OSS::Bucket",
"Properties": {
"AccessControl": String,
"RefererConfiguration": Map,
"ServerSideEncryptionConfiguration": Map,
"CORSConfiguration": Map,
"Tags": Map,
"LoggingConfiguration": Map,
"LifecycleConfiguration": Map,
"StorageClass": String,
"DeletionForce": Boolean,
"WebsiteConfiguration": Map,
"Policy": Map,
"BucketName": String,
"RedundancyType": String,
"VersioningConfiguration": Map,
"ResourceGroupId": String,
"EnableOssHdfsService": Boolean
}
}
Properties
Property | Type | Required | Editable | Description | Constraint |
BucketName | String | Yes | No | The bucket name. | The name must be 3 to 63 characters in length, and can contain lowercase letters, digits, and hyphens (-). It must start and end with a lowercase letter or a digit. Note The name must be globally unique. You can set AssociationProperty to AutoCompleteInput to automatically generate a random string as the name. For more information, see How to control the length of a random string? |
AccessControl | String | No | Yes | The permission type. | Valid values:
|
CORSConfiguration | Map | No | No | The cross-origin resource sharing (CORS) configurations. | For more information, see CORSConfiguration property. |
DeletionForce | Boolean | No | Yes | Specifies whether to forcefully delete objects from OSS. | Valid values:
|
EnableOssHdfsService | Boolean | No | Yes | Specifies whether to enable OSS-HDFS. | Valid values:
|
LifecycleConfiguration | Map | No | Yes | The lifecycle configurations of the objects. | For more information, see LifecycleConfiguration property. |
LoggingConfiguration | Map | No | No | The log storage configurations. | For more information, see LoggingConfiguration properties. |
Policy | Map | No | Yes | The policy for the bucket. | For more information, see Examples. |
RedundancyType | String | No | No | The data redundancy type of the bucket. | Valid values:
|
RefererConfiguration | Map | No | Yes | The hotlink protection configurations. | For more information, see RefererConfiguration properties. |
ResourceGroupId | String | No | No | The ID of the resource group. | None. |
ServerSideEncryptionConfiguration | Map | No | Yes | The configurations of the server-side encryption rules. | For more information, see ServerSideEncryptionConfiguration properties. |
StorageClass | String | No | No | The storage class of the bucket. | Valid values:
|
Tags | Map | No | Yes | The tags of the bucket. A tag is a key-value pair. | You can specify up to 20 tags. A tag key must be 1 to 64 characters in length, and cannot start with A tag value can be up to 128 characters in length, and must be encoded in UTF-8. |
VersioningConfiguration | Map | No | Yes | The container that stores the versioning status of the bucket. | For more information, see VersioningConfiguration property. |
WebsiteConfiguration | Map | No | No | The configurations of the hosted static website. | For more information, see WebsiteConfiguration properties. |
CORSConfiguration syntax
"CORSConfiguration": {
"CORSRule": List
}
CORSConfiguration property
Property | Type | Required | Editable | Description | Constraint |
CORSRule | List | No | No | The CORS rules. | For more information, see CORSRule properties. |
CORSRule syntax
"CORSRule": [
{
"MaxAgeSeconds": Number,
"AllowedMethod": List,
"ExposeHeader": List,
"AllowedOrigin": List,
"AllowedHeader": List
}
]
CORSRule properties
Property | Type | Required | Editable | Description | Constraint |
AllowedHeader | List | No | No | The headers allowed in cross-origin requests. | Valid values:
|
AllowedMethod | List | No | No | The methods allowed in cross-domain requests. | Valid values:
|
AllowedOrigin | List | No | No | The origins allowed in cross-origin requests. | None. |
ExposeHeader | List | No | No | The response headers that you can access from your applications. | You cannot use asterisks (*). |
MaxAgeSeconds | Number | No | No | The period of time within which the browser can cache the response to an OPTIONS request for the specified resource. | None. |
LifecycleConfiguration syntax
"LifecycleConfiguration": {
"Rule": List
}
LifecycleConfiguration property
Property | Type | Required | Editable | Description | Constraint |
Rule | List | Yes | No | The lifecycle rules. | For more information, see Rule properties. |
Rule syntax
"Rule": [
{
"Status": String,
"AbortMultipartUpload": Map,
"Expiration": Map,
"Prefix": String,
"ID": String
}
]
Rule properties
Property | Type | Required | Editable | Description | Constraint |
Prefix | String | Yes | No | The name prefix of the objects to which the rule applies. | The rule takes effect only for objects whose names have a matching prefix. |
AbortMultipartUpload | Map | No | No | The expiration attributes of the multipart upload tasks that are not complete. | For more information, see AbortMultipartUpload properties. |
Expiration | Map | No | No | The expiration attributes of the rule for the objects. | For more information, see Expiration properties. |
ID | String | No | No | The unique ID of the rule. | The ID can be up to 255 characters in length. If you leave this property empty, OSS automatically generates a unique ID for the rule. |
Status | String | No | Yes | Specifies whether to enable the rule. | Valid values:
|
Expiration syntax
"Expiration":{
"Days": Number,
"CreatedBeforeDate": String,
"Date": String
}
Expiration properties
Property | Type | Required | Editable | Description | Constraint |
CreatedBeforeDate | String | No | No | The date. OSS implements the rule for data that was last modified on a date earlier than the specified date. | Specify the date in the ISO 8601 standard. The time must be at 00:00:00 UTC. Example: |
Days | Number | No | No | The number of days that elapse for the rule to take effect since the objects were last modified. | When the number of days that elapse since the objects were last modified exceeds the value of this property, the rule is implemented to delete the objects. If you set Days to 30, the objects that were last modified on January 1, 2016 are deleted by the backend application on January 31, 2016. |
AbortMultipartUpload syntax
"AbortMultipartUpload": {
"CreatedBeforeDate": String,
"Days": Number
}
AbortMultipartUpload properties
Property | Type | Required | Editable | Description | Constraint |
CreatedBeforeDate | String | No | No | The date before when the rule takes effect. | Specify the date in the ISO 8601 standard. The time must be at 00:00:00 UTC. Example: |
Days | Number | No | No | The number of days that elapse for the rule to take effect since the objects were last modified. | When the number of days that elapse since the objects were last modified exceeds the value of this property, the rule is implemented to delete the objects. If you set Days to 30, the objects that were last modified on January 1, 2016 are deleted by the backend application on January 31, 2016. |
LoggingConfiguration syntax
"LoggingConfiguration": {
"TargetBucket": String,
"TargetPrefix": String
}
LoggingConfiguration properties
Property | Type | Required | Editable | Description | Constraint |
TargetBucket | String | No | No | The bucket that is used to store access logs. | None. |
TargetPrefix | String | No | No | The name prefix of the saved access log object. | None. |
WebsiteConfiguration syntax
"WebsiteConfiguration":{
"IndexDocument": String,
"ErrorDocument": String
}
WebsiteConfiguration properties
Property | Type | Required | Editable | Description | Constraint |
ErrorDocument | String | No | No | The error page of the hosted static website. | None. |
IndexDocument | String | No | No | The homepage of the hosted static website. | None. |
RefererConfiguration syntax
"RefererConfiguration":{
"AllowEmptyReferer": String,
"RefererList": List
}
RefererConfiguration properties
Property | Type | Required | Editable | Description | Constraint |
AllowEmptyReferer | Boolean | No | No | Specifies whether to allow access requests that include an empty Referer field. | Valid values:
|
RefererList | List | No | No | The Referer whitelist. | None. |
ServerSideEncryptionConfiguration syntax
"ServerSideEncryptionConfiguration":{
"KMSMasterKeyID": String,
"SSEAlgorithm": String
}
ServerSideEncryptionConfiguration properties
Property | Type | Required | Editable | Description | Constraint |
SSEAlgorithm | String | Yes | No | The default server-side encryption method. | Valid values:
|
KMSMasterKeyID | String | No | No | The key ID. | You must specify this property only when SSEAlgorithm is set to KMS and a key is used for encryption. |
VersioningConfiguration syntax
"VersioningConfiguration":{
"Status": String
}
VersioningConfiguration property
Property | Type | Required | Editable | Description | Constraint |
Status | String | Yes | No | The versioning status. | Valid values:
|
Return values
Fn::GetAtt
Name: the bucket name, which is globally unique.
DomainName: the public domain name of the bucket.
InternalDomainName: the internal domain name of the bucket.
Examples
YAML
format
ROSTemplateFormatVersion: '2015-09-01'
Description: Creates a simple oss bucket
Parameters:
BucketName:
AssociationProperty: AutoCompleteInput
AssociationPropertyMetadata:
Length: 5
Prefix: simple-oss-bucket
CharacterClasses:
- Class: lowercase
min: 1
Type: String
Label:
en: Bucket Name
Outputs:
BucketDomainName:
Value:
Fn::GetAtt:
- MyBucket
- DomainName
Resources:
MyBucket:
Type: ALIYUN::OSS::Bucket
Properties:
AccessControl: private
BucketName:
Ref: BucketName
Metadata: {}
JSON
format
{
"ROSTemplateFormatVersion": "2015-09-01",
"Description": "Creates a simple oss bucket",
"Parameters": {
"BucketName": {
"Type": "String",
"Label": {
"en": "Bucket Name"
},
"AssociationProperty": "AutoCompleteInput",
"AssociationPropertyMetadata": {
"Length": 5 ,
"Prefix": "simple-oss-bucket",
"CharacterClasses": [
{
"Class": "lowercase",
"min": 1
}
]
}
}
},
"Metadata": {
},
"Resources": {
"MyBucket": {
"Type": "ALIYUN::OSS::Bucket",
"Properties": {
"AccessControl": "private",
"BucketName": {
"Ref": "BucketName"
}
}
}
},
"Outputs": {
"BucketDomainName": {
"Value": {
"Fn::GetAtt": [
"MyBucket",
"DomainName"
]
}
}
}
}