title: How do I give an instance a name when created with the aws sdk for ruby?
body: <p>So I'm writing a rails app that will allow a user to create an instance on ec2. So far I've been able to get things up and running quite nicely, with one exception: I can't seem to give the instance a name. It becomes confusing when I look in the management console and see a bunch of no-name instances. I've looked at the <a href="http://docs.aws.amazon.com/AWSRubySDK/latest/AWS/EC2/InstanceCollection.html#create-instance_method" rel="nofollow">documentation</a> for creating the instances and none of the available options seem to fit the bill, but maybe I'm missing something.</p>
  
  <p>tl;dr How can I give an instance a name when I create it with the AWS SDK for ruby?</p>
  
  <p>EDIT:
  It was suggested that I use <code>ec2.client.create_tags</code> like this:</p>
  
  <pre><code>ec2.client.create_tags(:resources =&gt; [@instance.instance_id, :tags =&gt; [
      { :key =&gt; 'Name', :value =&gt; @instance.instance_name },
  ]])
  </code></pre>
  
  <p>But i get this error: <code>expected string value for member 2 of option resources</code></p>
  
  <p>Both <code>@instance.instance_name</code> and <code>@instance.instance_id</code> are strings so I don't know what's going on.</p>
  
  <p>EDIT2: the error above was due to a misplaced bracket.</p>