diff --git a/grails-app/conf/BootStrap.groovy b/grails-app/conf/BootStrap.groovy index 44e978bf..e943033c 100644 --- a/grails-app/conf/BootStrap.groovy +++ b/grails-app/conf/BootStrap.groovy @@ -23,7 +23,7 @@ import org.slf4j.LoggerFactory import com.netflix.ice.common.IceOptions import com.netflix.ice.processor.ReservationCapacityPoller import com.amazonaws.auth.AWSCredentialsProvider -import com.amazonaws.auth.InstanceProfileCredentialsProvider +import com.amazonaws.auth.DefaultAWSCredentialsProviderChain import com.netflix.ice.basic.BasicAccountService import com.google.common.collect.Lists import com.netflix.ice.tag.Account @@ -75,7 +75,7 @@ class BootStrap { AWSCredentialsProvider credentialsProvider; if (StringUtils.isEmpty(System.getProperty("ice.s3AccessKeyId")) || StringUtils.isEmpty(System.getProperty("ice.s3SecretKey"))) - credentialsProvider = new InstanceProfileCredentialsProvider(); + credentialsProvider = new DefaultAWSCredentialsProviderChain(); else credentialsProvider = new AWSCredentialsProvider() { public AWSCredentials getCredentials() { diff --git a/grails-app/conf/BuildConfig.groovy b/grails-app/conf/BuildConfig.groovy index 6657505a..6742c2ba 100644 --- a/grails-app/conf/BuildConfig.groovy +++ b/grails-app/conf/BuildConfig.groovy @@ -66,12 +66,12 @@ grails.project.dependency.resolution = { compile( // Amazon Web Services programmatic interface - 'com.amazonaws:aws-java-sdk:1.9.12', + 'com.amazonaws:aws-java-sdk:1.11.116', // Transitive dependencies of aws-java-sdk, but also used directly. // It would be great if we could upgrade httpcore and httpclient, but we can't until the AWS Java SDK // upgrades its dependencies. If we simply upgrade these, then some Amazon calls fail. - 'org.apache.httpcomponents:httpcore:4.2', - 'org.apache.httpcomponents:httpclient:4.2', + 'org.apache.httpcomponents:httpcore:4.4.6', + 'org.apache.httpcomponents:httpclient:4.5.3', // Explicitly including aws-java-sdk transitive dependencies 'org.codehaus.jackson:jackson-core-asl:1.8.9', diff --git a/src/java/com/netflix/ice/basic/BasicReservationService.java b/src/java/com/netflix/ice/basic/BasicReservationService.java index 5c92b649..99c794eb 100644 --- a/src/java/com/netflix/ice/basic/BasicReservationService.java +++ b/src/java/com/netflix/ice/basic/BasicReservationService.java @@ -139,7 +139,8 @@ private void pollAPI() throws Exception { long currentTime = new DateMidnight().getMillis(); DescribeReservedInstancesOfferingsRequest req = new DescribeReservedInstancesOfferingsRequest() - .withFilters(new com.amazonaws.services.ec2.model.Filter().withName("marketplace").withValues("false")); + .withFilters(new com.amazonaws.services.ec2.model.Filter().withName("marketplace").withValues("false")) + .withFilters(new com.amazonaws.services.ec2.model.Filter().withName("scope").withValues("Availability Zone")); String token = null; boolean hasNewPrice = false; AmazonEC2Client ec2Client = new AmazonEC2Client(AwsUtils.awsCredentialsProvider, AwsUtils.clientConfig); @@ -153,7 +154,9 @@ private void pollAPI() throws Exception { token = offers.getNextToken(); for (ReservedInstancesOffering offer: offers.getReservedInstancesOfferings()) { - if (offer.getProductDescription().indexOf("Amazon VPC") >= 0) + if (offer.getProductDescription().indexOf("Amazon VPC") < 0) + continue; + if (offer.getInstanceTenancy().indexOf("default") == -1) continue; ReservationUtilization utilization = ReservationUtilization.get(offer.getOfferingType()); Ec2InstanceReservationPrice.ReservationPeriod term = offer.getDuration() / 24 / 3600 > 366 ? diff --git a/src/java/com/netflix/ice/basic/EddaResourceService.java b/src/java/com/netflix/ice/basic/EddaResourceService.java index 8b73e92d..28ab768b 100644 --- a/src/java/com/netflix/ice/basic/EddaResourceService.java +++ b/src/java/com/netflix/ice/basic/EddaResourceService.java @@ -13,9 +13,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.amazonaws.util.json.JSONArray; -import com.amazonaws.util.json.JSONException; -import com.amazonaws.util.json.JSONObject; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; import com.google.common.collect.Lists; import com.netflix.ice.common.ResourceService; import com.netflix.ice.tag.Account; diff --git a/src/test/com/netflix/ice/basic/EddaResourceServiceTest.java b/src/test/com/netflix/ice/basic/EddaResourceServiceTest.java index 47e0ddfc..3d90c61e 100644 --- a/src/test/com/netflix/ice/basic/EddaResourceServiceTest.java +++ b/src/test/com/netflix/ice/basic/EddaResourceServiceTest.java @@ -6,7 +6,7 @@ import org.junit.Test; -import com.amazonaws.util.json.JSONArray; +import org.json.JSONArray; import com.netflix.ice.tag.Product;