I'm not a specialist in networking and I'm struggling at the moment trying to setup auto scaling for a web application.
I have one server - we can call it master - (outside the auto scaling group) which I use for memcache and beanstalkd queue. I also want to use this server to do a source code sync using rsync.
I want my server from the auto scaling group to be able to ssh this master server to perform an rsync and make sure the AMI has the latest version of the application.
I want to perform this sync when the scale-up alarm is triggered and a new instance is launched. I've read that I have to user --user-data-file to execute the script the first time the server is booted.
So this is all the information I have a the moment. I've setup my "launch config", "auto scaling group", "scale up" and "scale down" policy, and both alerts to trigger those policy.
I'm using a custom (private) AMI based on Centos 6 public AMI. When a new instance of the auto scaling group is launched, I have the impression that the bootstrap.sh script is not executed. Here is my launch config:
as-create-launch-config --image-id <PRIVATE_AMI> --instance-type m1.medium --key master --group webserver-security-group --user-data-file /home/user/bin/bootstrap.sh --launch-config my-lc-1
Here is the content of /home/user/bin/bootstrap.sh:
#!/bin/bash set -e -x # Start the workers /var/www/user/bin/start.sh
So my first problem is that I have no idea why this script is not executed.
The second issue I have is that I'm not sure how to allow SSH connection to the "master" server knowing that the instance is changing when scaling up or down.
Help would be greatly appreciated ;)