/nimbus

Your friendly cloud bot.

Primary LanguagePythonMIT LicenseMIT

Nimbus

Nimbus Logo

Your friendly cloud bot

Nimbus will allow you to interact with different cloud providers (current support AWS, GCE, DO, SL)

Installation

Following is a detailed installation guide for Nimbus. We're using Apex to simplify the process, so you'll need to install it locally and use as described below.

AWS Lambda

  1. Lambda management is done with Apex
  2. Install Apex sudo curl https://raw.githubusercontent.com/apex/apex/master/install.sh | sh
  3. Run apex init
  4. Run pip install -r requirements.txt -t functions/nimbus
  5. Set timeout to 60 in the project.json file.
  6. Go to Identity and Access Management
  7. Select nimbus_lambda_function
  8. Attach the following policies
  9. AmazonEC2ReadOnlyAccess
  10. AmazonRoute53ReadOnlyAccess
  11. AmazonDynamoDBReadOnlyAccess

AWS API Gateway

  1. Go to AWS API Gateway.
  2. Click "Get Started Now".
  3. Under "API name", enter the name of your API. I will just name it "nimbus".
  4. Click "Create API".
  5. You will be redirected to the "Resources" page.
  6. Click "Create Method" and on the dropdown menu on the left, choose "POST" and click on the "tick" icon.
  7. Now, you will see the "/ - POST - Setup" page on the right.
  8. Under "Integration Type", choose "Lambda Function".
  9. Under "Lambda Region", choose "us-east-1".
  10. Under "Lambda Function", type "nimbus" and it should auto-complete it to "nimbus_nimbus".
  11. Click "Save" and "Ok" when the popup appears.
  12. You will be brought to the "/ - POST - Method Execution" Page.
  13. Click "Integration Request".
  14. Click "Mapping Templates" and the section should expand.
  15. Click "Add Mapping Template" and type in "application/x-www-form-urlencoded" and click on the "tick" icon.
  16. Under "Input Passthrough" on the right, click on the "pencil" icon.
  17. Choose "Mapping Template" on the dropdown that appears.
  18. Copy and paste this GitHub Gist to the template box.
  19. Click on the "tick" icon beside the dropdown once you are done.
  20. This GitHub Gist will covert the your API Gateway data from application/x-www-form-urlencoded to application/json.
  21. Click on "Deploy API" button on the top left.
  22. Under "Deployment Stage", click "New Stage".
  23. Under "Stage Name", type in "prod".
  24. Click "Deploy".
  25. Note the "Invoke URL" at the top and your API is now live.

Slack

  1. Go to Slack Apps.
  2. Search for "Outgoing WebHooks".
  3. Click "Install" besides the team you wanted.
  4. Click "Add Outgoing WebHook Integration".
  5. Scroll down to "Integration Settings" section.
  6. Under "Channel", choose "Any".
  7. Under "Trigger Word(s)", type in "nimbus" (without the quotes).
  8. Under "URL(s)", type in your "Invoke URL" as noted above.
  9. Customize "Descriptive Label", "Name" and "Icon" (you can use cloudy_robot_200.png from the nimbus repo) )to your liking and click "Save Settings".
  10. Copy the Token value.
  11. You are all set.

Configuration data

  1. Go to Identity and Access Management
  2. Create the following mandatory keys - SlackAPIKey (Slack AP Token), nimbus (Slack verification token)
  3. Create optional keys - DigitalOcean (DigitalOcean API key), SoftLayer (user name and a token), Google
  4. For each of the created keys do the following
    1. aws kms encrypt --key-id alias/<KMS key name> --plaintext "<COMMAND_TOKEN>"
  5. Copy the base-64 encoded, encrypted key
  6. if you you want to list your GCE instance, create keys as describe here
  7. For each of the keys decrypt using
    1. aws kms encrypt --key-id alias/NimbusGoogle --plaintext fileb://"key file"" --output text "
  8. Store this values in a string set by the name of GCETokens in dynamodb.
  9. Go to DynamoDB and create a table by the name of nimbus
  10. Add the following items to the table:
  11. BotName - Default "Nimbus"
  12. DigitalOcean - Encrypted DigitalOcean key
  13. SlackAPI - Encrypted SlackAPI Token
  14. SlackExpected - Encrypted Slack verification token
  15. SLUserName - SoftLayer user name
  16. SLAPI - SoftLayer API key
  17. icon - Url for the bot icon
  18. Give your function's role permission for the kms:Decrypt action. Example:
   {
     "Version": "2012-10-17",
     "Statement": [
       {
         "Effect": "Allow",
         "Action": [
           "kms:Decrypt"
         ],
         "Resource": [
           "<your KMS key ARN>"
         ]
       }
     ]
   }```

### Ready, Set, Go!

You can deploy your code by running `apex deploy`