Below the problem I got while migrating the Jenkins slave jobs over to AWS:
The way I solve it is to get a copy of compiled dependencies on the AWS instance and build a AMI image out of it. So, the AWS instance will already have a copy of all needed dependencies, and will only check out the test code and run the test without have to worry about downloading and compiling its dependencies.