title: Amazon AWS: Failing to Login
body: <p>I've been working on an amazon EC2 project and when I login like this:</p>
  
  <pre><code>public bool Login(Credentials credentials, string ownerID, string region)
  {
      try
      {
          OwnerID = ownerID;
          CurrentCredentials = credentials;
          CurrentConfigs = new AmazonEC2Config() { RegionEndpoint = RegionEndpoint.GetBySystemName(region) };
          EC2 = AWSClientFactory.CreateAmazonEC2Client(CurrentCredentials, CurrentConfigs);
      }
      catch
      {
          return false;
      }
      return true;
  }
  </code></pre>
  
  <p>And then try to access like this:</p>
  
  <pre><code>DescribeInstancesRequest ec2Request = new DescribeInstancesRequest();
  ec2Request.InstanceIds = new List&lt;string&gt;() { id };
  DescribeInstancesResponse ec2Response = EC2.DescribeInstances(ec2Request);
  return ec2Response.Reservations[0].Instances[0];
  </code></pre>
  
  <p>I get this exception:</p>
  
  <p><strong>EXCEPTION:</strong></p>
  
  <pre><code>Encountered a WebException (NameResolutionFailure), the request cannot be retried. Either the maximum number of retries has been exceeded (4/4) or the request is using a non-seekable stream.
  </code></pre>
  
  <p><strong>STACK TRACE:</strong></p>
  
  <pre><code>at Amazon.Runtime.AmazonWebServiceClient.HandleHttpWebErrorResponse(AsyncResult asyncResult, WebException we)
  at Amazon.Runtime.AmazonWebServiceClient.getRequestStreamCallback(IAsyncResult result)
  at Amazon.Runtime.AmazonWebServiceClient.endOperation[T](IAsyncResult result)
  at Amazon.EC2.AmazonEC2Client.DescribeInstances(DescribeInstancesRequest describeInstancesRequest)
  at ...
  </code></pre>
  
  <p><strong>EDIT:</strong></p>
  
  <p>This exception's inner exception is:</p>
  
  <pre><code>The remote name could not be resolved: 'ec2.sa-east-1a.amazonaws.com'
  </code></pre>
  
  <p><em>It's important to point out that it only gives me this error when the access is to region <strong>sa-east-1a</strong>. Another account I have in region <strong>us-west-2</strong> works perfectly. Also, I have extracted the Credential and Region information from the web.config</em></p>