Giter Site home page Giter Site logo

jungle-explorer's Introduction

jungle-explorer

Name

I had to call it something. *shrug*

Build Status: CircleCI

Purpose

Micro service to return information about EC2 Auto Scaling groups and their Launch Configs.

It's more of a record of the author's exploration of the AWS API than anything else. If this was to be used in anger, I'd like to make it a little less crude and not rely on things like user_data to launch the service. If the launch and the app weren't baked into the AMI itself, we'd have to account for start/stop/restart of the service without nuking the instance entirely.

Usage

Clone repo

git clone [email protected]:nikogura/jungle-explorer.git

CD into the repo

cd jungle-explorer

Install prereqs. Either of the following will work:

pip install -r requirements.txt

Or

pip install -e .

Write Credentials File

AWS uses a credentials file at the path ~/.aws/credentials

It's content looks like this:

[default]
aws_access_key_id=<some key>
aws_secret_access_key=<some other key>

You'll need to work up a file that fits your access and security needs or nothing is going to work for you.

The file is expected to be in the same directory as jungle.py, and will get pushed to the service VM in /home//.aws/credentials where the AWS API will find it and do it's thing.

Edit the Config with your favorite editor

See 'Configuration Reference' below

vi jungle.py

Create the Service VMs

python jungle.py -a create

Command will output the hostname of the service.

Provision Service VM

Wait a couple minutes for the VM to wake up. VM needs to be up, and this takes a couple minutes.

This will send your secrets to the VM. This is very crude, for demonstration purposes.

python jungle.py -a provision

Needs better handling, but honestly, this whole secret provisioning system is such a hack that there's no point in polishing a turd. In reality, we'd use a real secret provisioning system like Vault. This is just a hack.

Use Service

Hit the service any way you please

curl -i <hostname>:5000

Get Status of Service

python jungle.py 

Destroy Service

python jungle.py -a destroy

Configuration Reference

Near the top of 'jungle.py' you'll see some configuration options. You'll have to modify them for your own usage. Inside you'll see my defaults.

  • security_group_id This is the security group id you're creating instances under (Required to allow access to the service, and the user-data that starts the service) The default in the script is mine. Your setup will be different.

At a minimum you'll need to enable inbound access on the following:

22
5000
80
443

80 and 443 are needed by the cloud-init feature to enable user_data. 22 is for SSH, and 5000 is the service itself.

  • region aws region

  • app_name The service name. Used to tag instances. Instances are destroyed via this name, so choose it wisely.

  • image AMI image for this service to use (must be RH derived)

  • user User on the VM to run the service as

  • credential_file_name The name of your credentials file

  • flavor The name of the size/power/base config of VM to create.

  • test_key_name The name of the SSH Key in AWS

  • test_key_file_name The name of the SSH Key file stored locally

  • requirements_url The URL for the requirements file for running this script

  • script_url The URL location of jungle.py

  • deploy_tag The tag linking the Autoscaling Group to the Launch Config

jungle-explorer's People

Contributors

nikogura avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.