Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

stelligent/cloudpatrol_gem

Repository files navigation

CloudPatrol Ruby Gem

Ruby Gem for CloudPatrol. For information on our feature roadmap, go to the Roadmap

==============

Description

CloudPatrol lets you establish and automatically enforce team policies for your Amazon Web Services account through a Command Line Interface (CLI).

There's also a corresponding Rails web app that you can download and use here. For more information on creating new rules/tasks, see Creating a new Task/Rule in CloudPatrol.

While Ruby can be installed on many operating systems, we've included detailed instructions for installing on Ubuntu 12.04 LTS. With minor alterations, you can run these instructions for other operating systems.

Configuration of Ubuntu 12.04 LTS Instance

Since you will be using AWS EC2 to install Ubuntu, choose the Ubuntu 12.04 LTS 64-bit option when launching your EC2 instance.

Installing Rails on Ubuntu 12.04 LTS

After you've installed Ubunu, follow the instructions below.

  1. sudo apt-get update
  2. sudo apt-get -y install curl nodejs git
  3. \curl -L https://get.rvm.io | bash -s stable
  4. source ~/.rvm/scripts/rvm
  5. rvm requirements
  6. rvm install 1.9.3
  7. rvm use 1.9.3 --default
  8. rvm rubygems current

Installing CloudPatrol Gem

Now that you've intalled Ruby and other packages, you will install CloudPatrol gem on this instance.

  1. git clone https://github.com/stelligent/cloudpatrol_gem.git
  2. cd ~/cloudpatrol_gem
  3. bundle install

Example CLI Snippets

Now that you've intalled the CloudPatrol CLI, you can begin using it through the command line. There's also a Rails web app that you can download and use here.

Currently, there are four services that CloudPatrol can manage. They are cloudformation, ec2, iam and opsworks. To get a listing of all the services and options that CloudPatrol provides, type:

bundle exec bin/cloudpatrol --aws_access_key_id=ID --aws_secret_access_key=KEY cloudpatrol

To get a listing of the methods you can use for a service, enter help next to the service name. For example:

bundle exec bin/cloudpatrol --aws_access_key_id=ID --aws_secret_access_key=KEY ec2 help

Here are some code snippets to use the CloudPatrol CLI

  1. bundle exec bin/cloudpatrol --aws_access_key_id=ID --aws_secret_access_key=KEY cloudformation clean-stacks --days=2
  2. bundle exec bin/cloudpatrol --region=us-east-1 --aws_access_key_id=ID --aws_secret_access_key=KEY ec2 clean-instances --days=1
  3. bundle exec bin/cloudpatrol --aws_access_key_id=ID --aws_secret_access_key=KEY ec2 clean-security-groups
  4. bundle exec bin/cloudpatrol --aws_access_key_id=ID --aws_secret_access_key=KEY ec2 stop-instances --days=2
  5. bundle exec bin/cloudpatrol --aws_access_key_id=ID --aws_secret_access_key=KEY ec2 start-instances
  6. bundle exec bin/cloudpatrol --aws_access_key_id=ID --aws_secret_access_key=KEY iam clean-users
  7. bundle exec bin/cloudpatrol --aws_access_key_id=ID --aws_secret_access_key=KEY opsworks clean-stacks --days=2
  8. bundle exec bin/cloudpatrol --aws_access_key_id=ID --aws_secret_access_key=KEY opsworks clean-layers --days=2
  9. bundle exec bin/cloudpatrol --aws_access_key_id=ID --aws_secret_access_key=KEY opsworks clean-instances --days=2
  10. bundle exec bin/cloudpatrol --aws_access_key_id=ID --aws_secret_access_key=KEY opsworks clean-apps --days=2

LICENSE

Copyright (c) 2013 Stelligent Systems LLC

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.