Skip to content

Instantly share code, notes, and snippets.

@timmow
Created June 3, 2016 15:44
Show Gist options
  • Save timmow/0f07b4e7b25d14a426efedc10c06cfda to your computer and use it in GitHub Desktop.
Save timmow/0f07b4e7b25d14a426efedc10c06cfda to your computer and use it in GitHub Desktop.
## Autoscaling groups
I started looking at autoscaling in the `provisioning/aws/dmz.tf` file, as this
was the simplest.
Changing the aws_instance terraform config to a launch config was relatively
straightforward. Some of the config params are different, but they are very
similar. The biggest change is tags must be specified individually. Dean had
already done this for the sensu load balancer. However, you cannot specify tags
for az and name in the same way as ec2 instances
Initially on loading the autoscaling group the instances were marked as out of
service in the elb, but because the autoscaling group is configured to use
instance status, and not an elb health check, the instances stayed running. I
was able to test they went in service by making the health check pass on the
instance by editing the nginx config - i didnt try deploying apps to it.
The next steps to take would be to make this autoscaling group the "blue" group
and add a "green" autoscaling group. I assume the workflow would be
Edit Green dmz num of instances and change to 2, and run terraform
deploy the apps to the green dmz instances
wait for lb to show all inservice
edit blue num of instances and change to 0
swapping between green and blue as needed.
## Hostname problems
Due to the fact the cloud init templates use the az and name tag to set the
hostname and fqdn of the instance, and that we cant set these tags in an
autoscaling group, the hostname of the instance is not correctly set
## Ssh config issues
I spent a lot of time figuring out how the ssh config was supposed to work. In
my case one issue was the relatively simple change of using the ubuntu user
instead of a local user, but even when using the ubuntu user I couldnt get the
script working and reverted to connecting to instances using
`ssh -i ~/.ssh/test-tmower ubuntu@172.18.8.142 -o 'ProxyCommand ssh ubuntu@admin-test-tmower.pymnt.uk -i ~/.ssh/test-tmower nc %h %p'`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment