PutLifecycleConfiguration - Amazon Elastic File System

PutLifecycleConfiguration

Use this action to manage EFS lifecycle management and intelligent tiering. A LifecycleConfiguration consists of one or more LifecyclePolicy objects that define the following:

  • EFS Lifecycle management - When Amazon EFS automatically transitions files in a file system into the lower-cost Infrequent Access (IA) storage class.

    To enable EFS Lifecycle management, set the value of TransitionToIA to one of the available options.

  • EFS Intelligent tiering - When Amazon EFS automatically transitions files from IA back into the file system's primary storage class (Standard or One Zone Standard.

    To enable EFS Intelligent Tiering, set the value of TransitionToPrimaryStorageClass to AFTER_1_ACCESS.

For more information, see EFS Lifecycle Management.

Each Amazon EFS file system supports one lifecycle configuration, which applies to all files in the file system. If a LifecycleConfiguration object already exists for the specified file system, a PutLifecycleConfiguration call modifies the existing configuration. A PutLifecycleConfiguration call with an empty LifecyclePolicies array in the request body deletes any existing LifecycleConfiguration and turns off lifecycle management and intelligent tiering for the file system.

In the request, specify the following:

  • The ID for the file system for which you are enabling, disabling, or modifying lifecycle management and intelligent tiering.

  • A LifecyclePolicies array of LifecyclePolicy objects that define when files are moved into IA storage, and when they are moved back to Standard storage.

    Note

    Amazon EFS requires that each LifecyclePolicy object have only have a single transition, so the LifecyclePolicies array needs to be structured with separate LifecyclePolicy objects. See the example requests in the following section for more information.

This operation requires permissions for the elasticfilesystem:PutLifecycleConfiguration operation.

To apply a LifecycleConfiguration object to an encrypted file system, you need the same AWS Key Management Service permissions as when you created the encrypted file system.

Request Syntax

PUT /2015-02-01/file-systems/FileSystemId/lifecycle-configuration HTTP/1.1 Content-type: application/json { "LifecyclePolicies": [ { "TransitionToIA": "string", "TransitionToPrimaryStorageClass": "string" } ] }

URI Request Parameters

The request uses the following URI parameters.

FileSystemId

The ID of the file system for which you are creating the LifecycleConfiguration object (String).

Length Constraints: Maximum length of 128.

Pattern: ^(arn:aws[-a-z]*:elasticfilesystem:[0-9a-z-:]+:file-system/fs-[0-9a-f]{8,40}|fs-[0-9a-f]{8,40})$

Required: Yes

Request Body

The request accepts the following data in JSON format.

LifecyclePolicies

An array of LifecyclePolicy objects that define the file system's LifecycleConfiguration object. A LifecycleConfiguration object informs EFS lifecycle management and EFS Intelligent-Tiering of the following:

  • When to move files in the file system from primary storage to the IA storage class.

  • When to move files that are in IA storage to primary storage.

Note

When using the put-lifecycle-configuration CLI command or the PutLifecycleConfiguration API action, Amazon EFS requires that each LifecyclePolicy object have only a single transition. This means that in a request body, LifecyclePolicies must be structured as an array of LifecyclePolicy objects, one object for each transition, TransitionToIA, TransitionToPrimaryStorageClass. See the example requests in the following section for more information.

Type: Array of LifecyclePolicy objects

Array Members: Maximum number of 2 items.

Required: Yes

Response Syntax

HTTP/1.1 200 Content-type: application/json { "LifecyclePolicies": [ { "TransitionToIA": "string", "TransitionToPrimaryStorageClass": "string" } ] }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

LifecyclePolicies

An array of lifecycle management policies. EFS supports a maximum of one policy per file system.

Type: Array of LifecyclePolicy objects

Array Members: Maximum number of 2 items.

Errors

BadRequest

Returned if the request is malformed or contains an error such as an invalid parameter value or a missing required parameter.

HTTP Status Code: 400

FileSystemNotFound

Returned if the specified FileSystemId value doesn't exist in the requester's AWS account.

HTTP Status Code: 404

IncorrectFileSystemLifeCycleState

Returned if the file system's lifecycle state is not "available".

HTTP Status Code: 409

InternalServerError

Returned if an error occurred on the server side.

HTTP Status Code: 500

Examples

Create a lifecycle configuration

The following example creates a LifecyclePolicy object using the PutLifecycleConfiguration action. This example creates a lifecycle policy that instructs EFS lifecycle management to do the following:

  • Move all files in the file system that haven't been accessed in the last 30 days to the IA storage class.

  • Move files that are in IA storage to primary storage (Standard or One Zone Standard) after they are first accessed.

For more information, see EFS storage classes and EFS lifecycle management and intelligent tiering.

Sample Request

PUT /2015-02-01/file-systems/fs-0123456789abcdefb/lifecycle-configuration HTTP/1.1 Host: elasticfilesystem.us-west-2.amazonaws.com x-amz-date: 20181122T232908Z Authorization: <...> Content-type: application/json Content-Length: 86 { "LifecyclePolicies": [ { "TransitionToIA": "AFTER_60_DAYS" }, { "TransitionToPrimaryStorage": "AFTER_1_ACCESS" } ] }

Sample Response

HTTP/1.1 200 OK x-amzn-RequestId: 01234567-89ab-cdef-0123-456789abcdef Content-type: application/json Content-Length: 86 { "LifecyclePolicies": [ { "TransitionToIA": "AFTER_60_DAYS" }, { "TransitionToPrimaryStorage": "AFTER_1_ACCESS" } ] }

Example put-lifecycle-configuration CLI request

This example illustrates one usage of PutLifecycleConfiguration.

Sample Request

aws efs put-lifecycle-configuration \ --file-system-id fs-0123456789abcdefb \ --lifecycle-policies "[{"TransitionToIA":"AFTER_30_DAYS"}, {"TransitionToPrimaryStorageClass":"AFTER_1_ACCESS"}]" --region us-west-2 \ --profile adminuser

Sample Response

{ "LifecyclePolicies": [ { "TransitionToIA": "AFTER_30_DAYS" }, { "TransitionToPrimaryStorageClass": "AFTER_1_ACCESS" } ] }

Disable lifecycle management

The following example disables lifecycle management for the specified file system.

Sample Request

PUT /2015-02-01/file-systems/fs-01234567/lifecycle-configuration HTTP/1.1 Host: elasticfilesystem.us-west-2.amazonaws.com x-amz-date: 20181122T232908Z Authorization: <...> Content-type: application/json Content-Length: 86 { "LifecyclePolicies": [ ] }

Sample Response

HTTP/1.1 200 OK x-amzn-RequestId: 01234567-89ab-cdef-0123-456789abcdef Content-type: application/json Content-Length: 86 { "LifecyclePolicies": [ ] }

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: