Modified cloudformation module to use common ec2 module functions

Fixes #3688