You need a combination of Userdata to fire off cfn-init (installed as part of the EC2Config scripts) and CloudInit::Metadata stuff to download the source.
I've written about how to bootstrap a windows instance on AWS using CloudFormation
Basically the flow is as follows
- get your package onto a downloadable location
- Update your cloud formation script to include userdata
- In the Userdata, execute cfn-init
- In the metadata, provide locations to download source files or zips
- Execute commands section in the "Commands" section of the metadata