0

I have an EC2 instance running CPM/WHM, which I would like to setup a "self healing" environment for. My plan is to wrap the EC2 instance with a single instance auto-scaling group, making sure that when the instance drops dead, a new one will come alive to replace it. So far so good.

The problem is that the launch configuration does not reflect any changes made to the file system following the instance launch.

So my question is: How can I automate a timely AMI creation + Launch Configuration update ?

Thank you in advance!

Amit Dunsky
  • 485
  • 1
  • 4
  • 10
  • Are the filesystem changes something that only happens at instance startup or are you storing dynamic application data on the filesystem that needs to be persisted across scaling events? – Mike Deck Mar 11 '15 at 23:51
  • This is a website hosting server, meaning filesystem changes occur continuously. – Amit Dunsky Mar 12 '15 at 10:38
  • [Administration panels are off topic](http://serverfault.com/help/on-topic). [Even the presence of an administration panel on a system,](http://meta.serverfault.com/q/6538/118258) because they [take over the systems in strange and non-standard ways, making it difficult or even impossible for actual system administrators to manage the servers normally](http://meta.serverfault.com/a/3924/118258), and tend to indicate low-quality questions from *users* with insufficient knowledge for this site. – HopelessN00b Mar 12 '15 at 17:16
  • Changes to EBS are persisted...maybe you can re-bind the same EBS to a "new box"? – rogerdpack Aug 22 '18 at 16:10
  • Thank you, @rogerdpack. This is an old question. I have since practiced CM tools to automate deployment of new servers. Also, the arrival of the EFS service helped greatly. – Amit Dunsky Aug 22 '18 at 20:18
  • What is EFS service? :) – rogerdpack Aug 22 '18 at 21:54
  • Amazon Elastic File System. An implementation of NFS as a service. See here: https://aws.amazon.com/efs/ – Amit Dunsky Aug 23 '18 at 06:45

1 Answers1

4

First, a disclaimer: this is not the answer you're hoping for, but it is the right answer.


I have an EC2 instance running CPM/WHM

There's your first problem. Your first step to reaching your goal needs to be removing your dependency on these tools.

These control panels are pointy-clicky user tools, not systems administration tools. Remove those and use a real configuration management system to manage your server. I use Ansible for this, but there are many other very good, free options.

The problem is that the launch configuration does not reflect any changes made to the file system following the instance launch.

Right, because you're making manual changes to the system instead of using a configuration management system, which makes automated, programmatic changes.

How can I automate a timely AMI creation + Launch Configuration update ?

You don't want to create new AMIs whenever you need to scale. Really, that's the complete wrong way to do this.

Any application state (uploaded files, sessions, databases, etc.) needs to be managed outside the auto-scaling group. Typical patterns here include using S3 for uploaded files, RDS for your database, etc. If you need a shared filesystem between the autoscaling nodes, then export a filesystem via NFS to those systems from a long-running (non-autoscaled) storage server.

Once you start using a proper configuration management system, all you need to do is configure an auto-scaling group with a launch configuration that has each node apply its own configuration on boot. Period, that's all there is to it. Details on how to do this are highly dependent on which CM you choose.

EEAA
  • 109,363
  • 18
  • 175
  • 245
  • I understand your approach. However, the server hosts websites, and the websites owners needs some kind of a control panel. I would be happy to replace cPanel with a configuration management tool, but I'm bound to running a CP, preferably WHM. When you think of it: almost every hosting company must implement some kind of a HA solution, so I figure there should be something out there. I have no problem running the DB underan RDS instance, but the file system updates still remains the major problem. – Amit Dunsky Mar 12 '15 at 10:45
  • In that case, you should work through cPanel support and see what they suggest in this regard. – EEAA Mar 12 '15 at 13:45
  • Well.. They don't offer any clustering solution. – Amit Dunsky Mar 12 '15 at 17:11
  • 1
    You want to use their product in a way in which it is not intended to be used. cPanel is built for standalone webservers. Period. If you want more advanced HA features, you'll either need to roll your own synchronization layer or give up on cPanel. – EEAA Mar 12 '15 at 17:12
  • @AmitDunsky The obvious question is, why do the website owners need some kind of a control panel? If you're managing the sites, what are the users doing? – Michael Hampton Mar 12 '15 at 17:17
  • @EEAA I tend to agree with you. Thank for the thinking path. – Amit Dunsky Mar 12 '15 at 21:15
  • @MichaelHampton this is how the website hosting business goes.. – Amit Dunsky Mar 12 '15 at 21:18
  • @AmitDunsky You're better off seeking help from web hosting industry specific venues, such as cPanel support. As explained earlier, cPanel (and other control panels like it) make a system very difficult to support in normal ways, which is why we typically do not accept questions about them. – Michael Hampton Mar 13 '15 at 02:34
  • @amitdunsky I'll also add that web hosting companies generally don't use AWS, for these exact reasons. The software they need is not compatible with the ways in which one needs to manage their infrastructure on AWS such that it doesn't cost a fortune. – EEAA Mar 13 '15 at 02:49