Home

Awesome

Import your AWS Config Snapshots into ElasticSearch

Author: Vladimir Budilov

What problem does this app solve?

You have a lot of resources in your AWS account and want to search and visualize them. For example, you'd like to know your EC2 Avaiability Zone distribution or how many EC2 instances are uzing a particular Security Group

What does this app do?

It will ingest your AWS Config Snapshots into ElasticSearch for further analysis with Kibana. Please refer to this blog post for a more in-depth explanation of this solution.

Getting the code

git clone --depth 1 git@github.com:awslabs/aws-config-to-elasticsearch.git

The code

Prerequisites

pip install -r ./requirements.txt

The command

./esingest.py
usage: esingest.py [-h] [--region REGION] --destination DESTINATION [--verbose]

  1. Let's say that you have your ElasticSearch node running on localhost:9200 and you want to import only your us-east-1 snapshot, then you'd run the following command:
./esingest.py -d localhost:9200 -r us-east-1
  1. If you want to import Snapshots from all of your AWS Config-enabled regions, run the command without the '-r' parameter:
./esingest.py -d localhost:9200
  1. To run the command in verbose mode, use the -v parameter
./esingest.py -v -d localhost:9200 -r us-east-1

Cleanup

####DON'T RUN THESE COMMANDS IF YOU DON'T WANT TO LOSE EVERYTHING IN YOUR ELASTICSEARCH NODE!

#####THIS COMMAND WILL ERASE EVERYTHING FROM YOUR ES NODE --- BE CAREFUL BEFORE RUNNING

curl -XDELETE localhost:9200/_all

In order to avoid losing all of your data, you can just iterate over all of your indexes and delete them that way. The below command will print out all of your indexes that contain 'aws::'. You can then run a DELETE on just these indexes.

curl 'localhost:9200/_cat/indices' | awk '{print $3}' | grep "aws::"

Also delete the template which allows for creationg of a 'raw' string value alongside every 'analyzed' one

curl -XDELETE localhost:9200/_template/configservice