PutLifecycleConfiguration
Use this action to manage storage for your file system. A
LifecycleConfiguration consists of one or more LifecyclePolicy
objects that define the following:
-
TransitionToIA– When to move files in the file system from primary storage (Standard storage class) into the Infrequent Access (IA) storage. -
TransitionToArchive– When to move files in the file system from their current storage class (either IA or Standard storage) into the Archive storage.File systems cannot transition into Archive storage before transitioning into IA storage. Therefore, TransitionToArchive must either not be set or must be later than TransitionToIA.
Note
The Archive storage class is available only for file systems that use the Elastic throughput mode and the General Purpose performance mode.
-
TransitionToPrimaryStorageClass– Whether to move files in the file system back to primary storage (Standard storage class) after they are accessed in IA or Archive storage.
For more information, see Managing file system storage.
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. In the request, specify the following:
-
The ID for the file system for which you are enabling, disabling, or modifying lifecycle management.
-
A
LifecyclePoliciesarray ofLifecyclePolicyobjects that define when to move files to IA storage, to Archive storage, and back to primary storage.Note
Amazon EFS requires that each
LifecyclePolicyobject have only have a single transition, so theLifecyclePoliciesarray needs to be structured with separateLifecyclePolicyobjects. 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": [
{
"TransitionToArchive": "string",
"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
LifecycleConfigurationobject (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
LifecyclePolicyobjects that define the file system'sLifecycleConfigurationobject. ALifecycleConfigurationobject informs lifecycle management of the following:-
TransitionToIA– When to move files in the file system from primary storage (Standard storage class) into the Infrequent Access (IA) storage. -
TransitionToArchive– When to move files in the file system from their current storage class (either IA or Standard storage) into the Archive storage.File systems cannot transition into Archive storage before transitioning into IA storage. Therefore, TransitionToArchive must either not be set or must be later than TransitionToIA.
Note
The Archive storage class is available only for file systems that use the Elastic throughput mode and the General Purpose performance mode.
-
TransitionToPrimaryStorageClass– Whether to move files in the file system back to primary storage (Standard storage class) after they are accessed in IA or Archive storage.
Note
When using the
put-lifecycle-configurationCLI command or thePutLifecycleConfigurationAPI action, Amazon EFS requires that eachLifecyclePolicyobject have only a single transition. This means that in a request body,LifecyclePoliciesmust be structured as an array ofLifecyclePolicyobjects, one object for each storage transition. See the example requests in the following section for more information.Type: Array of LifecyclePolicy objects
Array Members: Maximum number of 3 items.
Required: Yes
-
Response Syntax
HTTP/1.1 200
Content-type: application/json
{
"LifecyclePolicies": [
{
"TransitionToArchive": "string",
"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 3 items.
Errors
- BadRequest
-
Returned if the request is malformed or contains an error such as an invalid parameter value or a missing required parameter.
- ErrorCode
-
The error code is a string that uniquely identifies an error condition. It is meant to be read and understood by programs that detect and handle errors by type.
- Message
-
The error message contains a generic description of the error condition in English. It is intended for a human audience. Simple programs display the message directly to the end user if they encounter an error condition they don't know how or don't care to handle. Sophisticated programs with more exhaustive error handling and proper internationalization are more likely to ignore the error message.
HTTP Status Code: 400
- FileSystemNotFound
-
Returned if the specified
FileSystemIdvalue doesn't exist in the requester's AWS account.- ErrorCode
-
The error code is a string that uniquely identifies an error condition. It is meant to be read and understood by programs that detect and handle errors by type.
- Message
-
The error message contains a generic description of the error condition in English. It is intended for a human audience. Simple programs display the message directly to the end user if they encounter an error condition they don't know how or don't care to handle. Sophisticated programs with more exhaustive error handling and proper internationalization are more likely to ignore the error message.
HTTP Status Code: 404
- IncorrectFileSystemLifeCycleState
-
Returned if the file system's lifecycle state is not "available".
- ErrorCode
-
The error code is a string that uniquely identifies an error condition. It is meant to be read and understood by programs that detect and handle errors by type.
- Message
-
The error message contains a generic description of the error condition in English. It is intended for a human audience. Simple programs display the message directly to the end user if they encounter an error condition they don't know how or don't care to handle. Sophisticated programs with more exhaustive error handling and proper internationalization are more likely to ignore the error message.
HTTP Status Code: 409
- InternalServerError
-
Returned if an error occurred on the server side.
- ErrorCode
-
The error code is a string that uniquely identifies an error condition. It is meant to be read and understood by programs that detect and handle errors by type.
- Message
-
The error message contains a generic description of the error condition in English. It is intended for a human audience. Simple programs display the message directly to the end user if they encounter an error condition they don't know how or don't care to handle. Sophisticated programs with more exhaustive error handling and proper internationalization are more likely to ignore the error message.
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 to do the following:
-
Move all files in the file system that haven't been accessed in Standard storage within the last 30 days to IA storage.
-
Move all files in the file system that haven't been accessed in Standard storage within the last 90 days to Archive storage.
-
Move files back to Standard storage after they are accessed in IA or Archive storage. The Archive storage class is available only for file systems that use the Elastic throughput mode and the General Purpose performance mode.
For more information, see EFS storage classes and Managing file system storage.
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": [
{
"TransitionToArchive": "AFTER_90_DAYS"
},
{
"TransitionToIA": "AFTER_30_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": [
{
"TransitionToArchive": "AFTER_90_DAYS"
},
{
"TransitionToIA": "AFTER_30_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 "[{"TransitionToArchive":"AFTER_90_DAYS"},
{"TransitionToIA":"AFTER_30_DAYS"},
{"TransitionToPrimaryStorageClass":"AFTER_1_ACCESS"}]
--region us-west-2 \
--profile adminuser
Sample Response
{
"LifecyclePolicies": [
{
"TransitionToArchive": "AFTER_90_DAYS"
},
{
"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: