package org.ut.cmldep.amazon.request;

import com.amazonaws.auth.PropertiesCredentials;
import com.amazonaws.services.ec2.AmazonEC2Client;

import java.io.IOException;
import java.io.InputStream;

public class AWSClients {
	
	public static PropertiesCredentials getProperties(){
		
		PropertiesCredentials credentials = null;
		try{
			InputStream inputStream = AWSClients.class.getResourceAsStream("AwsCredentials.properties");
			credentials = new PropertiesCredentials(inputStream);
		}catch(IOException ioex){
			System.out.println("Credentials were not properly entered into AwsCredentials.properties.");
			System.out.println(ioex.getMessage());
		    System.exit(-1);
		}
		 
		 return credentials;
	}
	
	public static AmazonEC2Client getEC2Client(){
		return new AmazonEC2Client(getProperties());
	}

}
