In my current project(s) we make extensive use of graphite to monitor, well everything really. As part of setting up monitoring I wanted to automate the process of setting up a graphite instance and cluster.
Cloud Init
For the purposes of this article I am assuming you are familiar with the EC2 Console and with launching instances using the “Classic Wizard” you will be taken to the menu shown below. Here you can specify the benign sounding User Data value either as text of as a file. The user data field however is not some arbitrary metadata but instead the it can contain a cloud init initialization script. The script specified here is run automatically on instance launch. From the menu above select the As File option and upload the graphite initialization script and you are done a fully configured graphite instance will be up shortly. You maybe thinking “I don’t have a graphite initialization script” fear not, The script needed to bring up a graphite instance on a standard AMI can be found below.