The shell script wasn’t the performance issue, it was the fact that the shell script was calling the AWS CLI rather than the SDK.
There’s a bit less waiting around.