Integrate CloudFlow with OSS
CloudFlow integrates with Object Storage Service (OSS) to read, write, copy, and delete objects and manage buckets during workflow execution. Define a Task state with an OSS action and the required parameters -- CloudFlow handles the API call.
All OSS integrations use the RequestComplete service integration mode. The region parameter defaults to the region where the flow runs.
Object operations
Read an object
Use OSS:GetObject to read an object from a bucket. This action supports conditional reads with ETag matching and partial reads with byte ranges.
Type: StateMachine
Name: MyWorkflow
SpecVersion: v1
StartAt: GetObject
States:
- Type: Task
Name: GetObject
Action: OSS:GetObject
TaskMode: RequestComplete
Parameters:
region: cn-hangzhou
bucket: thebucketname
key: fileKey
versionId: CAEQMxiBgMCZov2D0BYiIDY4MDllOTc2YmY5MjQxMzdiOGI3OTlhNTU0ODIx**
range: 1024-
ifMatch: fba9dede5f27731c9771645a3986
ifNoneMatch: 5B3C1A2E0563E1B002CC607C
End: trueParameters
| Parameter | Required | Description | Example |
|---|---|---|---|
| bucket | Yes | Bucket name. | thebucketname |
| key | Yes | Object key. | mps/test.txt |
| region | No | Region where the bucket resides. Defaults to the current flow's region. | cn-hangzhou |
| versionId | No | Version ID of the object. | CAEQMxiBgMCZov2D0BYiIDY4MDllOTc2YmY5MjQxMzdiOGI3OTlhNTU0ODIx**** |
| range | No | Byte range to read. If the range is valid, the response includes a Content-Range header (for example, Content-Range: bytes 0~9/44). If invalid, the entire object is returned without a Content-Range header. Omitted by default. | 1024-2048, 1024-, or -2048 |
| ifMatch | No | Return the object only if its ETag matches this value (200 OK). Otherwise, return 412 Precondition Failed. Omitted by default. | fba9dede5f27731c9771645a3986**** |
| ifNoneMatch | No | Return the object only if its ETag does not match this value (200 OK). Otherwise, return 304 Not Modified. Omitted by default. | fba9dede5f27731c9771645a3986**** |
Output
{
"bucket": "thebucketname",
"key": "map/test.txt",
"data": "the file content"
}Upload an object
Use OSS:PutObject to write content to an OSS object. Strings and primitive values are written directly. Structures, arrays, and maps are serialized to JSON before writing.
Type: StateMachine
Name: MyWorkflow
SpecVersion: v1
StartAt: PutObject
States:
- Type: Task
Name: PutObject
Action: OSS:PutObject
TaskMode: RequestComplete
Parameters:
region: cn-hangzhou
bucket: thebucketname
key: fileKey
overwrite: true
data: hello world!!!
End: trueParameters
| Parameter | Required | Description | Example |
|---|---|---|---|
| bucket | Yes | Bucket name. | thebucketname |
| key | Yes | Object key. | mps/test.txt |
| region | No | Region where the bucket resides. Defaults to the current flow's region. | cn-hangzhou |
| data | No | Content to write. Strings and primitive types are written directly. Structures, arrays, and maps are serialized to JSON first. | hello world!! |
| overwrite | No | Whether to overwrite an existing object with the same key. Valid values: true, false. Default: false. | false |
Output
{
"bucket": "thebucketname",
"key": "map/test.txt"
}Delete an object
Use OSS:DeleteObject to delete an object from a bucket. Specify versionId to target a specific version.
Type: StateMachine
Name: MyWorkflow
SpecVersion: v1
StartAt: DeleteObject
States:
- Type: Task
Name: DeleteObject
Action: OSS:DeleteObject
TaskMode: RequestComplete
Parameters:
region: cn-hangzhou
bucket: thebucketname
key: fileKey
versionId: CAEQMxiBgMCZov2D0BYiIDY4MDllOTc2YmY5MjQxMzdiOGI3OTlhNTU0ODIx**
End: trueParameters
| Parameter | Required | Description | Example |
|---|---|---|---|
| bucket | Yes | Bucket name. | thebucketname |
| key | Yes | Object key. | mps/test.txt |
| region | No | Region where the bucket resides. Defaults to the current flow's region. | cn-hangzhou |
| versionId | No | Version ID of the object to delete. | CAEQMxiBgMCZov2D0BYiIDY4MDllOTc2YmY5MjQxMzdiOGI3OTlhNTU0ODIx**** |
Output
{
"bucket": "thebucketname",
"key": "map/test.txt"
}Check whether an object exists
Use OSS:IsObjectExist to check whether an object exists in a bucket. The response includes a boolean exist field.
Type: StateMachine
Name: MyWorkflow
SpecVersion: v1
StartAt: IsObjectExist
States:
- Type: Task
Name: IsObjectExist
Action: OSS:IsObjectExist
TaskMode: RequestComplete
Parameters:
region: cn-hangzhou
bucket: thebucketname
key: fileKey
versionId: CAEQMxiBgMCZov2D0BYiIDY4MDllOTc2YmY5MjQxMzdiOGI3OTlhNTU0ODIx**
End: trueParameters
| Parameter | Required | Description | Example |
|---|---|---|---|
| bucket | Yes | Bucket name. | thebucketname |
| key | Yes | Object key. | mps/test.txt |
| region | No | Region where the bucket resides. Defaults to the current flow's region. | cn-hangzhou |
| versionId | No | Version ID of the object. | CAEQMxiBgMCZov2D0BYiIDY4MDllOTc2YmY5MjQxMzdiOGI3OTlhNTU0ODIx**** |
Output
{
"bucket": "thebucketname",
"key": "map/test.txt",
"exist": true
}Append data to an object
Use OSS:AppendObject to append content to an appendable object. This is useful for log files and other scenarios that require incremental writes.
Type: StateMachine
Name: MyWorkflow
SpecVersion: v1
StartAt: AppendObject
States:
- Type: Task
Name: AppendObject
Action: OSS:AppendObject
TaskMode: RequestComplete
Parameters:
region: cn-hangzhou
bucket: thebucketname
key: fileKey
overwrite: true
data: hello world!!!
End: trueParameters
| Parameter | Required | Description | Example |
|---|---|---|---|
| bucket | Yes | Bucket name. | thebucketname |
| key | Yes | Object key. | mps/test.txt |
| region | No | Region where the bucket resides. Defaults to the current flow's region. | cn-hangzhou |
| data | No | Content to append. Strings and primitive types are written directly. Structures, arrays, and maps are serialized to JSON first. | hello world!! |
Output
{
"bucket": "thebucketname",
"key": "map/test.txt"
}Get object metadata
Use OSS:GetObjectMeta to retrieve an object's metadata without downloading the object itself. The response includes content length, ETag, and timestamps.
Type: StateMachine
Name: MyWorkflow
SpecVersion: v1
StartAt: GetObjectMeta
States:
- Type: Task
Name: GetObjectMeta
Action: OSS:GetObjectMeta
TaskMode: RequestComplete
Parameters:
region: cn-hangzhou
bucket: thebucketname
key: fileKey
versionId: CAEQMxiBgMCZov2D0BYiIDY4MDllOTc2YmY5MjQxMzdiOGI3OTlhNTU0ODIx**
End: trueParameters
| Parameter | Required | Description | Example |
|---|---|---|---|
| bucket | Yes | Bucket name. | thebucketname |
| key | Yes | Object key. | mps/test.txt |
| region | No | Region where the bucket resides. Defaults to the current flow's region. | cn-hangzhou |
| versionId | No | Version ID of the object. | CAEQMxiBgMCZov2D0BYiIDY4MDllOTc2YmY5MjQxMzdiOGI3OTlhNTU0ODIx**** |
Output
{
"bucket": "thebucketname",
"key": "map/test.txt",
"meta": {
"Content-Length": 1024,
"ETag": "5B3C1A2E053D763E1B002CC607C5****",
"x-oss-last-access-time": "Tue, 30 Mar 2021 06:07:48 GMT",
"Last-Modified": "Fri, 24 Feb 2012 06:07:48 GMT",
"x-oss-version-id": "CAEQNRiBgIDMh4mD0BYiIDUzNDA4OGNmZjBjYTQ0YmI4Y2I4ZmVlYzJlNGVk****"
}
}Copy an object
Use OSS:CopyObject to copy an object within the same bucket or across buckets. Specify key (source) and destKey (destination) for same-bucket copies. Add destBucket for cross-bucket copies.
Copy within the same bucket
Type: StateMachine
Name: MyWorkflow
SpecVersion: v1
StartAt: CopyObject
States:
- Type: Task
Name: CopyObject
Action: OSS:CopyObject
TaskMode: RequestComplete
Parameters:
key: src_object_key
destKey: dest_object_key
bucket: src-object-bucket
End: trueCopy across buckets
Type: StateMachine
Name: MyWorkflow
SpecVersion: v1
StartAt: CopyObject
States:
- Type: Task
Name: CopyObject
Action: OSS:CopyObject
TaskMode: RequestComplete
Parameters:
key: src_object_key
destKey: dest_object_key
bucket: src-object-bucket
destBucket: dest-object-bucket
End: trueParameters
| Parameter | Required | Description | Example |
|---|---|---|---|
| key | Yes | Source object key. | src_object_key |
| destKey | Yes | Destination object key. | dest_object_key |
| bucket | Yes | Bucket that contains the source object. | src-object-bucket |
| destBucket | No | Destination bucket. If omitted, the object is copied within the same bucket. | dest-object-bucket |
Output (same-bucket copy)
{
"LastModified": "2024-12-03T05:26:33Z",
"ETag": "\"5BDE2EE1BB30D362F4F0CF9995BE3273\"",
"bucket": "src-object-bucket",
"key": "src_object_key",
"XMLName": {
"Space": "",
"Local": "CopyObjectResult"
}
}Output (cross-bucket copy)
{
"XMLName": {
"Space": "",
"Local": "CopyObjectResult"
},
"LastModified": "2024-12-03T05:34:03Z",
"ETag": "\"5BDE2EE1BB30D362F4F0CF9995BE3273\"",
"bucket": "src-object-bucket",
"key": "src_object_key"
}Bucket operations
List objects in a bucket
Use OSS:ListObjects to list objects in a bucket. Filter by prefix, paginate with continuationToken, and group by directory with delimiter.
Type: StateMachine
Name: MyWorkflow
SpecVersion: v1
StartAt: ListObjects
States:
- Type: Task
Name: ListObjects
Action: OSS:ListObjects
TaskMode: RequestComplete
Parameters:
region: cn-hangzhou
bucket: thebucketname
key: fileKey
delimiter: /
maxKeys: 10
prefix: test
startAfter: e
continuationToken: test1.txt
End: trueParameters
| Parameter | Required | Description | Example |
|---|---|---|---|
| bucket | Yes | Bucket name. | thebucketname |
| region | No | Region where the bucket resides. Defaults to the current flow's region. | cn-hangzhou |
| delimiter | No | Character used to group object names. Objects with names containing the same string between the prefix and the next delimiter occurrence are grouped under CommonPrefixes. Omitted by default. | / |
| maxKeys | No | Maximum number of objects to return. Valid values: 0 to 1000. Default: 100. | 10 |
| prefix | No | Filter objects by name prefix. Must be less than 1,024 bytes. When combined with delimiter set to /, only objects in the specified directory are returned -- subdirectories appear as entries in CommonPrefixes. For example, given objects fun/test.jpg, fun/movie/001.avi, and fun/movie/007.avi: setting prefix to fun/ returns all three; setting prefix to fun/ with delimiter / returns fun/test.jpg and fun/movie/. | test |
| startAfter | No | Start listing after this object name (alphabetical order). Up to 1,024 bytes. | e |
| continuationToken | No | Token for paginated results. Get this value from NextContinuationToken in the previous response. | test1.txt |
Output
{
"bucket": "thebucketname",
"ContinuationToken": "filea",
"NextContinuationToken": "filez",
"Objects": [
{
"Key": "file1",
"Size": 1024,
"ETag": "CAEQNRiBgIDMh4mD0BYiIDUzNDA4OGNmZjBjYTQ0YmI4Y2I4ZmVlYzJlNGVk****",
"LastModified": "Fri, 24 Feb 2024 06:07:48 GMT",
"StorageClass": "Standard"
}
]
}Get bucket information
Use OSS:GetBucketInfo to retrieve a bucket's configuration, including Access Control List (ACL), storage class, redundancy type, versioning status, and encryption settings.
Type: StateMachine
Name: MyWorkflow
SpecVersion: v1
StartAt: GetBucketInfo
States:
- Type: Task
Name: GetBucketInfo
Action: OSS:GetBucketInfo
TaskMode: RequestComplete
Parameters:
region: cn-hangzhou
bucket: thebucketname
End: trueParameters
| Parameter | Required | Description | Example |
|---|---|---|---|
| bucket | Yes | Bucket name. | thebucketname |
| region | No | Region where the bucket resides. Defaults to the current flow's region. | cn-hangzhou |
Output
{
"BucketInfo": {
"XMLName": {
"Space": "",
"Local": "Bucket"
},
"Name": "testbucketname",
"AccessMonitor": "Disabled",
"Location": "oss-cn-hangzhou",
"CreationDate": "2023-02-07T11:15:10Z",
"ExtranetEndpoint": "oss-cn-hangzhou.aliyuncs.com",
"IntranetEndpoint": "oss-cn-hangzhou-internal.aliyuncs.com",
"ACL": "private",
"RedundancyType": "LRS",
"Owner": {
"XMLName": {
"Space": "",
"Local": "Owner"
},
"ID": "11111",
"DisplayName": "11111111"
},
"StorageClass": "Standard",
"SseRule": {
"XMLName": {
"Space": "",
"Local": "ServerSideEncryptionRule"
},
"KMSMasterKeyID": "",
"SSEAlgorithm": "",
"KMSDataEncryption": ""
},
"Versioning": "Enabled",
"TransferAcceleration": "Disabled",
"CrossRegionReplication": "Disabled"
},
"XMLName": {
"Space": "",
"Local": "BucketInfo"
}
}Get bucket storage statistics
Use OSS:GetBucketStat to retrieve a bucket's storage capacity and object count, broken down by storage class.
Type: StateMachine
Name: MyWorkflow
SpecVersion: v1
StartAt: GetBucketStat
States:
- Type: Task
Name: GetBucketStat
Action: OSS:GetBucketStat
TaskMode: RequestComplete
Parameters:
region: cn-hangzhou
bucket: thebucketname
End: trueParameters
| Parameter | Required | Description | Example |
|---|---|---|---|
| bucket | Yes | Bucket name. | thebucketname |
| region | No | Region where the bucket resides. Defaults to the current flow's region. | cn-hangzhou |
Output
{
"ArchiveObjectCount": 0,
"ArchiveRealStorage": 0,
"ArchiveStorage": 0,
"ColdArchiveObjectCount": 0,
"ColdArchiveRealStorage": 0,
"ColdArchiveStorage": 0,
"InfrequentAccessObjectCount": 0,
"InfrequentAccessRealStorage": 0,
"InfrequentAccessStorage": 0,
"LastModifiedTime": 1698152609,
"LiveChannelCount": 0,
"MultipartUploadCount": 4,
"ObjectCount": 189,
"StandardObjectCount": 189,
"StandardStorage": 123123,
"Storage": 123123,
"XMLName": {
"Space": "",
"Local": "BucketStat"
}
}Create a bucket
Use OSS:CreateBucket to create an OSS bucket. Set the ACL, storage class, and data redundancy type at creation time.
Type: StateMachine
Name: MyWorkflow
SpecVersion: v1
StartAt: CreateBucket
States:
- Type: Task
Name: CreateBucket
Action: OSS:CreateBucket
TaskMode: RequestComplete
Parameters:
region: cn-hangzhou
bucket: thebucketname
acl: private
storageClass: Standard
dataRedundancyType: LRS
End: trueParameters
| Parameter | Required | Description | Example |
|---|---|---|---|
| bucket | Yes | Bucket name. | thebucketname |
| region | No | Region where the bucket resides. Defaults to the current flow's region. | cn-hangzhou |
| acl | No | Bucket ACL. Valid values: public-read-write, public-read, private. Default: private. | private |
| storageClass | No | Storage class. Valid values: Standard, IA, Archive, ColdArchive. Default: Standard. | Standard |
| dataRedundancyType | No | Data redundancy type. Valid values: LRS (locally redundant storage -- stores copies across devices in the same zone), ZRS (zone-redundant storage -- distributes data across three zones in the same region). Default: LRS. Note
| LRS |
Output
{}Delete a bucket
Use OSS:DeleteBucket to delete an OSS bucket.
Type: StateMachine
Name: MyWorkflow
SpecVersion: v1
StartAt: DeleteBucket
States:
- Type: Task
Name: DeleteBucket
Action: OSS:DeleteBucket
TaskMode: RequestComplete
Parameters:
region: cn-hangzhou
bucket: thebucketname
End: trueParameters
| Parameter | Required | Description | Example |
|---|---|---|---|
| bucket | Yes | Bucket name. | thebucketname |
| region | No | Region where the bucket resides. Defaults to the current flow's region. | cn-hangzhou |
Output
{}List buckets
Use OSS:ListBuckets to list all buckets owned by the current account. Filter by name prefix and paginate with marker.
Type: StateMachine
Name: MyWorkflow
SpecVersion: v1
StartAt: ListBuckets
States:
- Type: Task
Name: ListBuckets
Action: OSS:ListBuckets
TaskMode: RequestComplete
Parameters:
region: cn-hangzhou
bucket: thebucketname
End: trueParameters
| Parameter | Required | Description | Example |
|---|---|---|---|
| region | No | Region where the buckets reside. Defaults to the current flow's region. | cn-hangzhou |
| prefix | No | Filter buckets by name prefix. Omitted by default. | prefix |
| marker | No | Start listing after this bucket name (alphabetical order). Omitted by default. | mybucket10 |
| maxKeys | No | Maximum number of buckets to return. Valid values: 1 to 1000. Default: 100. | 10 |
Output
{
"Buckets": [
{
"XMLName": {
"Space": "",
"Local": "Bucket"
},
"Name": "bucket1",
"Location": "oss-cn-shanghai",
"CreationDate": "2023-07-27T10:49:37Z",
"StorageClass": "Standard"
},
{
"XMLName": {
"Space": "",
"Local": "Bucket"
},
"Name": "bucket2",
"Location": "oss-cn-shanghai",
"CreationDate": "2023-09-19T07:26:46Z",
"StorageClass": "Standard"
}
],
"IsTruncated": true,
"Marker": "",
"MaxKeys": 100,
"NextMarker": "cri-9rbedixxxxum7zxs-registry",
"Owner": {
"XMLName": {
"Space": "",
"Local": "Owner"
},
"ID": "11111111",
"DisplayName": "1111111111"
},
"Prefix": "",
"XMLName": {
"Space": "",
"Local": "ListAllMyBucketsResult"
}
}