All Products
Search
Document Center

File Storage NAS:CreateLifecyclePolicy

Last Updated:Jul 02, 2026

Creates a lifecycle management policy.

Operation description

  • Only General-purpose NAS file systems and CPFS for Lingjun support creating lifecycle management policies.

  • Each CPFS for Lingjun file system supports a maximum of 10 Auto-type and 100 OnDemand-type lifecycle management policies.

  • A maximum of 20 lifecycle management policies can be created for General-purpose NAS in each region.

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

nas:CreateLifecyclePolicy

create

*LifecyclePolicy

acs:nas:{#regionId}:{#accountId}:filesystem/{#filesystemId}

None None

Request parameters

Parameter

Type

Required

Description

Example

FileSystemId

string

Yes

The file system ID.

31a8e4****

LifecyclePolicyName

string

No

The Policy Name of the lifecycle management policy. The name must be 3 to 64 characters in length, start with an uppercase letter or lowercase letter, and can contain letters, digits, underscores (_), or hyphens (-).

Note

This parameter is required for General-purpose NAS but not required for CPFS for Lingjun.

lifecyclepolicy_01

Path

string

No

The absolute path of the directory associated with the lifecycle management policy. Only General-purpose NAS is supported.

  • General-purpose NAS supports associating only a single directory. The path must start with a forward slash (/) and must be an existing path in the mount target.

Note

Only General-purpose NAS is supported. For General-purpose NAS, use Paths.N to associate multiple directories at the same time.

  • Only one of Path and Paths can be specified.

/pathway/to/folder

LifecycleRuleName

string

No

The management rule associated with the lifecycle management policy. Only General-purpose NAS is supported.

Valid values:

  • DEFAULT_ATIME_14: files that have not been accessed for 14 days.

  • DEFAULT_ATIME_30: files that have not been accessed for 30 days.

  • DEFAULT_ATIME_60: files that have not been accessed for 60 days.

  • DEFAULT_ATIME_90: files that have not been accessed for 90 days.

  • DEFAULT_ATIME_180: files that have not been accessed for 180 days. DEFAULT_ATIME_180 is supported only when StorageType is set to Archive.

Note
  • If an IA storage class policy has already been configured for the directory, the archive policy duration must be longer than the IA storage class policy duration.

  • Only General-purpose NAS supports this parameter.

Valid values:

  • DEFAULT_ATIME_14 :

    files that have not been accessed for 14 days.

  • DEFAULT_ATIME_90 :

    files that have not been accessed for 90 days.

  • DEFAULT_ATIME_60 :

    files that have not been accessed for 60 days.

  • DEFAULT_ATIME_180 :

    files that have not been accessed for 180 days.

  • DEFAULT_ATIME_30 :

    files that have not been accessed for 30 days.

DEFAULT_ATIME_14

StorageType

string

Yes

The storage type.

  • InfrequentAccess: IA storage class.

  • Archive: Archive storage.

Note

General-purpose NAS supports InfrequentAccess and Archive. CPFS for Lingjun supports only InfrequentAccess.

Valid values:

  • Archive :

    Archive storage.

  • InfrequentAccess :

    IA storage class.

InfrequentAccess

Paths

array

No

The absolute paths of directories associated with the lifecycle management policy.

"/path1", "/path2"

string

No

The absolute path of a directory associated with the lifecycle management policy.

Multiple directories can be associated. The path must start with a forward slash (/) and must be an existing path in the mount target. Valid values of N: 1 to 10.

Note
  • This parameter is required for CPFS for Lingjun.

“/path1"

Description

string

No

The description of the lifecycle policy.

Format: The description must be 3 to 64 characters in length, start with a letter, and can contain letters, digits, underscores (_), or hyphens (-).

Note

Only CPFS for Lingjun is supported.

描述

LifecyclePolicyType

string

No

The policy type.

  • Auto (default): automatic execution.

  • OnDemand: on-demand execution.

Valid values:

  • Auto :

    automatic execution.

  • OnDemand :

    on-demand execution.

Auto

TransitRules

array<object>

No

The file data transit rules. A maximum of one rule can be configured.

Note

Supported only when LifecyclePolicyType is set to Auto for CPFS for Lingjun file systems.

object

No

The file data transit rule. A maximum of one rule can be configured.

Note

Supported only when LifecyclePolicyType is set to Auto for CPFS for Lingjun file systems.

Attribute

string

No

The rule attribute.

Valid values:

  • Atime: the access time of the file.

Valid values:

  • Atime :

    the access time of the file.

Atime

Threshold

string

No

The rule threshold.

Valid values:

  • When Attribute is set to Atime, the value indicates the number of days since the file was last accessed. Valid values: 0 to 365.

3

RetrieveRules

array<object>

No

The file data retrieval rules. A maximum of one rule can be configured.

Note

Only CPFS for Lingjun file systems are supported.

Note

When LifecyclePolicyType is set to OnDemand, at least one of TransitRules or RetrieveRules must be specified.

object

No

The file data retrieval rule. A maximum of one rule can be configured.

Attribute

string

No

The rule attribute. Valid values:

  • RetrieveType: the retrieval method.

Valid values:

  • RetrieveType :

    the retrieval method.

RetrieveType

Threshold

string

No

The rule threshold. Valid values:

  • RetrieveType
    • AfterVisit: supported when LifecyclePolicyType is set to Auto. Indicates best-effort recall on visit.

    • All: supported when LifecyclePolicyType is set to OnDemand. Indicates retrieving all data.

Valid values:

  • All :

    retrieve all data.

  • AfterVisit :

    best-effort recall on visit.

All

Response elements

Element

Type

Description

Example

object

RequestId

string

The request ID.

BC7C825C-5F65-4B56-BEF6-98C56C7C****

Success

boolean

The request status.

Valid values:

  • true: The request was successful.

  • false: The request failed.

true

LifecyclePolicyId

string

The ID of the lifecycle policy.

lsp-bp1234567890ab****

Examples

Success response

JSON format

{
  "RequestId": "BC7C825C-5F65-4B56-BEF6-98C56C7C****",
  "Success": true,
  "LifecyclePolicyId": "lsp-bp1234567890ab****"
}

Error codes

HTTP status code

Error code

Error message

Description

400 OperationDenied.FileSystemNotSupportedForLifecycle The file system does not support lifecycle. The file system does not support lifecycle.
400 OperationDenied.EncryptedFileSystemNotSupportedForLifecycle The encrypted file system does not support lifecycle. The encrypted file system does not support lifecycle.
400 OperationDenied.LifecyclePolicyCountLimitExceeded The maximum number of LifecyclePolicies is exceeded. The maximum number of LifecyclePolicies is exceeded.
400 InvalidLifecyclePolicy.AlreadyExist The specified LifecyclePolicy already exists. The specified LifecyclePolicy already exists.
400 InvalidParameter.PathsNumberExceed The maximum number of Path.N for this operation is 10. The maximum number of Path.N for this operation is 10.
400 InvalidFilesystemType.NotSupport The API operation does not support the file system type. The API operation does not support the file system type.
400 InvalidParameter.PathOrPaths Either Path or Paths.N must be specified. Either Path or Paths.N must be specified.
400 MissingFileSystemId FileSystemId is mandatory for this action.
400 Lifecycle.Count.Exceeded The lifecycle policy count exceeds the max limit per type per filesystem. Lifecycle policy exceeds limit.
403 OperationDenied.NotSupportPaths.N Your request does not meet the gray condition. The Paths.N parameter is not supported. Your request does not meet the gray condition. The Paths.N parameter is not supported.
404 InvalidFileSystem.NotFound The specified file system does not exist. The specified file system does not exist.
404 InvalidParameter.PathNotExist The specified path does not exist. The specified path does not exist.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.