Do we need internet connectivity to use AWS Java SDK from within an instance in AWS ?
I have an instance running inside a VPC to which I haven't assigned any public IP address.
From what my initial investigation found out, I see that to run AWS Java SDK based Java programs from this instance in Amazon, the instance needs to have internet connectivity.
Running the sample program AwsConsoleApp that comes with AWS Java SDK, I saw following error:
[javac] /home/ubuntu/aws-java-sdk-1.8.9.1/samples/AwsConsoleApp/build.xml:12: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds [java] =========================================== [java] Welcome to the AWS Java SDK! [java] ===========================================
[java] Sep 09, 2014 9:26:49 PM com.amazonaws.http.AmazonHttpClient executeHelper
[java] INFO: Unable to execute HTTP request: Connect to ec2.us-east-1.amazonaws.com:443 timed out
[java] org.apache.http.conn.ConnectTimeoutException: Connect to ec2.us-east-1.amazonaws.com:443 timed out
[java] at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:551)
[java] at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:180)
[java] at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:294)
[java] at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:645)
[java] at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:480)
[java] at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
[java] at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805)
[java] at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:464)
[java] at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:273)
[java] at com.amazonaws.services.ec2.AmazonEC2Client.invoke(AmazonEC2Client.java:9320)
[java] at com.amazonaws.services.ec2.AmazonEC2Client.describeAvailabilityZones(AmazonEC2Client.java:359)
[java] at com.amazonaws.services.ec2.AmazonEC2Client.describeAvailabilityZones(AmazonEC2Client.java:8045)
[java] at AwsConsoleApp.main(Unknown Source)
[java]
I found this contrary to how Amazon provides Access to their EC2Metadata Service.
Is there any way I can run these Java programs without providing the AWS instance public IP ?