Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changes to support running on amazon ecs #244

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions grails-app/conf/BootStrap.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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() {
Expand Down
6 changes: 3 additions & 3 deletions grails-app/conf/BuildConfig.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
7 changes: 5 additions & 2 deletions src/java/com/netflix/ice/basic/BasicReservationService.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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 ?
Expand Down
6 changes: 3 additions & 3 deletions src/java/com/netflix/ice/basic/EddaResourceService.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import org.junit.Test;

import com.amazonaws.util.json.JSONArray;
import org.json.JSONArray;
import com.netflix.ice.tag.Product;


Expand Down