CmdID / aws / aws mediastore
aws mediastore put-lifecycle-policy
Writes an object lifecycle policy to a container. AWS CLI reference
1 example 2 options Its page in the AWS CLI reference
Examples
To create an object lifecycle policy
The following put-lifecycle-policy example attaches an object lifecycle policy to the specified container. This enables you to specify how long the service should store objects in your container. MediaStore deletes objects in the container once they reach their expiration date, as indicated in the policy, which is in the file named ExampleLifecyclePolicy.json.
aws mediastore put-lifecycle-policy --container-name ExampleContainer --lifecycle-policy file://ExampleLifecyclePolicy.jsonIdentify--container-nameThe name of the container that you want to assign the object lifecycle policy to.--lifecycle-policyThe object lifecycle policy to apply to the container.Contents of ExampleLifecyclePolicy.json:
{
"rules": [
{
"definition": {
"path": [
{"prefix": "Football/"},
{"prefix": "Baseball/"}
],
"days_since_create": [
{"numeric": [">", 28]}
]
},
"action": "EXPIRE"
}
]
}
This command produces no output.
Options
--container-nameThe name of the container that you want to assign the object lifecycle policy to.--lifecycle-policyThe object lifecycle policy to apply to the container.