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 - LifecycleConfigurationconsists of one or more- LifecyclePolicyobjects 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 - TransitionToIAto 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 - TransitionToPrimaryStorageClassto- 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 - LifecycleConfigurationobject already exists for the specified file system, a- PutLifecycleConfigurationcall modifies the existing configuration. A- PutLifecycleConfigurationcall with an empty- LifecyclePoliciesarray in the request body deletes any existing- LifecycleConfigurationand 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 - LifecyclePoliciesarray of- LifecyclePolicyobjects that define when files are moved into IA storage, and when they are moved back to Standard storage.
 - Note - Amazon EFS requires that each - LifecyclePolicyobject have only have a single transition, so the- LifecyclePoliciesarray needs to be structured with separate- LifecyclePolicyobjects. See the example requests in the following section for more information.- This operation requires permissions for the - elasticfilesystem:PutLifecycleConfigurationoperation.- To apply a - LifecycleConfigurationobject 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 - LifecycleConfigurationobject (String).
- LifecyclePolicies (list) – - [REQUIRED] - An array of - LifecyclePolicyobjects that define the file system’s- LifecycleConfigurationobject. A- LifecycleConfigurationobject 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-configurationCLI command or the- PutLifecycleConfigurationAPI action, Amazon EFS requires that each- LifecyclePolicyobject have only a single transition. This means that in a request body,- LifecyclePoliciesmust be structured as an array of- LifecyclePolicyobjects, 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-configurationCLI command or the- PutLifecycleConfigurationAPI action, Amazon EFS requires that each- LifecyclePolicyobject have only a single transition. This means that in a request body,- LifecyclePoliciesmust be structured as an array of- LifecyclePolicyobjects, 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-configurationCLI command or the- PutLifecycleConfigurationAPI action, Amazon EFS requires that each- LifecyclePolicyobject have only a single transition. This means that in a request body,- LifecyclePoliciesmust be structured as an array of- LifecyclePolicyobjects, 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': { '...': '...', }, }