AuthFailure => AWS was not able to validate the provided access credentials
cap rubber:create_staging
# config/rubber/rubber.yml
app_name: testivate
app_user: app
admin_email: <my email>
timezone: US/Eastern
domain: foo.com
cloud_provider: aws
cloud_providers:
aws:
region: us-east-1
access_key: ...
secret_access_key: ...
account: ...
key_name: gsg-keypair
key_file: "#{Dir[(File.expand_path('~') rescue '/root') + '/.ec2/*' + cloud_providers.aws.key_name].first}"
$ cap rubber:create_staging
triggering load callbacks
* 2016-06-05 12:21:25 executing `rubber:init'
* 2016-06-05 12:21:26 executing `rubber:create_staging'
Hostname to use for staging instance [production]:
Roles to use for staging instance [apache,app,collectd,common,db:primary=true,elasticsearch,examples,graphite_server,graphite_web,graylog_elasticsearch,graylog_mongodb,graylog_server,graylog_web,haproxy,mongodb,monit,passenger,postgresql,postgresql_master,web,web_tools]:
* 2016-06-05 12:21:28 executing `rubber:create'
/Users/steven/.rvm/gems/ruby-2.3.1/gems/excon-0.45.4/lib/excon/middlewares/expects.rb:6:in `response_call': AuthFailure => AWS was not able to validate the provided access credentials (Fog::Compute::AWS::Error)
from /Users/steven/.rvm/gems/ruby-2.3.1/gems/excon-0.45.4/lib/excon/middlewares/response_parser.rb:8:in `response_call'
from /Users/steven/.rvm/gems/ruby-2.3.1/gems/excon-0.45.4/lib/excon/connection.rb:372:in `response'
from /Users/steven/.rvm/gems/ruby-2.3.1/gems/excon-0.45.4/lib/excon/connection.rb:236:in `request'
from /Users/steven/.rvm/gems/ruby-2.3.1/gems/excon-0.45.4/lib/excon/middlewares/idempotent.rb:26:in `error_call'
from /Users/steven/.rvm/gems/ruby-2.3.1/gems/excon-0.45.4/lib/excon/middlewares/base.rb:10:in `error_call'
from /Users/steven/.rvm/gems/ruby-2.3.1/gems/excon-0.45.4/lib/excon/middlewares/base.rb:10:in `error_call'
from /Users/steven/.rvm/gems/ruby-2.3.1/gems/excon-0.45.4/lib/excon/connection.rb:256:in `rescue in request'
from /Users/steven/.rvm/gems/ruby-2.3.1/gems/excon-0.45.4/lib/excon/connection.rb:204:in `request'
from /Users/steven/.rvm/gems/ruby-2.3.1/gems/excon-0.45.4/lib/excon/middlewares/idempotent.rb:26:in `error_call'
from /Users/steven/.rvm/gems/ruby-2.3.1/gems/excon-0.45.4/lib/excon/middlewares/base.rb:10:in `error_call'
from /Users/steven/.rvm/gems/ruby-2.3.1/gems/excon-0.45.4/lib/excon/middlewares/base.rb:10:in `error_call'
from /Users/steven/.rvm/gems/ruby-2.3.1/gems/excon-0.45.4/lib/excon/connection.rb:256:in `rescue in request'
from /Users/steven/.rvm/gems/ruby-2.3.1/gems/excon-0.45.4/lib/excon/connection.rb:204:in `request'
from /Users/steven/.rvm/gems/ruby-2.3.1/gems/excon-0.45.4/lib/excon/middlewares/idempotent.rb:26:in `error_call'
from /Users/steven/.rvm/gems/ruby-2.3.1/gems/excon-0.45.4/lib/excon/middlewares/base.rb:10:in `error_call'
from /Users/steven/.rvm/gems/ruby-2.3.1/gems/excon-0.45.4/lib/excon/middlewares/base.rb:10:in `error_call'
from /Users/steven/.rvm/gems/ruby-2.3.1/gems/excon-0.45.4/lib/excon/connection.rb:256:in `rescue in request'
from /Users/steven/.rvm/gems/ruby-2.3.1/gems/excon-0.45.4/lib/excon/connection.rb:204:in `request'
from /Users/steven/.rvm/gems/ruby-2.3.1/gems/fog-xml-0.1.2/lib/fog/xml/sax_parser_connection.rb:35:in `request'
from /Users/steven/.rvm/gems/ruby-2.3.1/gems/fog-xml-0.1.2/lib/fog/xml/connection.rb:7:in `request'
from /Users/steven/.rvm/gems/ruby-2.3.1/gems/fog-aws-0.8.1/lib/fog/aws/compute.rb:525:in `_request'
from /Users/steven/.rvm/gems/ruby-2.3.1/gems/fog-aws-0.8.1/lib/fog/aws/compute.rb:520:in `request'
from /Users/steven/.rvm/gems/ruby-2.3.1/gems/fog-aws-0.8.1/lib/fog/aws/requests/compute/describe_security_groups.rb:38:in `describe_security_groups'
from /Users/steven/.rvm/gems/ruby-2.3.1/gems/fog-aws-0.8.1/lib/fog/aws/models/compute/security_groups.rb:63:in `all'
from /Users/steven/.rvm/gems/ruby-2.3.1/gems/rubber-3.2.2/lib/rubber/cloud/aws/classic.rb:27:in `describe_security_groups'
from /Users/steven/.rvm/gems/ruby-2.3.1/gems/rubber-3.2.2/lib/rubber/cloud/aws/classic.rb:125:in `sync_security_groups'
from /Users/steven/.rvm/gems/ruby-2.3.1/gems/rubber-3.2.2/lib/rubber/cloud/aws/classic.rb:19:in `setup_security_groups'
from /Users/steven/.rvm/gems/ruby-2.3.1/gems/rubber-3.2.2/lib/rubber/cloud/aws/base.rb:75:in `before_create_instance'
from /Users/steven/.rvm/gems/ruby-2.3.1/gems/rubber-3.2.2/lib/rubber/thread_safe_proxy.rb:13:in `method_missing'
from /Users/steven/.rvm/gems/ruby-2.3.1/gems/rubber-3.2.2/lib/rubber/recipes/rubber/instances.rb:281:in `block in create_instance'
from /Users/steven/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
from /Users/steven/.rvm/gems/ruby-2.3.1/gems/rubber-3.2.2/lib/rubber/recipes/rubber/instances.rb:280:in `create_instance'
from /Users/steven/.rvm/gems/ruby-2.3.1/gems/rubber-3.2.2/lib/rubber/recipes/rubber/instances.rb:230:in `block (2 levels) in create_instances'
UPDATE
The following does not generate the error shown above:
require 'fog'
# create a connection
connection = Fog::Compute.new({
:provider => 'AWS',
:aws_secret_access_key => YOUR_SECRET_ACCESS_KEY,
:aws_access_key_id => YOUR_SECRET_ACCESS_KEY_ID
})
puts connection.servers.length
It returns:
#<Fog::Compute::AWS::Real:70120599372720 @connection_options={:debug_response=>true, :headers=>{"User-Agent"=>"fog/1.37.0 fog-core/1.35.0"}, :persistent=>false} @region="us-east-1" @instrumentor=nil @instrumentor_name="fog.aws.compute" @version="2014-10-01" @use_iam_profile=nil @aws_access_key_id="AKIAI3RQHDV6KBLBLUAA" @aws_credentials_expire_at=nil @signer=#<Fog::AWS::SignatureV4:0x007f8c72d58698 @region="us-east-1", @service="ec2", @aws_access_key_id="AKIAI3RQHDV6KBLBLUAA", @hmac=#<Fog::HMAC:0x007f8c72d585f8 @key="AWS4/NGjaH7giw0Gd8PtqrTPo+Y5L+AFsRDDs3NdjBYF", @digest=#<OpenSSL::Digest: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855>, @signer=#<Proc:0x007f8c72d58558@/Users/steven/.rvm/gems/ruby-2.3.1/gems/fog-core-1.35.0/lib/fog/core/hmac.rb:28 (lambda)>>> @endpoint=nil @host="ec2.us-east-1.amazonaws.com" @path="/" @persistent=false @port=443 @scheme="https" @connection=#<Fog::XML::Connection:0x007f8c72d58210 @excon=#<Excon::Connection:7f8c6953f578 @data={:chunk_size=>1048576, :ciphers=>"HIGH:!SSLv2:!aNULL:!eNULL:!3DES", :connect_timeout=>60, :debug_request=>false, :debug_response=>true, :headers=>{"User-Agent"=>"fog/1.37.0 fog-core/1.35.0"}, :idempotent=>false, :instrumentor_name=>"excon", :middlewares=>[Excon::Middleware::ResponseParser, Excon::Middleware::Expects, Excon::Middleware::Idempotent, Excon::Middleware::Instrumentor, Excon::Middleware::Mock], :mock=>false, :nonblock=>true, :omit_default_port=>false, :persistent=>false, :read_timeout=>60, :retry_limit=>4, :ssl_verify_peer=>true, :tcp_nodelay=>false, :thread_safe_sockets=>true, :uri_parser=>URI, :versions=>"excon/0.45.4 (x86_64-darwin15) ruby/2.3.1", :write_timeout=>60, :host=>"ec2.us-east-1.amazonaws.com", :hostname=>"ec2.us-east-1.amazonaws.com", :path=>"/", :port=>443, :query=>nil, :scheme=>"https"} @socket_key="https://ec2.us-east-1.amazonaws.com:443">>>