title: Cannot connect from EC2 to S3
body: <p>I am trying to connect to S3 from EC2 instance using AmazonS3Client, to get the list of objects present in S3 bucket. While I can connect to S3 when running this code from my local machine, I am having a hard time running the same code on EC2. </p>
  
  <p><strong>Am I missing any setting or configuration on EC2 instance?</strong></p>
  
  <p><strong>Code</strong></p>
  
  <pre><code>AWSCredentials credentials = new BasicAWSCredentials("XXXX", "YYYY");
  
  AmazonS3Client conn = new AmazonS3Client(credentials);
  
  String bucketName = "s3-xyz";
  
  String prefix = "123";
  
  ObjectListing objects = conn.listObjects(bucketName, prefix);
  
  List&lt;S3ObjectSummary&gt; objectSummary = objects.getObjectSummaries();
  
  for(S3ObjectSummary os : objectSummary)
  {
          System.out.println(os.getKey());
  }
  </code></pre>
  
  <p><strong>Errors</strong></p>
  
  <pre><code>ERROR com.amazonaws.http.AmazonHttpClient  - Unable to execute HTTP request: Connect to s3-xyz.amazonaws.com:443 timed out
      org.apache.http.conn.ConnectTimeoutException: Connect to s3-xyz.s3.amazonaws.com:443 timed out
      at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:551)
      at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:180)
      at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:294)
      at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:640)
      at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:479)
      at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
      at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805)
      at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:784)
      at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:318)
      at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:202)
      at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:3037)
      at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:3008)
      at com.amazonaws.services.s3.AmazonS3Client.listObjects(AmazonS3Client.java:531)
      at com.amazonaws.services.s3.AmazonS3Client.listObjects(AmazonS3Client.java:515)  
  </code></pre>