Amazon Elastic File System
User Guide

PutLifecycleConfiguration

Enables lifecycle management by creating a new LifecycleConfiguration object. A LifecycleConfiguration object defines when files in an Amazon EFS file system are automatically transitioned to the lower-cost EFS Infrequent Access (IA) storage class. A LifecycleConfiguration applies to all files in a file system.

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 disables lifecycle management.

In the request, specify the following:

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

  • A LifecyclePolicies array of LifecyclePolicy objects that define when files are moved to the IA storage class. The array can contain only one LifecyclePolicy item.

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 (AWS KMS) 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" } ] }

URI Request Parameters

The request requires the following URI parameters.

FileSystemId

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

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 tells lifecycle management when to transition files from the Standard storage class to the Infrequent Access storage class.

Type: Array of LifecyclePolicy objects

Required: Yes

Response Syntax

HTTP/1.1 200 Content-type: application/json { "LifecyclePolicies": [ { "TransitionToIA": "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. Currently, EFS supports a maximum of one policy per file system.

Type: Array of LifecyclePolicy objects

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 operation. This object tells EFS lifecycle management to move all files in the file system that haven't been accessed in the last 14 days to the IA storage class. This is the only lifecycle policy that is currently supported. To learn more, see EFS Lifecycle Management.

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": [ { "TransitionToIA": "AFTER_14_DAYS" } ] }

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_14_DAYS" } ] }

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: