1

I am totally new on configuring servers and working with EC2, so please bear with me.

I managed after a lot of hair pulling to get a server with Ubuntu up and running with memcached and some other goodies that would make a great package for me.

I thought that however, when storing it as an AMI with this tool I would be able to have memcached available next time I launched an instance based upon that image. What can I do to make sure that my configuration is saved properly to an instance?

Question number two: - Can I someway make a command that is automatically run on server creation, like initiating memcache with "memcache -d -m 1700 -u root" or even a batch of them?

Dennis Williamson
  • 60,515
  • 14
  • 113
  • 148
Industrial
  • 1,559
  • 5
  • 24
  • 37

2 Answers2

2

If you create your own custom AMI from your running instance, you can store it to either S3 or, like the tool you referenced does, an EBS volume. Either way, the custom AMI will contain all the extra packages you installed, and new instances that you launch using that AMI will have all the packages preinstalled.

You can run a command automatically when an instance starts up by just creating a regular startup script in /etc/init.d - EC2 instances always start at run level 4, so just make sure your script is set to run at that level and you'll be good to go.

gareth_bowles
  • 8,867
  • 9
  • 33
  • 42
1

I don't know if this will help, but I wrote a blog article about doing almost this exact thing a while back: http://winnersdontlose.com/?p=95

AWS also has a recommended way of passing userland variables into the instances (I think they call them init commands... similar to supplying boot-time parameters to the kernel). The best way to do what you're talking about, though, would be to setup an AMI where your memcache startup script (/etc/init.d/memcached) has the parameters you want built in. After that, you'll want to make sure that your config for run level 4 contains a start signal to memcached (/etc/init.d/rc4.d/Sxxmemcached).

Tony
  • 482
  • 3
  • 3