Seahorse::Client::NetworkingError: Connection refused - connect(2) for "localhost" port 8000
<p>I am building a rails application and I use dynamodb (using dynamoid) as the database. For testing, I use dynamodb-local.</p>

<p>When I get into the test database from command line , I get the following error.</p>

<blockquote>
  <p>Seahorse::Client::NetworkingError: Connection refused - connect(2) for
  "localhost" port 8000</p>
</blockquote>

<p><strong>config/initializers/dynamoid.rb</strong></p>

<pre><code>AWS_CONFIG = YAML.load_file("#{Rails.root}/config/aws.yml")[Rails.env]

Dynamoid.configure do |config|
  config.adapter = 'aws_sdk_v2' 
  config.namespace = AWS_CONFIG['namespace']
  config.warn_on_scan = false # Output a warning to the logger when you perform a scan rather than a query on a table.
  config.read_capacity = 5 # Read capacity for tables, setting low
  config.write_capacity = 5 # Write capacity for your tables
end


if Rails.env.test? || ENV['ASSET_PRECOMPILE'].present?
  p "Comes here"
  Aws.config[:ssl_verify_peer] = false
    Aws.config.update({
      credentials: Aws::Credentials.new('xxx','xxx'),
      endpoint: 'https://localhost:8000',
      region: 'us-west-2'
      })
</code></pre>

<p>Rakefile:</p>

<pre><code> task :start_test_dynamo do
  FileUtils.cd('rails-root') do
    sh "rake dynamodb:local:test:start"
    sh "rake dynamodb:seed"
  end
 end
</code></pre>