<commit_before># AWS
Software to interface with AWS through easy command line inputs

*Contents:*
* [Getting started] (https://github.com/leschzinerlab/AWS#getting-started)
	* [Software dependences] (https://github.com/leschzinerlab/AWS#software-dependencies)
	* [Environment setup] (https://github.com/leschzinerlab/AWS#environment-setup)
* [Usage] (https://github.com/leschzinerlab/AWS#usage)

*Overview:*

Shortcut AWS commands found in this Github repo:

* **awshelp** - List available AWS commands from this repo

* **awsls** - List volumes and instances

* **awskill** - Terminate instance

* **awslaunch** - Boot up instance

* **aws_ebs_create** - Create EBS volume

* **aws_ebs_delete** - Delete EBS volume

* **aws_ebs_attach** - Attach EBS volume to running instance

* **aws_ebs_detach** - Detach EBS volume from instance

## Getting started

###Software dependencies 
You'll need to install *pip*, *aws cli* and *fabric*: 
* **pip**: 
	* https://pypi.python.org/pypi/pip
* **aws cli**:
	* http://docs.aws.amazon.com/cli/latest/userguide/installing.html#install-with-pip
	* <pre>$ sudo pip install awscli</pre>
* **fabric**: 
	* http://www.fabfile.org/installing.html
	* <pre>$ sudo pip install fabric</pre>

###Environment setup
For each user, you will create a hidden directory in their home directory into which you will add the aws_init.sh file and their keypair.  

* Create hidden folder: 
<pre>$ mkdir /home/[user]/.aws</pre>

* Copy aws_init.sh file & edit to include credentials

* Copy keypair into directory, making sure to modify permissions of file using <pre>chmod 600</pre>

* Add the following line to .bashrc file: 
<pre>source /home/[user]/.aws/aws_init.sh</pre>

## Usage
The underlying code is written in python and aliased to simple commands: awsls, awslaunch, awskill. 

* **awsls**
	* Lists all instances & volumes assigned to user, where user instances are assigned based upon being tagged with key pair name as the instance Owner. 
	* Example usage: 
		<pre>$ awsls
		InstanceID	Status
		-------------------------------
		i-c29e13cc	terminated
		i-c33e14dd	running
		Volume ID	Size	Avail. Zone	User		Status
		-------------------------------------------------------------------------
		vol-41ac5b95	400GB	us-east-1b	mike_virginia	in-use</pre>

* **awslaunch**
	* Command to launch instance, configuring security group into VPC automatically to only allow users IP address for incoming SSH traffic.
	* Example usage: 
		<pre>$ awslaunch
		Usage: awslaunch --instance=<instanceType>
		Options:
  		-h, --help         show this help message and exit
  		--instance=STRING  Specify instance type to launch
  		--instanceList     Flag to list available instances
  		-d                 debug</pre>
		<pre>$ awslaunch --instance=t2.micro
		Launching AWS instance t2.micro for user keyName_virginia
		Configuring security settings ...
		Booting up instance ...
		Waiting for instance to pass system checks ...
		Instance is ready! To log in:<commit_msg>Added more spot info into readme<commit_after># AWS
Software to interface with AWS through easy command line inputs

*Contents:*
* [Getting started] (https://github.com/leschzinerlab/AWS#getting-started)
	* [Software dependences] (https://github.com/leschzinerlab/AWS#software-dependencies)
	* [Environment setup] (https://github.com/leschzinerlab/AWS#environment-setup)
* [Usage] (https://github.com/leschzinerlab/AWS#usage)

*Overview:*

Shortcut AWS commands found in this Github repo:

* **awshelp** - List available AWS commands from this repo

* **awsls** - List volumes and instances

* **awskill** - Terminate instance

* **awslaunch** - Boot up instance

* **aws_ebs_create** - Create EBS volume

* **aws_ebs_delete** - Delete EBS volume

* **aws_ebs_attach** - Attach EBS volume to running instance

* **aws_ebs_detach** - Detach EBS volume from instance

## Getting started

###Software dependencies 
You'll need to install *pip*, *aws cli* and *fabric*: 
* **pip**: 
	* https://pypi.python.org/pypi/pip
* **aws cli**:
	* http://docs.aws.amazon.com/cli/latest/userguide/installing.html#install-with-pip
	* <pre>$ sudo pip install awscli</pre>
* **fabric**: 
	* http://www.fabfile.org/installing.html
	* <pre>$ sudo pip install fabric</pre>

###Environment setup
For each user, you will create a hidden directory in their home directory into which you will add the aws_init.sh file and their keypair.  

* Create hidden folder: 
<pre>$ mkdir /home/[user]/.aws</pre>

* Copy aws_init.sh file & edit to include credentials

* Copy keypair into directory, making sure to modify permissions of file using <pre>chmod 600</pre>

* Add the following line to .bashrc file: 
<pre>source /home/[user]/.aws/aws_init.sh</pre>

## Usage
The underlying code is written in python and aliased to simple commands: awsls, awslaunch, awskill. 

* **awsls**
	* Lists all instances & volumes assigned to user, where user instances are assigned based upon being tagged with key pair name as the instance Owner. 
	* Example usage: 
		<pre>$ awsls
		---------------------------------------------------------------------------------------
		ReservedInstanceType	Avail. Zone	InstanceID	Status	IP Address	User
		---------------------------------------------------------------------------------------
		No instances found
		----------------------------------------------------------------------------------------------------------------------------------------
		SpotInstanceType	Avail. Zone	SpotInstanceID	SpotStatus	InstanceID	Status		IP Address	Price	User	
		----------------------------------------------------------------------------------------------------------------------------------------
		m3.medium		us-west-2a	sir-b6dg94hn	closed		---		---		---		$0.040	mike_oregon
		----------------------------------------------------------------------------------------
		Volume ID	Avail. Zone	Size	User		Status		Instance
		----------------------------------------------------------------------------------------
		vol-169efda2	us-west-2a	400GB	mike_oregon	available	--</pre>
	
* **awslaunch**
	* Command to launch instance, configuring security group into VPC automatically to only allow users IP address for incoming SSH traffic.
	* Example usage: 
		<pre>$ awslaunch
		Usage: awslaunch --instance=<instanceType>
		Options:
  		-h, --help         show this help message and exit
  		--instance=STRING  Specify instance type to launch
  		--instanceList     Flag to list available instances
  		-d                 debug</pre>
		<pre>$ awslaunch --instance=t2.micro
		Launching AWS instance t2.micro for user keyName_virginia
		Configuring security settings ...
		Booting up instance ...
		Waiting for instance to pass system checks ...
		Instance is ready! To log in:
{'fraction_non_alphanumeric': 0.20383301143960778, 'fraction_numerical': 0.006536918734214827, 'mean_word_length': 2.4120628484541307, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 35, 'https://': 10, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4766245', 'n_tokens_mistral': 2063, 'n_tokens_neox': 1923, 'n_words': 646}