Created
June 11, 2021 19:54
-
-
Save gautierdag/653cbf0895392b45aac1d5f24fab470a to your computer and use it in GitHub Desktop.
Make all DynamoDB Tables On-Demand - Use with caution ⚠️
This file contains hidden or 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
for name in $(aws dynamodb list-tables | jq .TableNames) | |
do | |
l=${#name} | |
if [ ${#name} -le 3 ]; then echo "Skipping name!" | |
else | |
short=${name:1:l-2} # clean json string representation of dataset | |
if [ "${short: -1}" == '"' ] | |
then short=${name:1:l-3} | |
fi | |
echo "Updating Table: ${short}" | |
aws dynamodb update-table --table-name ${short} --billing-mode PAY_PER_REQUEST > "${short}_response.json" | |
sleep 30 # long sleep so that tables have time to be updated (AWS has max limit of 50 tables updating at once) | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment