How to set node attributes when creating ec2 instances?

So I can create ec2 instances using knife ec2 server create ... -r 'role[web]'. But how do I set node attributes (e.g. { “listen_port” :
8080 }) when using this command?

Eric,

Funny you mentioned this, I actually JUST sent a pull
requesthttps://github.com/opscode/knife-ec2/pull/47for this feature
earlier today. Eric Hankins opened
CHEF-3025 http://tickets.opscode.com/browse/CHEF-3025, which provides
means to pass in node data via the --json-attributes parameter when using
knife bootstrap. The node data is added to the first-boot.json file, and
run on the first run. Please note this new feature was merged into Chef
0.10.10. I needed this feature for our Jenkins deployments, so I forked
knife-ec2 and added this feature (
KNIFE_EC2-58http://tickets.opscode.com/browse/KNIFE_EC2-58 ).
You can find the pull request
herehttps://github.com/opscode/knife-ec2/pull/47 if
you want to build test it out yourself before it gets merged in. FWIW its
working great for me :slight_smile:

Hope this helps!

-John

On Fri, May 25, 2012 at 3:51 PM, Eric Jain eric.jain@gmail.com wrote:

So I can create ec2 instances using knife ec2 server create ... -r 'role[web]'. But how do I set node attributes (e.g. { "listen_port" :
8080 }) when using this command?

On Fri, May 25, 2012 at 12:59 PM, John Dyer johntdyer@gmail.com wrote:

Funny you mentioned this, I actually JUST sent a pull request for this
feature earlier today [...]

How convenient :slight_smile:

Looks like knife-ec2 doesn't get released that often, so I'll need to
figure out how to build knife-ec2...

Eric,

Not to difficult

Hope this helps :slight_smile:

-John

On Fri, May 25, 2012 at 4:31 PM, Eric Jain eric.jain@gmail.com wrote:

On Fri, May 25, 2012 at 12:59 PM, John Dyer johntdyer@gmail.com wrote:

Funny you mentioned this, I actually JUST sent a pull request for this
feature earlier today [...]

How convenient :slight_smile:

Looks like knife-ec2 doesn't get released that often, so I'll need to
figure out how to build knife-ec2...

On Fri, May 25, 2012 at 1:51 PM, John Dyer johntdyer@gmail.com wrote:

Not to difficult

git clone GitHub - johntdyer/knife-ec2: Opscode Chef knife plug-in for EC2
cd knife-ec2
gem build knife-ec2.gemspec
gem install knife-ec2-0.5.13.gem
profit

Hope this helps :slight_smile:

Thanks! It works (apart from the profit command, which I haven't
installed yet).

Might be useful to be able to do -j @somefile.json in addition to
-j '{...}'?