Giter Site home page Giter Site logo

pinterest / soundwave Goto Github PK

View Code? Open in Web Editor NEW
96.0 13.0 17.0 1.95 MB

A searchable EC2 Inventory store

License: Apache License 2.0

Java 81.88% Python 3.36% HCL 0.71% Shell 0.71% CSS 5.55% JavaScript 4.07% HTML 3.13% Dockerfile 0.59%
aws ec2 tools cloud-management infrastructure configuration-management

soundwave's Introduction

Note: This project is no longer actively maintained by Pinterest.


Soundwave

Demo

What is soundwave

Soundwave is a searchable EC2 inventory store. It tracks all the current and historic EC2 instances with their metadata. It has three parts:

  • A java based worker system to synchronize EC2 data and push to the elastic search store.
  • A RESTful API layer to provide access to instance data and search.
  • A UI dashboard for end users to perform ad hoc search.

At Pinterest, Soundwave is the foundation of our Configuration Management Database which serves as the source of truth for our EC2 instance information. The data is used for service management, visibility, and finance purposes. This engineering blog (https://medium.com/@Pinterest_Engineering/soundwave-an-open-source-configuration-management-database-df75b31b8f5a) contains the detail informations

Why use soundwave

Soundwave is useful for companies which operate EC2 at scale and require to track usage and instance meta data. While the AWS console and EC2 API can already be used to access the metadata of EC2 instances, there are some limitations that prompted us to build an internal data store.

  1. AWS EC2 API has a rate limit which makes it unsuitable for direct querying of machine information from automation systems.
  2. AWS doesn’t persist metadata and instance information for terminated instances. This makes it difficult to track usage history and diagnostic issues of these terminated instances.
  3. In AWS, EC2 schema can only be extended in a limited way with the use of tags.
  4. EC2 API has very limited support for querying beyond simple filtering.

In addition, We built Soundwave to bring to life the following benefits:

  1. A dedicated tracking of EC2 instances in our elasticsearch store helps us achieve a better query performance than EC2 API. This means getting information about all running instances takes roughly 5 seconds in Soundwave, but more than a minute from EC2 API.
  2. It creates a cloud agnostic abstraction layer for configuration management that makes it easier to support hybrid cloud scenarios

Getting Started

1. Clone the repository

git clone https://github.com/pinterest/soundwave.git

2. Setup AWS Credentials

Soundwave uses Terraform to provision the required infrastructure for running the service.

Terraform requires AWS credentials (Access and Secret Key) of a privileged user.

$ vi soundwave/terraform/soundwaveaws.tf
----------------------------------------

provider "aws" {
  access_key = "<<Your Access Key>>"
  secret_key = "<<Your Secret Key>>"
  region     = "<<Your AWS Region>>"
} 

3. Run Terraform

$ cd soundwave/terraform
$ terraform apply

4. Update Properties

Use the AWS region and your account number in the fields shown below

(Note: Account Number is available on the AWS console under MyAccount section)

$ vi soundwave/worker/config/soundwaveworker.properties
-------------------------------------------------------

aws_region=us-east-1
update_queue=https://sqs.us-east-1.amazonaws.com/<accountnumber>/soundwave-events

5. Build the project

mvn clean package

6. Update docker-compose

Update the docker-compose.yml file to use your AWS Access and Secret keys

$ vi soundwave/docker-compose.yml
---------------------------------

version: '2'
services:
  soundwave-worker:
    build: ./worker
    environment:
      - CONFIG_FILE=config/soundwaveworker.properties
      - TEST_CONFIG=1
      - AWS_ACCESS_KEY_ID=<<key_id>>
      - AWS_SECRET_ACCESS_KEY=<<access_key>>

7. Run docker-compose

docker-compose up

8. Create Elastic search indexes

$ cd worker/scripts
$ ./provision_index.sh http://localhost:9200/soundwave_prod
$ ./provision_index.sh http://localhost:9200/soundwave_ss

9. Launch an EC2 instance through the AWS console or aws-cli command line

10. See the results

Results can be seen on one of the following:

{
   "took": 38,
   "timed_out": false,
   "_shards": {
      "total": 1,
      "successful": 1,
      "failed": 0
   },
   "hits": {
      "total": 1,
      "max_score": 1,
      "hits": [
         {
            "_index": "soundwave_prod",
            "_type": "instance",
            "_id": "i-01c085b645bffcf6f",
            "_score": 1,
            "_source": {
               "id": "i-01c085b645bffcf6f",
               "region": "us-east-1",
               "location": "us-east-1b",
               "state": "running",
               "created_time": "2017-03-21T18:57:56.571+0000",
               "updated_time": "2017-03-21T18:58:27.577+0000",
               "terminated_time": null,
               "vpc_id": "vpc-b58320d0",
               "subnet_id": "subnet-dcfc3cab",
               "aws_launch_time": "2017-03-22T03:49:18.000+0000",
               "security_groups": null,
               "security_group_ids": null,
               "tags": null,
               "cloud": {
                  "aws": {
                     "subnetId": "subnet-dcfc3cab",
                     "kernelId": null,
                     "ramdiskId": null,
                     "virtualizationType": "hvm",
                     "amiLaunchIndex": 0,
                     "enaSupport": true,
                     "stateReason": null,
                     "sourceDestCheck": true,
                     "platform": null,
                     "instanceId": "i-01c085b645bffcf6f",
                     "vpcId": "vpc-b58320d0",
                     "hypervisor": "xen",
                     "rootDeviceName": "/dev/xvda",
                     "state": {
                        "code": 16,
                        "name": "running"
                     },
                     "productCodes": [],
                     "architecture": "x86_64",
                     "ebsOptimized": false,
                     "imageId": "ami-0b33d91d",
                     "blockDeviceMappings": [
                        {
                           "ebs": {
                              "volumeId": "vol-0305a977aad819e7f",
                              "deleteOnTermination": true,
                              "attachTime": 1490154559000,
                              "status": "attached"
                           },
                           "deviceName": "/dev/xvda"
                        }
                     ],
                     "stateTransitionReason": "",
                     "publicIpAddress": "54.242.222.37",
                     "clientToken": "EtnOD1490154557345",
                     "instanceType": "t2.micro",
                     "keyName": "lidaec2key",
                     "publicDnsName": "",
                     "monitoring": "disabled",
                     "iamInstanceProfile": null,
                     "privateIpAddress": "172.30.1.227",
                     "instanceLifecycle": null,
                     "rootDeviceType": "ebs",
                     "tags": [],
                     "launchTime": 1490154558000,
                     "spotInstanceRequestId": null,
                     "networkInterfaces": [
                        {
                           "networkInterfaceId": "eni-0c2febee",
                           "subnetId": "subnet-dcfc3cab",
                           "privateIpAddresses": [
                              {
                                 "association": {
                                    "ipOwnerId": "amazon",
                                    "publicIp": "54.242.222.37",
                                    "publicDnsName": ""
                                 },
                                 "privateDnsName": null,
                                 "privateIpAddress": "172.30.1.227",
                                 "primary": true
                              }
                           ],
                           "description": "Primary network interface",
                           "groups": [
                              {
                                 "groupName": "launch-wizard-8",
                                 "groupId": "sg-7465ce0b"
                              }
                           ],
                           "association": {
                              "ipOwnerId": "amazon",
                              "publicIp": "54.242.222.37",
                              "publicDnsName": ""
                           },
                           "ipv6Addresses": [],
                           "ownerId": "093574427811",
                           "sourceDestCheck": true,
                           "privateIpAddress": "172.30.1.227",
                           "macAddress": "0a:f0:41:07:19:aa",
                           "attachment": {
                              "attachmentId": "eni-attach-3a2f6802",
                              "deleteOnTermination": true,
                              "deviceIndex": 0,
                              "attachTime": 1490154558000,
                              "status": "attached"
                           },
                           "vpcId": "vpc-b58320d0",
                           "privateDnsName": null,
                           "status": "in-use"
                        }
                     ],
                     "sriovNetSupport": null,
                     "privateDnsName": "ip-172-30-1-227.ec2.internal",
                     "securityGroups": [
                        {
                           "groupName": "launch-wizard-8",
                           "groupId": "sg-7465ce0b"
                        }
                     ],
                     "placement": {
                        "availabilityZone": "us-east-1b",
                        "groupName": "",
                        "tenancy": "default",
                        "hostId": null,
                        "affinity": null,
                        "availability_zone": "us-east-1b"
                     }
                  }
               },
               "aws_status": null,
               "token": null,
               "cached": 0
            }
         }
      ]
   }
}

Some example queries in UI (follows ES syntax):

  • id:i-123456789abce
  • cloud.aws.instanceType:c3.4xlarge
  • aws_launch_time:>now-1d OR terminated_time:>now-1d

License

Apache License, Version 2.0

soundwave's People

Contributors

jparise avatar lilida avatar sjoshi6 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

Watchers

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

soundwave's Issues

development status

This is a neat project and could solve some issues for me.
Looks like last commit was in august. Is it still in progress? Would there be someone available to approve PRs?

worker has pinterest specific configurations

  • Dependency on internal code for ostrich fetcher

<dependency> <groupId>com.pinterest.optimus.commons</groupId> <artifactId>pinterest-commons</artifactId> <version>0.1-SNAPSHOT</version> <exclusions> <exclusion> <groupId>org.slf4j</groupId> <artifactId>slf4j-jdk14</artifactId> </exclusion> </exclusions> </dependency>

What's the grammar for query

The tool is great but lack of user guide.
Really not know how to query in the ui.
The example link in the ui is unreachable.

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.