title: The security token included in the request is invalid. (Aws::Route53::Errors::ExpiredToken)
body: <p>I'm getting this error "The security token included in the request is invalid" when trying to get hosted zones list from Route53 using AWS Ruby SDK. Here is the full trace :</p>
  
  <pre><code>/Users/dineshvenkat/.rvm/gems/ruby-2.3.7@test/gems/aws-sdk-core-3.59.0/lib/seahorse/client/plugins/raise_response_errors.rb:15:in `call': The security token included in the request is expired (Aws::Route53::Errors::ExpiredToken)
      from /Users/dineshvenkat/.rvm/gems/ruby-2.3.7@test/gems/aws-sdk-core-3.59.0/lib/aws-sdk-core/plugins/jsonvalue_converter.rb:20:in `call'
      from /Users/dineshvenkat/.rvm/gems/ruby-2.3.7@test/gems/aws-sdk-core-3.59.0/lib/aws-sdk-core/plugins/idempotency_token.rb:17:in `call'
      from /Users/dineshvenkat/.rvm/gems/ruby-2.3.7@test/gems/aws-sdk-core-3.59.0/lib/aws-sdk-core/plugins/param_converter.rb:24:in `call'
  </code></pre>
  
  <p><strong>What I have done in my code ? :</strong>
  I have credentials file in which I will have multiple aws account credentials with their profile name. Now i will configure each and every profile credentials and gather their hosted zones.</p>
  
  <p><strong>My ruby file is :</strong></p>
  
  <pre><code>// Reads the credentials file and gets all the profile names
  File.open('/credentials_file', "r") do |file_data|
    file_data.each_line do |line|
      profile_name = line[/\[(.*?)\]/, 1]
      all_profiles &lt;&lt; profile_name if profile_name
    end
  end
  
  // Loops each profile and gets 
  all_profiles.each do |each_profile_name|
    credentials = Aws::SharedCredentials.new(profile_name: each_profile_name)
    Aws.config.update({
     region: 'us-east-1',
     credentials: credentials
    })
    route53 = Aws::Route53::Client.new
  
    // Gets first 100 hosted zones
    response = route53.list_hosted_zones_by_name()
  
    // Do something with the response
    process(response)
  
    // checks whether there is more hosted zones and retrieves them ( Basically pagination )
    while response.is_truncated do
      response = route53.list_hosted_zones_by_name(dns_name: response.next_dns_name, hosted_zone_id: response.next_hosted_zone_id)
      // Do something with the response
      process(response)
    end
  end
  </code></pre>
  
  <p><strong>Problem :</strong>
  My credentials gets expired after 1 hour of creation. So when my process takes more than 1 hour I get <code>Aws::Route53::Errors::ExpiredToken</code> error.</p>
  
  <p><strong>My question :</strong> 
  How can I overcome this ? What is the solution that you would suggest to prevent the credentials from getting expired until my process gets completed.</p>
  
  <p>I have come across the concept of refreshing credentials but i have no idea on how to implement it. </p>
  
  <p>Please provide a feasible solution</p>