AWS Cookbook problem


#1

Hi everyone,

I’m attempting to run providers from the aws cookbook in Ubuntu 12.04 on an AWS
box. I’m hitting a wall where it seems like the access key and secret access
key are not properly passed down to the Right AWS underlying library, even if I
hardcode them in my calling recipe. Here’s an example of the call, with the
keys replaced for my protection:

include_recipe “aws”

aws_ebs_volume “test-drive” do
aws_access_key = “MYACCESSKEY” #aws_bag[‘aws_access_key’]
aws_secret_access_key = “mySecretAccessKey” #aws_bag[‘aws_secret_key’]
size 25
availability_zone "us-east-1"
device "/dev/xvdb"
action [:create, :attach]
end

Running this in a recipe yields:

[Fri, 18 May 2012 18:35:24 +0000] FATAL: RightAws::AwsError:
aws_ebs_volume[test-drive] (appinions::ebs-raid-10 line 22) had an error:
RightAws::AwsError: AWS access keys are required to operate on EC2

And this stacktrace:

Generated at Fri May 18 18:35:24 +0000 2012
RightAws::AwsError: aws_ebs_volume[test-drive] (appinions::ebs-raid-10 line 22)
had an error: RightAws::AwsError: AWS access keys are required to operate on
EC2
/var/lib/gems/1.8/gems/right_aws-2.1.0/lib/awsbase/right_awsbase.rb:272:in
init' /var/lib/gems/1.8/gems/right_aws-2.1.0/lib/ec2/right_ec2.rb:123:ininitialize’
/var/chef/cache/cookbooks/aws/libraries/ec2.rb:29:in new' /var/chef/cache/cookbooks/aws/libraries/ec2.rb:29:inec2’
/var/chef/cache/cookbooks/aws/providers/ebs_volume.rb:118:in
currently_attached_volume' /var/chef/cache/cookbooks/aws/providers/ebs_volume.rb:21:inclass_from_file’
/var/lib/gems/1.8/gems/chef-0.10.10/bin/…/lib/chef/provider.rb:106:in
instance_eval' /var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/provider.rb:106:inaction_create’
/var/lib/gems/1.8/gems/chef-0.10.10/bin/…/lib/chef/resource.rb:454:in send' /var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/resource.rb:454:inrun_action’
/var/lib/gems/1.8/gems/chef-0.10.10/bin/…/lib/chef/runner.rb:49:in
run_action' /var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/runner.rb:85:inconverge’
/var/lib/gems/1.8/gems/chef-0.10.10/bin/…/lib/chef/runner.rb:85:in each' /var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/runner.rb:85:inconverge’
/var/lib/gems/1.8/gems/chef-0.10.10/bin/…/lib/chef/resource_collection.rb:94:in
execute_each_resource' /var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/resource_collection/stepable_iterator.rb:116:incall’
/var/lib/gems/1.8/gems/chef-0.10.10/bin/…/lib/chef/resource_collection/stepable_iterator.rb:116:in
call_iterator_block' /var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/resource_collection/stepable_iterator.rb:85:instep’
/var/lib/gems/1.8/gems/chef-0.10.10/bin/…/lib/chef/resource_collection/stepable_iterator.rb:104:in
iterate' /var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/resource_collection/stepable_iterator.rb:55:ineach_with_index’
/var/lib/gems/1.8/gems/chef-0.10.10/bin/…/lib/chef/resource_collection.rb:92:in
execute_each_resource' /var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/runner.rb:80:inconverge’
/var/lib/gems/1.8/gems/chef-0.10.10/bin/…/lib/chef/client.rb:330:in converge' /var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/client.rb:163:inrun’
/var/lib/gems/1.8/gems/chef-0.10.10/bin/…/lib/chef/application/client.rb:254:in
run_application' /var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/application/client.rb:241:inloop’
/var/lib/gems/1.8/gems/chef-0.10.10/bin/…/lib/chef/application/client.rb:241:in
run_application' /var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/application.rb:70:inrun’
/var/lib/gems/1.8/gems/chef-0.10.10/bin/chef-client:26
/usr/local/bin/chef-client:19:in `load’
/usr/local/bin/chef-client:19

Is it possible that the underlying right_aws gem has changed somehow, or am I
just doing it wrong?

Thanks,

Michael


#2

I just noticed the extraneous equals signs in my call and smacked
myself in the head. Nevermind! :slight_smile:

Thanks,

Michael

On Fri, May 18, 2012 at 2:25 PM, michael.della.bitta@appinions.com wrote:

Hi everyone,

I’m attempting to run providers from the aws cookbook in Ubuntu 12.04 on an AWS
box. I’m hitting a wall where it seems like the access key and secret access
key are not properly passed down to the Right AWS underlying library, even if I
hardcode them in my calling recipe. Here’s an example of the call, with the
keys replaced for my protection:

include_recipe “aws”

aws_ebs_volume “test-drive” do
aws_access_key = “MYACCESSKEY” #aws_bag[‘aws_access_key’]
aws_secret_access_key = “mySecretAccessKey” #aws_bag[‘aws_secret_key’]
size 25
availability_zone "us-east-1"
device "/dev/xvdb"
action [:create, :attach]
end

Running this in a recipe yields:

[Fri, 18 May 2012 18:35:24 +0000] FATAL: RightAws::AwsError:
aws_ebs_volume[test-drive] (appinions::ebs-raid-10 line 22) had an error:
RightAws::AwsError: AWS access keys are required to operate on EC2

And this stacktrace:

Generated at Fri May 18 18:35:24 +0000 2012
RightAws::AwsError: aws_ebs_volume[test-drive] (appinions::ebs-raid-10 line 22)
had an error: RightAws::AwsError: AWS access keys are required to operate on
EC2
/var/lib/gems/1.8/gems/right_aws-2.1.0/lib/awsbase/right_awsbase.rb:272:in
init' /var/lib/gems/1.8/gems/right_aws-2.1.0/lib/ec2/right_ec2.rb:123:ininitialize’
/var/chef/cache/cookbooks/aws/libraries/ec2.rb:29:in new' /var/chef/cache/cookbooks/aws/libraries/ec2.rb:29:inec2’
/var/chef/cache/cookbooks/aws/providers/ebs_volume.rb:118:in
currently_attached_volume' /var/chef/cache/cookbooks/aws/providers/ebs_volume.rb:21:inclass_from_file’
/var/lib/gems/1.8/gems/chef-0.10.10/bin/…/lib/chef/provider.rb:106:in
instance_eval' /var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/provider.rb:106:inaction_create’
/var/lib/gems/1.8/gems/chef-0.10.10/bin/…/lib/chef/resource.rb:454:in send' /var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/resource.rb:454:inrun_action’
/var/lib/gems/1.8/gems/chef-0.10.10/bin/…/lib/chef/runner.rb:49:in
run_action' /var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/runner.rb:85:inconverge’
/var/lib/gems/1.8/gems/chef-0.10.10/bin/…/lib/chef/runner.rb:85:in each' /var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/runner.rb:85:inconverge’
/var/lib/gems/1.8/gems/chef-0.10.10/bin/…/lib/chef/resource_collection.rb:94:in
execute_each_resource' /var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/resource_collection/stepable_iterator.rb:116:incall’
/var/lib/gems/1.8/gems/chef-0.10.10/bin/…/lib/chef/resource_collection/stepable_iterator.rb:116:in
call_iterator_block' /var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/resource_collection/stepable_iterator.rb:85:instep’
/var/lib/gems/1.8/gems/chef-0.10.10/bin/…/lib/chef/resource_collection/stepable_iterator.rb:104:in
iterate' /var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/resource_collection/stepable_iterator.rb:55:ineach_with_index’
/var/lib/gems/1.8/gems/chef-0.10.10/bin/…/lib/chef/resource_collection.rb:92:in
execute_each_resource' /var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/runner.rb:80:inconverge’
/var/lib/gems/1.8/gems/chef-0.10.10/bin/…/lib/chef/client.rb:330:in converge' /var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/client.rb:163:inrun’
/var/lib/gems/1.8/gems/chef-0.10.10/bin/…/lib/chef/application/client.rb:254:in
run_application' /var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/application/client.rb:241:inloop’
/var/lib/gems/1.8/gems/chef-0.10.10/bin/…/lib/chef/application/client.rb:241:in
run_application' /var/lib/gems/1.8/gems/chef-0.10.10/bin/../lib/chef/application.rb:70:inrun’
/var/lib/gems/1.8/gems/chef-0.10.10/bin/chef-client:26
/usr/local/bin/chef-client:19:in `load’
/usr/local/bin/chef-client:19

Is it possible that the underlying right_aws gem has changed somehow, or am I
just doing it wrong?

Thanks,

Michael