You can create a S3 bucket liefcycle configuration using API operations provided by AWS. In POSTMAN, you can call these set of API operations for managing lifecycle configuration on a bucket.
PUT Bucket lifecycle:
>>This operation creates a new lifecycle configuration for the bucket or replaces an existing lifecycle configuration. Open POSTMAN and add a PUT request to a new collection. In the below screen, liefcycle will be created for bucket “testbuckettodeletefiles”
>>Click on Authorization and select “AWS Signature” from TYPE drop-down and provide values for “AccessKey“, “SecretKey“, “AWS Region“, “Service Name“. Note:[you should have a valid IAM user created which have access to S3 bucket]
>>Follow the steps provided in this link to create global variable, Pre-request Script and Header parameter.
>>Copy/paste the below XML configuration in Body of the request. The following lifecycle configuration specifies one rule: The
Expiration action requests Amazon S3 to expire the objects with the “logs/” prefix 2 days after creation and permanently delete them after 1 day of expiration.
>>Click Send to create the lifecycle configuration.
GET Bucket lifecycle:
>>Create a GET request to access the liefcycle configuration “deletefiles” created on bucket “testbuckettodeletefiles”. GET Returns the
lifecycle configuration information set on the bucket. You must have permission to perform the
>>Use PUT request to change any configuration of the lifecycle. Keep the Rule ID same as “deletefiles” while sending the request. The request will update the existing configuration based on inputs provided.
DELETE Bucket lifecycle:
>>Create a DELETE request to delete the lifecycle configuration of the bucket “testbuckettodeletefiles”. Amazon S3 removes all the lifecycle configuration rules in the lifecycle subresource associated with the bucket. Your objects never expire, and Amazon S3 no longer automatically deletes any objects on the basis of rules contained in the deleted lifecycle configuration. To use this operation, you must have permission to perform the
s3:PutLifecycleConfiguration action. By default, the bucket owner has this permission and the bucket owner can grant this permission to others.
Check out this link for more information.