We are trying to move from Heroku to AWS CodeDeploy for my nodejs app.
In Heroku deployment, we are using nodejs-compass-grunt buildpack to install dependencies and run compass. Is there anything similar in AWS to use with CodeDeploy, or shall we just have an AMI with eveyrthing installed?
Unlike Heroku, CodeDeploy is not a PaaS. It is a service that help you manage the software deployed to cloud infrastructure. CodeDeploy is agnostic to the type of software you want to deploy and it's dependencies. This makes it very flexible, but it also mean you have to do more work to tell CodeDeploy how to deploy your software.
If you want to deploy a framework to your hosts and then deploy your software that depends on that framework, you have two options:
With Option 1, if you want to migrate to a new version of any of your dependencies you will have to do the same work you would need to do to switch to a new OS. Essentially you will have to a blue-green deployment:
That can certainly slow things down if you were looking to do in place deployments wit CodeDeploy. If you want to do blue-green deployments anyway, than the only thing you are losing is not using a vended AMI and having to manage your own.
With Option 2, you need to bundle all your dependencies as part of your deployment archive. You will also need to create scripts to install/reinstall them. You can then call these scripts during the BeforeInstall lifecycle step. When you want to update or rollback a dependency, all you need to do is the same thing you would do for normal code changes:
The downside in here is that you have to either reinstall your dependencies on every deployment or add code to check the existing version and risk having a corrupted dependency that won't just be fixed by redeploying the same bundle.