2013-04-02 53 views
1

有人可以解釋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"); 

回答

2

它並不決定任何事情,所有API的SDK的默認終點都是我們自己的東西。

0
AmazonEC2 ec2 = AmazonEC2ClientBuilder.defaultClient(); 
DescribeAvailabilityZonesResult zones = ec2.describeAvailabilityZones(); 
AvailabilityZone zone = zones.getAvailabilityZones().get(0); 
String currentRegion = zone.getRegionName();