Optimize code that initializes and clears DynamoDB tables