Deploying to multiple instances



I’m on my way to understand and configure continuous deployment system and I want to deploy the same repo to multiple EC2 instances using ssh. I have docker between circleCI and AWS so first I should make a container images and then deploy it to the multiple instances.

1)What should I write in circle.yml and .sh file to deploy same webservers to two EC2 instances?
2)How can I deploy parts of repo to different instances? (I’m going to have nginx load-balancer on one server and two nodeJS servers on two other instances.)


This is a very broad question—the answers would depend on your exact workflow, but a few ideas below.

The circle.yml file’s content is plain bash, so you could write something like this:

  production: # just a label
    branch: master
      - for s in server1 server2 server3; do scp production-image.tar.gz $; done

If you are copying two different images:

  production: # just a label
    branch: master
      - scp production-image-1.tar.gz
      - scp production-image-2.tar.gz

Does that make sense?


Yes, that make sense. I know a few bash commands. Thanks.