Fix stacktrace in ec2 provider

Closes #15320