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've looked over the Puppet Master Cloudformation Template and understand it is using CloudInit baked into the Amazon Linux AMI. However, I'd like to use an existing Ubuntu 11.10 server image and still bootstrap the server as a Puppet Master. Reading through the CloudFormation and BootStrapping documentation it would seem this is possible but no adequate logs are generated on the server or when the stack is created. Short of creating a custom AMI is there a way to do this with an existing AMI?

share|improve this question

I decided to go the custom script route since I couldn't get the MetaData resource to install and configure packages with apt (see:

The custom bash script does the install work to bootstrap the puppet master instance. I needed it to be in JSON format so I used this handy Ruby script from

require 'rubygems'
require 'json'

if ARGV.size != 1
  puts "Usage: #{$0} <file>"
  exit 1

def escape(string)
  parse = JSON.parse({ 'json' => string }.to_json)

data = ''[0]) {|f| data <<}
p escape(data)

# ./json_encode.rb combined-userdata.txt

This should work for now, but it would be nice to eventually manage the bootstrap procces as intended with cfn-init MetaData and apt. For example, this still doesn't work for me with apt:

"Resources": {
  "MyInstance": {
    "Type": "AWS::EC2::Instance",
"Metadata" : {
      "AWS::CloudFormation::Init" : {
        "config" : {
          "sources" : {
"packages" : {
"files" : {
"services" : {
"Properties": {


An easier solution is to also use Ubuntu CloudInit ( and have it install the packages for you. My template for EC2 Puppet Client instances looks like this now:

"webserver" : {
   "Type" : "AWS::EC2::Instance",
   "Properties" : {
      "KeyName" : { "Ref" : "KeyName" },
      "ImageId" : { "Fn::FindInMap" : [ "RegionMap", { "Ref" : "AWS::Region" }, "AMI" ]},
      "InstanceType": { "Ref" : "InstanceType" },               
      "SecurityGroups" : [ { "Ref" : "PuppetGroup" }, { "Ref" : "WebServerGroup" } ],
      "UserData" : { "Fn::Base64" : { "Fn::Join" : ["", [
        "- ruby","\n",
        "- ruby-dev","\n",
        "- rubygems","\n",
        "- puppet","\n",
        "- vim-puppet","\n",
        "- puppet-el","\n",
        "server: ",,"\n",

That's basically the CloudConfig boot strap process minus the runcmd magic that makes it work. I'm still trying to figure out how to get my puppet manifests down to the puppet master and assigned to nodes but that should help anyone who's using an Ubuntu UEC AMI.

share|improve this answer
+1 for following up to your own question, thanks! – Steffen Opel Jan 15 '12 at 18:07

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.