有人可以解釋AWS Java SDK如何確定它是默認終端嗎?AWS java SDK如何確定其默認區域
AmazonEC2Client client = new AmazonEC2Client(...);
// If this method is not called, how does it know where to connect?
client.setEndpoint("ec2.us-west-2.amazonaws.com");
有人可以解釋AWS Java SDK如何確定它是默認終端嗎?AWS java SDK如何確定其默認區域
AmazonEC2Client client = new AmazonEC2Client(...);
// If this method is not called, how does it know where to connect?
client.setEndpoint("ec2.us-west-2.amazonaws.com");
它並不決定任何事情,所有API的SDK的默認終點都是我們自己的東西。
適用於所有客戶端的適用於Java的AWS開發工具包默認爲us-east-1。
有很多偉大的信息在默認以及如何選擇在AWS SDK的Java開發人員指南不同的區域: http://docs.aws.amazon.com/AWSSdkDocsJava/latest/DeveloperGuide/java-dg-region-selection.html
AmazonEC2 ec2 = AmazonEC2ClientBuilder.defaultClient();
DescribeAvailabilityZonesResult zones = ec2.describeAvailabilityZones();
AvailabilityZone zone = zones.getAvailabilityZones().get(0);
String currentRegion = zone.getRegionName();