EFS.Client.
put_lifecycle_configuration
(**kwargs)¶Use this action to manage EFS lifecycle management and EFS Intelligent-Tiering. A LifecycleConfiguration
consists of one or more LifecyclePolicy
objects that define the following:
TransitionToIA
to one of the available options.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 EFS Intelligent-Tiering for the file system.
In the request, specify the following:
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 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'
},
]
)
[REQUIRED]
The ID of the file system for which you are creating the LifecycleConfiguration
object (String).
[REQUIRED]
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:
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.
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 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
. For more information, see the request examples in PutLifecycleConfiguration.
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.
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.
dict
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 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
. 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': {
'...': '...',
},
}