List of usage examples for com.amazonaws.services.ec2 AmazonEC2Client AmazonEC2Client
@Deprecated
public AmazonEC2Client()
From source file:com.axemblr.yab.YaB.java
License:Apache License
/** * Constructs a new YaB client by fetching credentials in this order: * <p>//from w ww. j ava2 s .c o m * - Environment Variables - AWS_ACCESS_KEY_ID and AWS_SECRET_KEY * - Java System Properties - aws.accessKeyId and aws.secretKey * - Instance profile credentials delivered through the Amazon EC2 metadata service * </p> */ public static YaB createWithEnvironmentCredentials(String region) { AmazonEC2Client client = new AmazonEC2Client(); boolean regionFound = false; DescribeRegionsResult result = client.describeRegions(); for (Region candidate : result.getRegions()) { if (candidate.getRegionName().equals(region)) { client.setEndpoint(candidate.getEndpoint()); regionFound = true; break; } } if (!regionFound) { throw new IllegalArgumentException("No region found with this name: " + region); } return new YaB(client); }
From source file:com.bodybuilding.turbine.discovery.AsgTagInstanceDiscovery.java
License:Apache License
public AsgTagInstanceDiscovery() { this(new AmazonAutoScalingClient(), new AmazonEC2Client()); }
From source file:com.bodybuilding.turbine.discovery.Ec2TagInstanceDiscovery.java
License:Apache License
public Ec2TagInstanceDiscovery() { this(new AmazonEC2Client()); }
From source file:com.dowdandassociates.gentoo.bootstrap.DefaultAmazonEC2Provider.java
License:Apache License
public AmazonEC2 get() { AmazonEC2 ec2Client = new AmazonEC2Client(); ec2Client.setEndpoint(endpoint.get()); return ec2Client; }
From source file:com.kenlin.awsec2offering.App.java
License:Open Source License
public App() { // e.g., C:\apache-tomcat-7.0.42\bin\setenv.bat // set "JRE_HOME=%ProgramFiles%\Java\jre6" // set "JAVA_HOME=%ProgramFiles%\Java\jre6" // set "AWS_ACCESS_KEY_ID=xxx" // set "AWS_SECRET_KEY=xxxxxxxxx" // exit /b 01 ec2 = new AmazonEC2Client(); // 1) Env var, 2) Java system prop, 3) EC2 metadata mapper = new ObjectMapper(); }
From source file:com.kixeye.chassis.bootstrap.aws.ServerInstanceContext.java
License:Apache License
private ServerInstanceContext() { amazonElasticLoadBalancing = new AmazonElasticLoadBalancingClient(); amazonEC2 = new AmazonEC2Client(); ec2MetadataClient = new Ec2MetadataClient() { @Override//from w w w. j a v a 2s . c o m public String getAvailabilityZone() { return EC2MetadataUtils.getAvailabilityZone(); } @Override public String getInstanceId() { return EC2MetadataUtils.getInstanceId(); } @Override public String getUserData() { return EC2MetadataUtils.getUserData(); } @Override public String getPrivateIpAddress() { return EC2MetadataUtils.getPrivateIpAddress(); } @Override public String getPublicIpAddress() { for (EC2MetadataUtils.NetworkInterface net : EC2MetadataUtils.getNetworkInterfaces()) { List<String> ips = net.getPublicIPv4s(); if (ips != null && ips.size() > 0) { return ips.get(0); } } return null; } }; init(); }
From source file:com.netflix.simianarmy.client.aws.AWSClient.java
License:Apache License
/** * Amazon EC2 client. Abstracted to aid testing. * * @return the Amazon EC2 client/*from w ww .j a v a2 s. co m*/ */ protected AmazonEC2 ec2Client() { AmazonEC2 client; if (awsCredentialsProvider == null) { client = new AmazonEC2Client(); } else { client = new AmazonEC2Client(awsCredentialsProvider); } client.setEndpoint("ec2." + region + ".amazonaws.com"); return client; }
From source file:com.netflix.turbine.discovery.AwsUtil.java
License:Apache License
public AwsUtil() { asgClient = new AmazonAutoScalingClient(); ec2Client = new AmazonEC2Client(); String endpoint = "autoscaling." + DynamicPropertyFactory.getInstance().getStringProperty("turbine.region", "us-east-1").get() + ".amazonaws.com"; asgClient.setEndpoint(endpoint);//from www .j ava 2 s . c o m logger.debug("Set the asgClient endpoint to [{}]", endpoint); }
From source file:com.vb.aws.services.compute.ec2.EC2UtilsImpl.java
/** * Default constructor.//w w w. java 2 s .c o m */ public EC2UtilsImpl() { this.amazonEc2 = new AmazonEC2Client(); this.amazonElasticLoadBalancing = new AmazonElasticLoadBalancingClient(); }
From source file:com.vb.aws.services.compute.ec2.EC2UtilsImpl.java
/** * Parameterized constructor. Pass the AWS Region as parameter. * @param region //from ww w .j a va2s. c o m */ public EC2UtilsImpl(Regions region) { this.amazonEc2 = new AmazonEC2Client(); this.amazonElasticLoadBalancing = new AmazonElasticLoadBalancingClient(); }