Here is a quick sample bash script that you can adapt to your environment. This includes most dependencies required in Ubuntu (except for AWS CLI) and blocks the top 1,000 attack IPs risk level 5 in the specified AWS VPC network access control list.