Last active
February 14, 2019 18:34
-
-
Save adamsimp/bea97d11e8f125dc52a2572fda7b886c to your computer and use it in GitHub Desktop.
Set AWS MediaStore Lifecycle Policy.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
for i in us-east-1 us-west-2 | |
do | |
NAMES=`aws mediastore list-containers --region=$i | jq -r '.[] | .[].Name'` | |
echo $NAMES | |
for j in $NAMES | |
do | |
aws mediastore delete-lifecycle-policy --container-name $j --region=$i | |
done | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
AGE_IN_DAYS=1 | |
for i in us-east-1 us-west-2 | |
do | |
NAMES=`aws mediastore list-containers --region=$i | jq -r '.[] | .[].Name'` | |
echo $NAMES | |
for j in $NAMES | |
do | |
POLICY='{"rules":[{"definition":{"path":[{"prefix":""}],"days_since_create":[{"numeric":[">",'$AGE_IN_DAYS']}]},"action":"EXPIRE"}]}' | |
aws mediastore put-lifecycle-policy --container-name $j --lifecycle-policy $POLICY --region=$i | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment