fix keyerror
Merge pull request #14232 from UtahDave/fix_ec2

fix keyerror