Move ec2 code into its own module.