Quick way to delete all existing build history from AWS CodeBuild using the AWS CLI.
#!/bin/bash -e
buffer=()
for buildId in $(aws codebuild list-builds --query 'ids.join(`\n`,@)' --output text); do
buffer+=($buildId)
if [[ ${#buffer[@]} -ge 100 ]]; then
aws --no-cli-pager codebuild batch-delete-builds --ids "${buffer[@]}"
buffer=()
fi
done
if [[ ${#buffer[@]} -gt 0 ]]; then
aws --no-cli-pager codebuild batch-delete-builds --ids "${buffer[@]}"
fi