Skip to content
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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ Using basic setup, you don't need any extra code change and you will use the pro
ice.work_s3bucketname=work_s3bucketname
ice.work_s3bucketprefix=work_s3bucketprefix/

1.4 If running locally, set the following system properties at runtime. ice.s3AccessToken is optional.
1.4 If running from locally - "./grailsw runApp" or a .war in local Tomcat instance, set the following properties in ice.properties OR define them on the command line with "-Dice.s3AccessKey=accessKey", etc. Command-line definitions take precedence over the ice.properties definitions.

ice.s3AccessKeyId=<accessKeyId>
ice.s3SecretKey=<secretKey>
ice.s3AccessToken=<accessToken>

If running on a ec2 instance and you want to use the credentials in the instance metadata, you can leave the above properties unset.
If running on a ec2 instance and you want to use the credentials in the instance metadata, you must leave the above properties unset.

1.5 In ice.properties, specify the start time in millis for the processor to start processing billing files. For example, if you want to start processing billing files from April 1, 2013. If this property is not set, Ice will set startmillis to be the beginning of current month.

Expand Down
75 changes: 55 additions & 20 deletions grails-app/conf/BootStrap.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -74,29 +74,64 @@ class BootStrap {

AWSCredentialsProvider credentialsProvider;

if (StringUtils.isEmpty(System.getProperty("ice.s3AccessKeyId")) || StringUtils.isEmpty(System.getProperty("ice.s3SecretKey")))
if (StringUtils.isEmpty(System.getProperty("ice.s3SecretKey")) &&
StringUtils.isEmpty(prop.getProperty("ice.s3SecretKey")) &&
StringUtils.isEmpty(System.getProperty("ice.s3AccessKeyId")) &&
StringUtils.isEmpty(prop.getProperty("ice.s3SecretKey"))
) { /* No credentials supplied? Use instance profile credentials */
credentialsProvider = new InstanceProfileCredentialsProvider();
else
}
else {
credentialsProvider = new AWSCredentialsProvider() {
public AWSCredentials getCredentials() {
if (StringUtils.isEmpty(System.getProperty("ice.s3AccessToken")))
return new AWSCredentials() {
public String getAWSAccessKeyId() {
return System.getProperty("ice.s3AccessKeyId");
}

public String getAWSSecretKey() {
return System.getProperty("ice.s3SecretKey");
}
};
else
return new BasicSessionCredentials(System.getProperty("ice.s3AccessKeyId"), System.getProperty("ice.s3SecretKey"),
System.getProperty("ice.s3AccessToken"));
}

public void refresh() {
}
};
// First - we were not given a token
if ( StringUtils.isEmpty(System.getProperty("ice.s3AccessToken")) &&
StringUtils.isEmpty(prop.getProperty("ice.s3AccessToken"))
) {
if (
StringUtils.isNotEmpty(System.getProperty("ice.s3SecretKey")) &&
StringUtils.isNotEmpty(System.getProperty("ice.s3AccessKeyId"))
) { /* Command line (System.properties used */
return new AWSCredentials() {
public String getAWSAccessKeyId() {
return System.getProperty("ice.s3AccessKeyId");
}

public String getAWSSecretKey() {
return System.getProperty("ice.s3SecretKey");
}
};
} else { /* System properties were empty, check ICE_HOME */
return new AWSCredentials() {
public String getAWSAccessKeyId() {
return prop.getProperty("ice.s3AccessKeyId");
}

public String getAWSSecretKey() {
return prop.getProperty("ice.s3SecretKey");
}
};
}
}
else { /* Token _was_ given */
if (
StringUtils.isNotEmpty(System.getProperty("ice.s3SecretKey")) &&
StringUtils.isNotEmpty(System.getProperty("ice.s3AccessKeyId"))
) { /* Command line (System.properties used */
return new BasicSessionCredentials(System.getProperty("ice.s3AccessKeyId"), System.getProperty("ice.s3SecretKey"),
System.getProperty("ice.s3AccessToken"));
} else { /* Check ICE_HOME */
return new BasicSessionCredentials(prop.getProperty("ice.s3AccessKeyId"), prop.getProperty("ice.s3SecretKey"),
prop.getProperty("ice.s3AccessToken"));
}
}

} /* end getCredentials() define */
public void refresh() {
}
}; /* end provider credentials statement */
} /* end way to long if statement */


JSONConverter.register();

Expand Down
3 changes: 3 additions & 0 deletions src/java/com/netflix/ice/basic/BasicReservationService.java
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ private void pollAPI() throws Exception {
}
}
UsageType usageType = getUsageType(offer.getInstanceType(), offer.getProductDescription());
// Unknown Zone
if (Zone.getZone(offer.getAvailabilityZone()) == null)
logger.error("No Zone for " + offer.getAvailabilityZone());
hasNewPrice = setPrice(utilization, currentTime, Zone.getZone(offer.getAvailabilityZone()).region, usageType,
offer.getFixedPrice(), hourly) || hasNewPrice;

Expand Down
2 changes: 2 additions & 0 deletions src/java/com/netflix/ice/tag/Zone.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ private Zone (Region region, String name) {

public static final Zone SA_EAST_1A = new Zone(Region.SA_EAST_1, "sa-east-1a");
public static final Zone SA_EAST_1B = new Zone(Region.SA_EAST_1, "sa-east-1b");
public static final Zone SA_EAST_1C = new Zone(Region.SA_EAST_1, "sa-east-1c");

public static final Zone AP_NORTHEAST_1A = new Zone(Region.AP_NORTHEAST_1, "ap-northeast-1a");
public static final Zone AP_NORTHEAST_1B = new Zone(Region.AP_NORTHEAST_1, "ap-northeast-1b");
Expand Down Expand Up @@ -94,6 +95,7 @@ private Zone (Region region, String name) {

zonesByName.put(SA_EAST_1A.name, SA_EAST_1A);
zonesByName.put(SA_EAST_1B.name, SA_EAST_1B);
zonesByName.put(SA_EAST_1C.name, SA_EAST_1C);

zonesByName.put(AP_NORTHEAST_1A.name, AP_NORTHEAST_1A);
zonesByName.put(AP_NORTHEAST_1B.name, AP_NORTHEAST_1B);
Expand Down