Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 1 down vote accepted

I don't know if this will help, but I wrote a blog article about doing almost this exact thing a while back:

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).

share|improve this answer

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.