<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>John&#039;s Tidbits &#187; ec2</title>
	<atom:link href="http://inodes.org/tag/ec2/feed/" rel="self" type="application/rss+xml" />
	<link>http://inodes.org</link>
	<description>Moo - Development, Trouble-shooting and Random thoughts...</description>
	<lastBuildDate>Thu, 07 Apr 2011 11:38:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.1</generator>
		<item>
		<title>Puppet, Facts and Certificates</title>
		<link>http://inodes.org/2008/03/13/puppet-facts-and-certificates/</link>
		<comments>http://inodes.org/2008/03/13/puppet-facts-and-certificates/#comments</comments>
		<pubDate>Thu, 13 Mar 2008 03:14:16 +0000</pubDate>
		<dc:creator>johnf</dc:creator>
				<category><![CDATA[Sysadmin]]></category>
		<category><![CDATA[bugfix]]></category>
		<category><![CDATA[ec2]]></category>
		<category><![CDATA[puppet]]></category>
		<category><![CDATA[vquence]]></category>

		<guid isPermaLink="false">http://inodes.org/blog/2008/03/13/puppet-facts-and-certificates/</guid>
		<description><![CDATA[I&#8217;m currently setting up Puppet at Vquence so that, among other things, we can deploy hosts into Amazon EC2 more easily. To ensure a minimum setup time on a new server I wanted the setup to be as simple as echo &#8216;DAEMON_OPTS=&#8221;-w 120 &#8211;fqdn newserver.vquence.com &#8211;server puppetmaster.vquence.com&#8221; > /etc/default/puppet aptitude install puppet This means that [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m currently setting up <a href="http://reductivelabs.com/projects/puppet/">Puppet</a> at Vquence so that, among other things, we can deploy hosts into Amazon EC2 more easily. </p>
<p>To ensure a minimum setup time on a new server I wanted the setup to be as simple as</p>
<ul>
<li> echo &#8216;DAEMON_OPTS=&#8221;-w 120 &#8211;fqdn <strong>newserver.vquence.com</strong> &#8211;server puppetmaster.vquence.com&#8221; > /etc/default/puppet </li>
<li> aptitude install puppet </li>
</ul>
<p>This means that the puppet client will use <strong>newserver.vquence.com</strong> as the common name in the SSL certificate it creates for itself. On the puppet master the SSL cert name is then used to pick a node rather than the hostname reported by facter.</p>
<p>This means that I don&#8217;t need to worry about setting up /etc/hostname, even better /etc/hostname can be managed by puppet.</p>
<p>You can control this functionality on the puppet master by using the node_name option. From the docs</p>
<pre>
    # How the puppetmaster determines the client's identity
    # and sets the 'hostname' fact for use in the manifest, in particular
    # for determining which 'node' statement applies to the client.
    # Possible values are 'cert' (use the subject's CN in the client's
    # certificate) and 'facter' (use the hostname that the client
    # reported in its facts)
    # The default value is 'cert'.
    # node_name = cert
</pre>
<p>The problem was that the &#8216;hostname&#8217; fact wasn&#8217;t being set. It looks like there was a regression in SVN#1673 when some refactoring was performed.</p>
<p>I&#8217;ve filed bug <a href="http://reductivelabs.com/trac/puppet/ticket/1133">#1133</a> and you can clone my git <a href="http://inodes.org/~johnf/git/puppet">repository.</a></p>
<p>I haven&#8217;t included any tests in the patch as I&#8217;m not sure how to. The master.rb test already tests this functionality but doesn&#8217;t test that the facts object has actually been changed. I think a test on <strong>getconfig</strong> is probably required but I&#8217;m not sure how you would access the facts after calling it.</p>
<p><strong>Update:</strong> This patch is now in puppet as of 0.24.3.</p>
]]></content:encoded>
			<wfw:commentRss>http://inodes.org/2008/03/13/puppet-facts-and-certificates/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Amazon EC2 ruby gem and large user_data</title>
		<link>http://inodes.org/2008/02/26/amazon-ec2-ruby-gem-and-large-user_data/</link>
		<comments>http://inodes.org/2008/02/26/amazon-ec2-ruby-gem-and-large-user_data/#comments</comments>
		<pubDate>Tue, 26 Feb 2008 01:05:30 +0000</pubDate>
		<dc:creator>johnf</dc:creator>
				<category><![CDATA[Sysadmin]]></category>
		<category><![CDATA[ec2]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[vquence]]></category>

		<guid isPermaLink="false">http://inodes.org/blog/2008/02/26/amazon-ec2-ruby-gem-and-large-user_data/</guid>
		<description><![CDATA[When you create an instance in EC2 you can send Amazon some user data that is accessible by your instance. At Vquence we use this to send a script that gets executes at boot up. This script contains some openvpn and puppet RSA keys so its approaching about 10k in size. This works without any [...]]]></description>
			<content:encoded><![CDATA[<p>When you create an instance in EC2 you can send Amazon some user data that is accessible by your instance. At Vquence we use this to send a script that gets executes at boot up. This script contains some openvpn and puppet RSA keys so its approaching about 10k in size.</p>
<p>This works without any problems when using the java based command line tools. However I was getting the following error when using the <a href="http://amazon-ec2.rubyforge.org/">EC2 Ruby GEM</a>. </p>
<pre>
/usr/lib/ruby/1.8/net/protocol.rb:133:in `sysread': Connection reset by peer (Errno::ECONNRESET)
	from /usr/lib/ruby/1.8/net/protocol.rb:133:in `rbuf_fill'
	from /usr/lib/ruby/1.8/timeout.rb:56:in `timeout'
	from /usr/lib/ruby/1.8/timeout.rb:76:in `timeout'
	from /usr/lib/ruby/1.8/net/protocol.rb:132:in `rbuf_fill'
	from /usr/lib/ruby/1.8/net/protocol.rb:116:in `readuntil'
	from /usr/lib/ruby/1.8/net/protocol.rb:126:in `readline'
	from /usr/lib/ruby/1.8/net/http.rb:2020:in `read_status_line'
	from /usr/lib/ruby/1.8/net/http.rb:2009:in `read_new'
	 ... 6 levels...
	from ./lib/ec2helpers.rb:43:in `start_instance'
	from ./ec2-puppet:107
	from ./ec2-puppet:89:in `each_pair'
	from ./ec2-puppet:89
</pre>
<p>Doing some tcpdumping indicated that after receiving the request Amazon waits for a while and then sends a TCP RESET. Not very nice at all. My next step was to use ngrep to compare the output from the command line tools and the ruby gem. This got nowhere fast since the command line tools use the SOAP API while the ruby gem uses the Query API.</p>
<p>What I did notice however is that while the command line tools performed a POST the ruby library performed a GET. At this stage I decided to test how much data I could send. So I started trying different user data sizes. The offending amount was around 7.8k, suspiciously close to exactly 8k.</p>
<p>The <a href="http://www.ietf.org/rfc/rfc2616.txt">HTTP/1.1</a> spec doesn&#8217;t place an actual limit on the length but leaves it up to the server.<br />
<cite><br />
   The HTTP protocol does not place any a priori limit on the length of<br />
   a URI. Servers MUST be able to handle the URI of any resource they<br />
   serve, and SHOULD be able to handle URIs of unbounded length if they<br />
   provide GET-based forms that could generate such URIs. A server<br />
   SHOULD return 414 (Request-URI Too Long) status if a URI is longer<br />
   than the server can handle (see section 10.4.15).<br />
</cite></p>
<p><cite><br />
      Note: Servers ought to be cautious about depending on URI lengths<br />
      above 255 bytes, because some older client or proxy<br />
      implementations might not properly support these lengths.<br />
</cite></p>
<p>Apache for example limits this by default to 8190 bytes including the method and the protocol. You can change this using the <a href="http://httpd.apache.org/docs/2.0/mod/core.html#limitrequestline">LimitRequestLine</a> directive.</p>
<p>I created a patch to modify the EC2 Gem to use a POST instead of a GET which has no such limitations. You can find the git tree for it at http://inodes.org/~johnf/git/amazon-ec2</p>
]]></content:encoded>
			<wfw:commentRss>http://inodes.org/2008/02/26/amazon-ec2-ruby-gem-and-large-user_data/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

