Skip to content

Instantly share code, notes, and snippets.

@diegopacheco
Last active April 17, 2019 20:13
Show Gist options
  • Save diegopacheco/70285842a2a5dcb89904 to your computer and use it in GitHub Desktop.
Save diegopacheco/70285842a2a5dcb89904 to your computer and use it in GitHub Desktop.
How to Install and Run Netflix/ICE on Amazon Linux OS

Netflix/ICE

goto https://console.aws.amazon.com/s3/home?region=us-west-2#
create a bucket: awscostice
add policy more or less like this:

 { 
 	  "Version": "2008-10-17", 
 	  "Id": "Policy1335892530063", 
 	  "Statement": [ 
 		 { 
 			   "Sid": "Stmt1335892150622",
 			   "Effect": "Allow", 
 			   "Principal": { 
 				        "AWS": "arn:aws:iam::386209384616:root" 
 		    	},
 			"Action": [ 
 				"s3:GetBucketAcl", 
 				"s3:GetBucketPolicy" 
 			], 
 			"Resource": "arn:aws:s3:::awscostice" 
 		}, 
 		{ 
 			"Sid": "Stmt1335892526596", 
 			"Effect": "Allow", 
 			"Principal": { 
 				"AWS": "arn:aws:iam::386209384616:root" 
 			}, 
 			"Action": "s3:PutObject", 
 			"Resource": "arn:aws:s3:::awscostice/*" 
 		} 
 	] 
 }

Goto: https://console.aws.amazon.com/billing/home#/preferences
last checkbox: awscostice

Create EC2 Instance Amazon Linux
Install Java 8

sudo yum install -y git vim 
sudo yum remove -y java 
cd /opt 
sudo wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u45-b14/jdk-8u45-linux-x64.tar.gz"
sudo tar -xzvf jdk-8u45-linux-x64.tar.gz 
sudo rm -rf jdk-8u45-linux-x64.tar.gz

Add to ~/.bashrc and /root/.bashrc
sudo vim ~/.bashrc 
alias cls='clear' 
export JAVA_HOME=/opt/jdk1.8.0_45 
export JRE_HOME=/opt/jdk1.8.0_45/jre 
export PATH=$PATH:/opt/jdk1.8.0_45/bin:/opt/jdk1.8.0_45/jre/bin

$ source ~/.bashrc
Install Grails 2.4.4 on CentOs

cd opt/ 
sudo wget https://github.com/grails/grails-core/releases/download/v2.4.4/grails-2.4.4.zip
sudo unzip grails-2.4.4.zip
sudo rm -rf grails-2.4.4.zip

Add to ~/.bashrc and /root/.bashrc
$ sudo vim ~/.bashrc

export GRAILS_HOME=/opt/grails-2.4.4/ <BR>
export PATH=$PATH:$GRAILS_HOME/bin <BR>

source ~/.bashrc

You will need get your AWS_ACCOUNT_ID you cab get it here => https://console.aws.amazon.com/billing/home#/account them replace on the properties file where it says YOU_NEED_CHANGE_THIS_AND_PUT_YOUR_AWS_ACCOUNT_ID_HERE

Create ice.properties where you downloaded ice from github

ice.processor=true
ice.processor.localDir=/mnt/ice_processor
ice.work_s3bucketname=awscostice
ice.work_s3bucketprefix=aws
#ice.startmillis=1364774400000

ice.reader=true 
ice.reader.localDir=/mnt/ice_reader
ice.companyName=CompanyX

# s3 bucket name where the billing files are. multiple bucket names are delimited by ",". Ice must have read access to billing s3 bucket.
ice.billing_s3bucketname=awscostice

# prefix of the billing files. multiple prefixes are delimited by ","
ice.billing_s3bucketprefix=,

# specify your payer account id here if across-accounts IAM role access is used. multiple account ids are delimited by ",". "ice.billing_payerAccountId=,222222222222" means assumed role access is only used for the second bucket.
ice.billing_payerAccountId=,YOU_NEED_CHANGE_THIS_AND_PUT_YOUR_AWS_ACCOUNT_ID_HERE

# specify the assumed role name here if you use IAM role access to read from billing s3 bucket. multiple role names are delimited by ",". "ice.billing_accessRoleName=,ice" means assumed role access is only used for the second bucket.
ice.billing_accessRoleName=,ice

Create Processor/Reader folders

sudo mkdir /mnt/ice_processor
sudo mkdir /mnt/ice_reader

Get ice from github and build and run

sudo git clone https://github.com/Netflix/ice.git
cd ice/
grails wrapper
./grailsw run-app
./grailsw -Dice.s3AccessKeyId=xxx -Dice.s3SecretKey=xxx

GOTO http://HOST:8080/ice/dashboard/summary

@chicagobuss
Copy link

chicagobuss commented Jul 22, 2016

thanks for this, only things I had to change:

  • had to chown /opt/ice as my user so I could run grails wrapper
  • had to set ICE_HOME in my ~/.bashrc to /opt/ice
  • had to make ice.properties in /opt/ice, not /opt
  • had to get the permissions on my role right - Teevity/ice#80
  • had to chown /mnt/ice_* to my user so it could write there

@jerry2605
Copy link

simply ./install why need so much steps?
at last run ./grailsw -Dice.s3AccessKeyId=xxx -Dice.s3SecretKey=xxx run-app

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment