I’m pretty new to using Amazon’s ruby-sdk (gem install aws-sdk), and am stuck trying to simply create a tag for a snapshotted resource. Here’s what I’m doing:
ec2.tags.create(:resource_id => "snap-7d3aa701", :key => "My Test Tag", :value => "My test value")
ArgumentError: wrong number of arguments (1 for 2)
Note, ec2 = AWS::EC2.new (after I set my credentials).
Any ideas what I’m doing wrong? I haven’t been able to find a single example online of using the ruby aws-sdk for tagging.
The simplest way to tag an EC2 resource is it use the #tags method:
If you want a handle to the tag object created, you can still use the TagCollection#create method. It expects the first param to be a resource: