本文整理匯總了Java中com.amazonaws.services.ec2.AmazonEC2.setRegion方法的典型用法代碼示例。如果您正苦於以下問題:Java AmazonEC2.setRegion方法的具體用法?Java AmazonEC2.setRegion怎麽用?Java AmazonEC2.setRegion使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.amazonaws.services.ec2.AmazonEC2
的用法示例。
在下文中一共展示了AmazonEC2.setRegion方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: main
import com.amazonaws.services.ec2.AmazonEC2; //導入方法依賴的package包/類
public static void main(String... args) throws IOException {
AWSCredentialsProvider credentials = CredentialsUtils.getAwsCredentials();
AmazonS3 storage = new AmazonS3Client(credentials);
storage.setRegion(Region.getRegion(Regions.EU_WEST_1));
AmazonSQS queue = new AmazonSQSClient(credentials);
queue.setRegion(Region.getRegion(Regions.EU_WEST_1));
AmazonEC2 machines = new AmazonEC2Client(credentials);
machines.setRegion(Region.getRegion(Regions.EU_WEST_1));
AmazonIdentityManagement identityManagement = new AmazonIdentityManagementClient(credentials);
identityManagement.setRegion(Region.getRegion(Regions.EU_WEST_1));
if ("launch".equals(args[0])) {
setup(storage, queue, machines, identityManagement);
manageAnswers(queue);
} else if ("run".equals(args[0])) {
run(storage, queue);
} else {
System.out.println("Huh hoh! Don't know what you intended to do...");
}
}
示例2: readResolve
import com.amazonaws.services.ec2.AmazonEC2; //導入方法依賴的package包/類
protected Object readResolve() {
_filters = parseFilters(_filterString);
_amazonEC2 = newArrayList();
for (Region region : parseRegions(_regionString)) {
AmazonEC2 ec2 = new AmazonEC2Client();
ec2.setRegion(region);
LOG.log(FINER, "Region enabled: {0}", region);
_amazonEC2.add(ec2);
}
return this;
}
示例3: findClient
import com.amazonaws.services.ec2.AmazonEC2; //導入方法依賴的package包/類
private AmazonEC2 findClient(Account account, Region region) {
// TODO: need to config client config parameter. ignore it for now.
// TODO: need a cached version based on account and region as key
AWSCredentials credential = new BasicAWSCredentials(account.getAccessKeyId(), account.getSecretAccessKey());
AmazonEC2 ec2 = new AmazonEC2Client(credential);
ec2.setRegion(com.amazonaws.regions.Region.getRegion(region.getRegions()));
return ec2;
}
示例4: ec2
import com.amazonaws.services.ec2.AmazonEC2; //導入方法依賴的package包/類
@Bean
public AmazonEC2 ec2() {
final AmazonEC2 client = new AmazonEC2Client();
client.setRegion(region);
return client;
}
示例5: getEc2
import com.amazonaws.services.ec2.AmazonEC2; //導入方法依賴的package包/類
public static AmazonEC2 getEc2() {
AmazonEC2 ec2 = new AmazonEC2Client(ConfigProvider.getCredential());
ec2.setRegion(ConfigProvider.getDefaultRegion());
return ec2;
}