I have a small fleet of EC2 servers that all run the same nodejs app. Deploying an update is painful: create an new AMI, terminate old instances, launch new instances.

Is it possible to centralize the node js source code, and update it at a single place for all EC2 instances ?

2 Answers 2


Yes. There are probably many ways to do it.

One might be to put the code on S3 and have a script download the latest source code when the EC2 instance boots.

EC2 startup scripts.

S3 copy command.

Another would be to store the source code on Elastic File System and mount it on each server.

Then you'll just need to automate updates and such. I haven't worked out how to automate OS updates, because I've never needed to, but I know there's support for that.


You could also try to activate a new EC2 instance and use it as a dedicated NFS Server. That's a sort of DIY EFS. Unfortunately Amazon Elastic File System performance are bound to the filesystem size and you don't get anything good until your filesystem reaches a certain size. Unfortunately EFS is quite expensive when compared to EBS or S3. This way a EC2 dedicated NFS server could be less expensive.

  • Good suggestion, but I guess it depends on requirements and file count / size. The operating systems will cache the files after first access as well. For a small codebase EFS is probably negligible price and acceptable performance given caching. An EC2 instance needs to be managed, backed up, etc. Also I wonder if the code could be changed to bootstrap itself from S3.
    – Tim
    Dec 8, 2017 at 21:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .