我们需要互联网连接到AWS实例内使用AWS的Java SDK?
我有一个实例的VPC中运行,而我还没有分配任何公共IP地址。
从什么我的初步调查发现,我看到从这个例子在亚马逊上运行的基于AWS Java SDK的Java程序,实例需要有互联网连接。
运行示例程序AwsConsoleApp随AWS Java SDK中,我看到了以下错误:
[javac的] /home/ubuntu/aws-java-sdk-1.8.9.1/samples/AwsConsoleApp/build.xml:12:警告: 'includeantruntime' 没有设置,默认为build.sysclasspath =最后; 设置为false重复构建【JAVA] ========================================= ==【JAVA]欢迎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]
我发现这违背了亚马逊如何提供访问其EC2Metadata服务。
有没有什么办法可以不提供的AWS实例公共IP运行这些Java程序?