All Products
Search
Document Center

Security Center:CreateOssBucketScanTask

Last Updated:Sep 12, 2026

Creates a bucket scan task.

Operation description

Before calling this operation to create an OSS bucket malicious file scan task, complete the following prerequisites in order:

  1. The OSS malicious file detection feature is activated for the Security Center instance.

  2. The service-linked role AliyunServiceRoleForSas is created.

  3. The OSS bucket to be scanned is created.

  4. The RefreshOssBucketScanInfo operation is called to synchronize the OSS bucket information to Security Center.

After completing the preceding steps, you can call this operation to create a scan task.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

yundun-sas:CreateOssBucketScanTask

create

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

BucketNameList

array

Yes

The list of bucket names. The specified buckets must already exist in OSS and must have been synchronized to Security Center by calling the RefreshOssBucketScanInfo operation. You can call the ListOssBucket operation to obtain the list of managed buckets.

string

No

The bucket name.

hz-yqq-standard****

ExcludeKeySuffixList

array

No

The list of file suffixes to exclude from scanning.

string

No

The file suffix to exclude from scanning.

.jsp

ScanMode

integer

Yes

The scan mode. Valid values:

  • 1: Full file scan.

  • 2: Incremental file scan.

1

KeySuffixList

array

No

The list of file suffixes.

string

No

Specifies that the key of the file to be scanned must end with the specified suffix.

.jsp

KeyPrefixList

array

No

The prefix list of files.

string

No

Specifies that the key of the file to be scanned must start with the specified KeyPrefix. The value cannot start with a forward slash (/).

/root

AllKeyPrefix

boolean

No

Specifies whether to match all prefixes. If this parameter is set to true, the KeyPrefixList parameter does not take effect.

true

DecompressMaxLayer

integer

No

The maximum number of decompression layers when multiple levels of nested compressed files exist. The minimum value is 1 and the maximum value is 5. When the maximum number of decompression layers is exceeded, the decompression operation stops immediately. The scanning of files that have already been decompressed is not affected.

1

DecompressMaxFileCount

integer

No

The maximum number of files to decompress. The minimum value is 1 and the maximum value is 1000. When the maximum number of decompressed files is exceeded, the decompression operation stops immediately. The scanning of files that have already been decompressed is not affected.

100

DecryptionList

array

No

The list of decryption types.

string

No

The decryption type. Valid values:

  • OSS: OSS fully managed.

  • KMS: KMS.

KMS

LastModifiedStartTime

integer

No

Specifies that only files whose last modification time is after the specified timestamp are scanned. Unit: milliseconds.

1724301769834

Source

string

No

The business source. Valid values:

  • OSS: OSS.

  • NAS: NAS.

OSS

Response elements

Element

Type

Description

Example

object

RequestId

string

The request ID, which is a unique identifier generated by Alibaba Cloud for this request. You can use it to troubleshoot issues.

BBD75EC2-2F4F-5A7B-AA53-18724DC8****

Examples

Success response

JSON format

{
  "RequestId": "BBD75EC2-2F4F-5A7B-AA53-18724DC8****"
}

Error codes

HTTP status code

Error code

Error message

Description

400 ApiAuthExhausted No auth count or auth count has been exhausted. You have not purchased a quota, or the purchased quota is used up.
400 TaskIsProcessing Task Is Processing. Task is processing.
500 ServerError ServerError
403 NoPermission caller has no permission You are not authorized to do this operation.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.