EFS / Client / put_lifecycle_configuration
put_lifecycle_configuration#
- EFS.Client.put_lifecycle_configuration(**kwargs)#
Use this action to manage EFS lifecycle management and EFS Intelligent-Tiering. A
LifecycleConfiguration
consists of one or moreLifecyclePolicy
objects that define the following:EFS Lifecycle management - When Amazon EFS automatically transitions files in a file system into the lower-cost EFS 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 (EFS Standard or EFS One Zone Standard). To enable EFS Intelligent-Tiering, set the value of
TransitionToPrimaryStorageClass
toAFTER_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, aPutLifecycleConfiguration
call modifies the existing configuration. APutLifecycleConfiguration
call with an emptyLifecyclePolicies
array in the request body deletes any existingLifecycleConfiguration
and turns off lifecycle management and EFS 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 EFS Intelligent-Tiering.
A
LifecyclePolicies
array ofLifecyclePolicy
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 theLifecyclePolicies
array needs to be structured with separateLifecyclePolicy
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 Key Management Service permissions as when you created the encrypted file system.See also: AWS API Documentation
Request Syntax
response = client.put_lifecycle_configuration( FileSystemId='string', LifecyclePolicies=[ { 'TransitionToIA': 'AFTER_7_DAYS'|'AFTER_14_DAYS'|'AFTER_30_DAYS'|'AFTER_60_DAYS'|'AFTER_90_DAYS'|'AFTER_1_DAY', 'TransitionToPrimaryStorageClass': 'AFTER_1_ACCESS' }, ] )
- Parameters:
FileSystemId (string) –
[REQUIRED]
The ID of the file system for which you are creating the
LifecycleConfiguration
object (String).LifecyclePolicies (list) –
[REQUIRED]
An array of
LifecyclePolicy
objects that define the file system’sLifecycleConfiguration
object. ALifecycleConfiguration
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 thePutLifecycleConfiguration
API action, Amazon EFS requires that eachLifecyclePolicy
object have only a single transition. This means that in a request body,LifecyclePolicies
must be structured as an array ofLifecyclePolicy
objects, one object for each transition,TransitionToIA
,TransitionToPrimaryStorageClass
. See the example requests in the following section for more information.(dict) –
Describes a policy used by EFS lifecycle management and EFS Intelligent-Tiering that specifies when to transition files into and out of the file system’s Infrequent Access (IA) storage class. For more information, see EFS Intelligent‐Tiering and EFS Lifecycle Management.
Note
When using the
put-lifecycle-configuration
CLI command or thePutLifecycleConfiguration
API action, Amazon EFS requires that eachLifecyclePolicy
object have only a single transition. This means that in a request body,LifecyclePolicies
must be structured as an array ofLifecyclePolicy
objects, one object for each transition,TransitionToIA
,TransitionToPrimaryStorageClass
. For more information, see the request examples in PutLifecycleConfiguration.TransitionToIA (string) –
Describes the period of time that a file is not accessed, after which it transitions to IA storage. Metadata operations such as listing the contents of a directory don’t count as file access events.
TransitionToPrimaryStorageClass (string) –
Describes when to transition a file from IA storage to primary storage. Metadata operations such as listing the contents of a directory don’t count as file access events.
- Return type:
dict
- Returns:
Response Syntax
{ 'LifecyclePolicies': [ { 'TransitionToIA': 'AFTER_7_DAYS'|'AFTER_14_DAYS'|'AFTER_30_DAYS'|'AFTER_60_DAYS'|'AFTER_90_DAYS'|'AFTER_1_DAY', 'TransitionToPrimaryStorageClass': 'AFTER_1_ACCESS' }, ] }
Response Structure
(dict) –
LifecyclePolicies (list) –
An array of lifecycle management policies. EFS supports a maximum of one policy per file system.
(dict) –
Describes a policy used by EFS lifecycle management and EFS Intelligent-Tiering that specifies when to transition files into and out of the file system’s Infrequent Access (IA) storage class. For more information, see EFS Intelligent‐Tiering and EFS Lifecycle Management.
Note
When using the
put-lifecycle-configuration
CLI command or thePutLifecycleConfiguration
API action, Amazon EFS requires that eachLifecyclePolicy
object have only a single transition. This means that in a request body,LifecyclePolicies
must be structured as an array ofLifecyclePolicy
objects, one object for each transition,TransitionToIA
,TransitionToPrimaryStorageClass
. For more information, see the request examples in PutLifecycleConfiguration.TransitionToIA (string) –
Describes the period of time that a file is not accessed, after which it transitions to IA storage. Metadata operations such as listing the contents of a directory don’t count as file access events.
TransitionToPrimaryStorageClass (string) –
Describes when to transition a file from IA storage to primary storage. Metadata operations such as listing the contents of a directory don’t count as file access events.
Exceptions
EFS.Client.exceptions.BadRequest
EFS.Client.exceptions.InternalServerError
EFS.Client.exceptions.FileSystemNotFound
EFS.Client.exceptions.IncorrectFileSystemLifeCycleState
Examples
This operation enables lifecycle management on a file system 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.
response = client.put_lifecycle_configuration( FileSystemId='fs-01234567', LifecyclePolicies=[ { 'TransitionToIA': 'AFTER_30_DAYS', }, ], ) print(response)
Expected Output:
{ 'LifecyclePolicies': [ { 'TransitionToIA': 'AFTER_30_DAYS', }, ], 'ResponseMetadata': { '...': '...', }, }