Git Product home page Git Product logo

awless's Introduction

Build Status Go Report Card

terminal icon awless is a powerful, innovative and small surface command line interface (CLI) to manage Amazon Web Services.

Twitter | Wiki | Changelog

Why awless

awless stands out by having the following characteristics:

  • small and hierarchical set of commands
  • a simple/powerful text templating language to create and revert fully-fledged infrastructures
  • wrapping/composing AWS API calls when necessary to enrich behaviour. Ex: ensure smart defaults, security best practices, etc.
  • local log of all your cloud modifications done through awless to list/revert past actions
  • sync to a local graph storage of your cloud representation
  • exploration of your cloud infrastructure and resources interrelations, even offline using the local graph storage
  • clearer and flexible terminal output's with: numerous formats (machine/human friendly), enriched resources's properties/relations when feasible
  • connect easily using awless' smart SSH to your private & public instances

For more read our FAQ below (how awless compares to other tools, etc.)

Install

Choose one of the following options:

  1. On macOS, use homebrew: brew tap wallix/awless; brew install awless
  2. With curl (macOS/Linux), run: curl https://raw.githubusercontent.com/wallix/awless/master/getawless.sh | bash
  3. Download the latest awless binaries (Windows/Linux/macOS) from Github
  4. If you have Golang already installed, install from the source with: go get -u github.com/wallix/awless

If you have previously used the AWS CLI or aws-shell, you don't need to configure anything! Your config will be automatically loaded (i.e. ~/.aws/{credentials,config}) and awless will prompt for any missing info (more at our getting started).

Main features

video of a few awless commands
Note that the video above is in APNG and requires a recent browser.

  • Aliasing of resources through their natural name so you don't have to always use cryptic ids that are impossible to remember

  • awless show : Explore the properties, relations, dependencies of a specific resource (even offline thanks to the sync) given only a name (or id/arn).

    $ awless show jsmith --local
    
  • awless list : Clear and easy listing of multi-region cloud resources (subnets, instances, users, buckets, records, etc.) on AWS EC2, IAM, S3, RDS, AutoScaling, SNS, SQS, Route53, CloudWatch, CloudFormation, Lambda, etc. Listing filters via resources properties or resources tags.

    $ awless list instances --sort uptime --local
    $ awless list users --format csv --columns name,created
    $ awless list volumes --filter state=use --filter type=gp2
    $ awless list volumes --tag-value Purchased
    $ awless ls vpcs --tag-key Dept --tag-key Internal --format tsv
    $ awless ls instances --tag Env=Production,Dept=Marketing
    $ awless ls instances --filter state=running,type=micro --format json
    $ awless ls s3objects --filter bucket=pdf-bucket -r us-west-2
    $ ...
    (see awless ls -h)
    
  • awless run : Create, update and delete complex infrastructures with smart defaults and sound auto-complete through awless templates.

    $ awless run ~/templates/my-infra.aws
    $ awless run https://raw.githubusercontent.com/wallix/awless-templates/master/linux_bastion.aws
    etc.
    
  • Hundreds of powerful CRUD CLI one-liners integrated in the awless templating engine:

    $ awless create instance -h
    $ awless create vpc -h
    $ awless attach policy -h
    $ ...
    (see awless -h)
    
  • awless log : Detailled and easy reporting of all the CLI template executions

  • awless revert : Revert of executed templates and resources creation

  • Create instances straight from a distro name. No need to know the region or AMI ;) (free tier community bare distro only, see awless create instance -h)

    $ awless create instance distro=debian
    $ awless create instance distro=coreos
    $ awless create instance distro=redhat::7.2 type=t2.micro
    $ awless create instance distro=debian:debian:jessie lock=true
    $ awless create instance distro=amazonlinux:amzn2
    etc.
    
  • Leveraging AWS userdata to provision instance on creation from remote (i.e http) or local scripts: awless create instance ... userdata=/home/john/...

  • awless ssh : Clean and simple SSH to public & private instances using only a name

    $ awless ssh my-production-instance
    $ awless ssh redis-prod --through jump-server
    $ awless ssh 34.215.29.221
    $ awless ssh db-private --private
    $ awless ssh 172.31.77.151 --port 2222 --through my-proxy --through-port 23
    $ ...
    (see awless ssh -h)
    
  • awless switch : Switch easily between AWS accounts (i.e. profile) and regions

    $ awless switch admin eu-west-2
    $ awless switch us-west-1
    $ awless switch mfa
    etc.
    
  • awless transparently syncs cloud resources locally to a graph representation in order for the CLI to leverage data and their relations in other awless commands and in an offline manner (more on the sync)

  • awless sync : Explicit and manual command to fetch & store resources locally. Then query & inspect your cloud offline

  • Output listing formats either human (default display is Markdown-compatible tables) or machine readable (csv, tsv, json, ...): --format

  • awless inspect : Leverage experimental and community inspectors which are interface implementation utilities to run analysis on your cloud resources graphs

    $ awless inspect -i bucket_sizer
    (see awless inspect -h)
    
  • awless completion : CLI autocompletion for Unix/Linux's bash and zsh

Getting started

Take the tour at Getting Started (wiki) or read the introductory blog post about awless.

More articles:

Awards

FAQ

Here is a compilation of the question we often answer (thanks for asking them so that we can make things clearer!):

There are already some AWS CLIs. What is awless unique approach?

Three things that differentiates awless from other AWS CLIs:

  • It has its own compiled and very simple templating language to build AWS infrastructures.
  • Commands are made of VERB + ENTITY [+ param=value] and are actually valid lines of the template language.
  • It transparently syncs to a local graph a representation of the cloud resources and their relations.

Leveraging and combining the points above, awless lays some strong foundations for plenty of current/future features/characteristic such as:

  • Wrapping AWS API calls to enrich them with before/after behaviour when interacting with the cloud
  • Having a small and hierarchical set of commands to intuitively interact with AWS
  • Enriching listing of resources using the local model and relations that are not calculated with other CLIs
  • Referencing and finding resources quickly avoiding cryptic IDs in favor of names, etc.
  • Exposing in the terminal relation between resources: lineage, siblings, etc.
  • Performing local analysis of your cloud
  • Having a smart SSH to easily connect to instances
  • etc.

How do you create infrastructure with awless?

You build infrastructure using template files or command one-liners that get compiled and run through awless builtin engine. See what the templating language looks like. Learn more about the way templates work

Note that all your actions against the cloud are logged. Templates are revertible/rollbackable.

How does awless compares to aws-shell or saws?

(Points above should also help answering this question)

aws-shell and saws are directly mapped to the official AWS CLI. Their only objective is to make you productive and help you manage exhaustively the sheer number of AWS services, options, etc.

awless addresses this UI/productivity concern differently: small and hierarchical set of commands; favoring enriched listing with relations showing over AWS exhaustive outputting of properties; more useful human/machine formats.

The main point is that the UI/productivity concern is just a feature of awless and not its primary or only one, so there is much more to the tool.

Also aws-shell and saws are exhaustive in their support of AWS services. awless is so far more infrastructure centric, with an emphasis on enriching the information about your real infrastructure. awless is able to add any new AWS service quickly if that fits and make sense (see wiki on how to add a new AWS service).

How does awless compares to Terraform?

Terraform is a great product! awless is much younger than Terraform and Terraform is much broader in scope.

The approach is different though. When creating insfrastructure awless:

  • favors simplicity with a straight forward, compiled and simple deployment language
  • employs an all-or-nothing deployment: do not keep state, etc.
  • awless does provide a rollback on any ran template.

Does awless handles state when creating infrastructure (i.e. keep track of the changes)?

Quoting from a logz.io/blog entry: "Terraform is an amazing tool but a major challenge is managing the state file. Whenever you apply changes to your infrastructure, the entire managed body of code and created objects are tracked in the Terraform State file (.tfstate), which can reach hundreds of thousands of lines and must be managed carefully lest you incur large merge conflicts or unwanted resource changes", Ofer Velich.

As for now with awless, we have taken a different path: awless does not keep state of your cloud; it is more of an all-or-nothing deployment solution.

Note that awless logs (through rich and revertable logs) all your actions against the cloud and that you can revert any template ran.

About

awless is an open source project created by Henri Binsztok, Quentin Bourgerie, Simon Caplette and François-Xavier Aguessy at WALLIX. awless is released under the Apache License and sponsored by Wallix.

Disclaimer: Awless allows for easy resource creation with your cloud provider;
we will not be responsible for any cloud costs incurred (even if you create a 
million instances using awless templates).

Contributors are welcome! Please head to Contributing (wiki) to learn more. Note that awless uses triplestore another project developped at WALLIX.

awless's People

Contributors

alewando avatar bourgeriequentin avatar deinspanjer avatar fxaguessy avatar haraldnordgren avatar hbbio avatar hbi-wallix avatar justone avatar lllama avatar padilo avatar seddarj avatar simcap avatar taraspos avatar tml avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

awless's Issues

Support for AWS policies

We want initial support for local policies, to be improved later.

Consider preloading the global AWS policies, and try to minimize requests.

AWS profile support

I work with many AWS accounts everyday and exporting my AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY every time I is not plausible. Adding --profile NAME support would make this tool usable.

Code the initial structure of awless

A CLI tool (interactive and/or line-based) that can store parameters into a database, including the keys to connect to an AWS account.

Implement awless configure to configure the CLI.

Generation of a new EC2 resource

We should prepare standard templates to add EC2 instances to an infrastructure. We should take in account definitions from #3 to help generate the instances easily.

Error: BucketRegionError:

Hi,
Encountered with such error whenever I'd like to retrieve my instance info.

awless show i-xxxxxxxxxxxx

[info] cannot resolve resource - running full sync
Error: BucketRegionError: incorrect region, the bucket is not in 'ap-southeast-1' region
status code: 301, request id:

Define a terminology of user roles

Each role will map to a policy, but for awless, we use a simple name tag to dedicate a particular role to a given group of instances.

Maybe it will be a product of
role_type x role_perimeter

Extract values: multiple non-empty target type in route

Syncing infra failed when a route targets to a NetworkInterface and Instance.

ex:

[info] cannot resolve resource - running full sync
Error: extract values: multiple non-empty target type in route {
  DestinationCidrBlock: "0.0.0.0/0",
  InstanceId: "i-8fxxxxxx",
  InstanceOwnerId: "xxxxxxxxxx",
  NetworkInterfaceId: "eni-a5xxxxxx",
  Origin: "CreateRoute",
  State: "active"
}

Add command "list users --unused"

When there are many users, it might be interesting to know the ones that are unused in order to delete them.
Perhaps add also list instances/vpcs/groups/roles/... --unused

Awless diff and awless revisions show diff in reverse order

  1. With awless diff :
  • an instance created in the cloud is shown in red (the local repo has one missing instance)
  • an instance deleted in the cloud is shown in green (the local repo has an extra instance)
  1. After awless sync
    awless show revisions -n 1 displays :
  • the instance that has been created in green
  • the instance that has been deleted in red

We have to choose one between 1. and 2.
For my part, I prefer 2.

Integration with Ansible

awless should integrate with configuration management software. For instance, we could easily start an ansible "central" server and automatically add newly created instances to the ansible hosts.

Allow concurrent awless processes when no writes on BoltDB

We should not timeout when opening BoltDB if another Awless process is hanging open.

For instance in a console make awless hang on a command:

$ awless create instance

Then in another console window run:

$ awless list instances

You will get a timeout error on opening the awless db.

There are no writes on the db in both case so we should be able to execute both commands concurrently.

List resources across regions

Would be great to be able to override the region set in the config with a command line flag. In addition to specific regions, the ability to list resources in all regions would be very useful. Maybe add a new column to the output in that case with the region name.

Can't set region in config

✗ awless config set region
config: missing region. Set it with `awless config set region`
✗ awless config set region us-west-1
config: missing region. Set it with `awless config set region`

Inline change of configuration parameters

As mentioned in #36, it would be nice to be able to change config parameters (for example, the region, or the aws profile) only for one command.

We could do that with, for example (git syntax)

awless -c "aws.profile=prod" -c "region=us-west-2" list instances 

specify key to use for awless ssh

Users should be able to use their own key to login via ssh to a running instance. Auto lookup could be used.

awless ssh foomatty@i-fr483984
ssh login to instance i-fr483984 using key /home/foomatty/.awless/keys/foomatty

awless use case: Easily create instance and ssh into it

Earlier:

awless config os linux

(in which linux default to Amazon Linux). We could also expect to define here a preferred instance type.

awless create instance ram=4gb
-> “instance_foo”

awless rename instance_foo gogs

awless ssh gogs

To do this, it means:

  1. That we have notions of "defaults" which are predefined by the user; For instance, the preferred AMI. There should a "pass" in awless that inserts default values when they are missing.
  2. There should be a pass which automatically selects the instance type based on constraints (for instance, the cheapest instance with a given amount of memory)
  3. There should an "alias pass" which replaces instance names with their IDs. In the end, the engine which applies the commands in stacks (and which takes place after aliasing) expects only IDs.
  4. There should be a ssh command which logins into the instance. The ssh keys are taken from Amazon output and stored in awless safe.

Use multi-accounts

hi,

my .aws/credentials file describes many different accounts. Currently I use aws --profile but don't see such option in awless - am I missing something ?

Support IAM instance profile credentials

I'm trying to use awless from a machine that has valid (temporary) credentials on the standard 169.254.169.254 endpoint and it complains:

command hook failed: Your AWS credentials seem undefined!
AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY need to be exported in your CLI environment

My expectation from all other AWS tools and SDKs is that it would respect explicitly provided credentials if provided, but would fall back on the instance metadata credentials if those weren't provided.

Reduce size of binaries

We can strip the executables using: -ldflags "-s -w" when building awless.

Additionally, some people use upx to further shrink them.
I tested (without goupx which is supposedly not needed) but the (much) reduced awless binary does not run anymore (it quits with code 127).

Unsure how to use a profile

Like many people, I manage a number of AWS accounts. Is there a way to have awless use a profile, as the official AWS CLI does?

For example, given I have a typical setup, development in one account, production in another, with AWS CLI I have this.

~/.aws/credentials

[default]
aws_access_key_id = obfuscated
aws_secret_access_key = obfuscated

[DEV]
aws_access_key_id = obfuscated
aws_secret_access_key = obfuscated

[PROD]
aws_access_key_id = obfuscated
aws_secret_access_key = obfuscated

aws s3 ls --profile DEV

I can easily work around exporting the keys to the appropriate env variables, so this isn't a huge deal but it would make things work way better.

Thanks!

~bdunbar

Implementation of stacks

We want to implement a stack of unrealized commands.

  • Each command has a given number of arguments.
  • Results of previously stacked commands are named res1, res2, etc.
  • Results could be a single value or an array
  • Results can be referenced as arguments of further commands
  • Stacks as a whole can be shared as templates where some values may be missing: They are the arguments of the template
  • We should use templates as a way to tackle the awless scenarios

Allow toggling of autosync per service

awless syncs automatically cloud resources (across services) locally as RDF graphs.

At the moment the auto-sync run as such:

  • pre and post awless run command
  • pre and post awless create, delete, ... (template one-liners) commands
  • pre awless show command

Note that a manual sync (per service if chosen) can be done via awless sync.

Although the sync fetches in parallel, we might want to ignore some services and therefore not automatically resolve their resources.

Examples:

  • You might want to work and administrate solely your infra, access and queuing services while ignoring huge amount of resources on your storage service.
  • You might not have rights to access every cloud service, hence triggering some errors while fetching resources.

In the config we will flush by default:

infra.autosync = true
storage.autosync = true
access.autosync = true
...

Disabling an auto-sync is therefore now just awless config set storage.autosync false

Better manage empty AWS credentials

When we launch for the first time awless without any AWS credentials (env variables nor ~/.aws/credentials file), awless freezes and after few seconds displays:

2017/01/02 15:28:27 Your AWS credentials seem undefined: NoCredentialProviders: no valid providers in chain. Deprecated.
	For verbose messaging see aws.Config.CredentialsChainVerboseErrors

We could rather propose to create the ~/.aws/credentials file.

Filter results

Hi. When having a large number of resources, I find awless is for me hard to use. I'd like some ability to filter results. Typically I use tags to identify resources, and would want to filter for resources who have a tag that matches some kind of value.

Anonymized values aren't anonymous

Over on Hacker News, @fxaguessy wrote:

The hash functions are totally unrevertable, so it is impossible to come back to the original identifiers.

I replied:

You don't need to break SHA256 to de-anonymize these values.

awless collects account number hashes. AWS account numbers are 12 decimal digits long, meaning there's a total of 10^12 unique values. Values are anonymized before submission using a single round of SHA256, so in ~2^40 hash operations, anyone with your database of hashes can invert every single account number.

For comparison, the bitcoin blockchain presently has a hash rate of ~2^61 SHA256 hashes per second. (Edit: I incorrectly stated 2^41 based on a hash rate of 3 TH/s, when it's actually 3 million TH/s.)

"SHA256 with a global salt" is not appropriate for password storage because it is trivial to brute force. It is equally inappropriate for the anonymization of user identifiers, and for exactly the same reason.

However the statistics reporting works going forward (#38), awless should not continue using this or any other similar anonymization scheme.

An invalid region prevents the usage of the CLI

With an awless fresh install, if you have an invalid region (for example, with a Ctrl-C during the process). Then, you can not launch any command:

invalid region ''

We need to make the initialization of the environment after the launch of the CLI, in order to have access to commands such as awless version, awless config set ...

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.