Home

Awesome

Maintained by Bridgecrew.io code_coverage Terraform Version build PyPI Downloads slack-community

<p align="center"> <img src="https://github.com/bridgecrewio/AirIAM/raw/master/docs/web/images/airiam-logo.png" height="100" /> </p>

AirIAM is an AWS IAM to least privilege Terraform execution framework. It compiles AWS IAM usage and leverages that data to create a least-privilege IAM Terraform that replaces the exiting IAM management method.

AirIAM was created to promote immutable and version-controlled IAM management to replace today's manual and error prone methods.

Table of contents

Introduction

AirIAM scans existing IAM usage patterns and provides a simple method to migrate IAM configurations into a right-sized Terraform plan. It identifies unused users, roles, groups, policies and policy attachments and replaces them with a Least Privileges Terraform code modelled to manage AWS IAM.

By moving all IAM configurations into Terraform code, admins can start tracking, auditing and modifying IAM configurations as part of their standard infrastructure-as-code development provisioning processes.

AirIAM is battle-tested and is recommended for use in Dev, QA and test environments that have been previously managed by humans. It is design to result in minimal impact on existing workloads.

If you are interested in migrating a Prod account, contact us at info@bridgecrew.io for some helpful tips.

flow

Features

Commands

Usage

The three commands above run sequentially, and in-sync, as seen in the diagram below.

When executing, AirIAM starts by scanning a selected AWS account using the specified profile. If find_unused is specified, the results are printed and the execution completes. If recommend_groups is specified, after the stage of group recommendation the results are printed and the execution completes. If the terraform command is specified it takes all the results and creates the Terraform code and state file required to replace the existing IAM configuration.

Data Flow

Data Flow

Examples

Example Movie

Getting Started

Installation

Using Pip

pip3 install airiam --user

Using brew (MacOS Only)

brew tap bridgecrewio/airiam https://github.com/bridgecrewio/airiam
brew update
brew install airiam

Recommended Flow

The recommended workflow for using this tool is as follows:

  1. Run the find_unused command and delete the unused access keys + unused console logins - these cannot be migrated to terraform because they hold secrets known only to the relevant user - his password and private credentials.
  2. Run the terraform command without any flags, creating a terraform setup that mirrors your existing IAM setup. This will take a while as all of the entities will be imported to your state file
  3. Commit the terraform files (without the state file) to a new repository.
  4. Run the terraform command again, this time with the flag --without-import and --without-unused. This will edit the .tf files to contain only the entities that are in use.
  5. Create a new branch and commit the new terraform files.
  6. Create a Pull Request / Merge Request from this branch to the default branch. Check out the differences and make sure all the changes are good. Consult relevant stakeholders in your organization if necessary.
  7. After approval - merge the PR and apply the changes using terraform apply. Please note this action will require Admin IAM access to the account.

FAQ

If you run into the following error:

airiam is not recognized as an internal or external command

Please make sure python is in your PATH by running the following command:

export PATH="/Users//Library/Python/3.7/bin:$PATH"

Alternatives

AWS IAM Cleanup Tools

For AWS IAM usage scanners check out CloudTracker, Trailscraper, Aadvark & Repokid. The main difference between these tools and AirIAM is that AirIAM also moves the problem into static terraform code form, which allows an entire set of code analysis tools to manage and identify deviations and changes.

AWS IAM Policy Management Tools

For static IAM policy linting, check out Parliament. Parliament is actually integrated into AirIAM, and is run on the policies it gets from your AWS account.

For automatically creating IAM policies and managing them as code, check out aws-iam-generator, PolicySentry.

Cloudsplaining is another tool from salesforce that analyzes existing IAM set-up and identifies risky / over privileged roles.

These tools help create better policies, but do not help with existing AWS IAM set-up.

Migration of AWS to Terraform Tools

For other tools that help migrate existing AWS IAM set-up to terraform, check out terracognita and terraforming. AirIAM is the only tool which supports migrating all relevant IAM entities to terraform v0.12.

Contributing

Contribution is welcomed!

We would love to hear about other IAM governance models for additional use cases as well as new ways to identify over-permissive IAM resources.

Support

Bridgecrew builds and maintains AirIAM to encourage the adoption of IAM-as-code and enforcement of IAM Rightsizing and Least Privileges best practices in policy-as-code.

Start with our Documentation for quick tutorials and examples.

If you need direct support you can contact us at info@bridgecrew.io.