For over a year now we have seen the rise of chatbots all over the planet and in many different industries. The same trend is being seen in the Cloud and IT market, especially since we’ve been working with Amazon Web Services very closely. Last year, there has been the “AWS Serverless Chatbot” competition where one tool left the jury absulutely breathless: opsidian.ai.

At Nordcloud, we are working closely with the team at Opsidian.ai to get the latest and best out of using chatbots for both our customers and our own operations teams. Especially in the context of our Managed Cloud Service, this is a highly relevant aspect. We integrate with our customers on a deeper level and partner more closely through the use of chatbots and the related features and functions. In this blog post, we want to describe some of these aspects and encourage all of you to take a look at opsidian.ai in the near future.

 

Enabling real ChatOps

Opsidian helps you monitor and manage your AWS Infrastructure from Slack. Opsidian is a part of an increasingly popular trend, called ChatOps. ChatOps is about bringing your DevOps work to your chats and conversations within a team. You can, for example, deploy code, monitor servers, close issues in a bug tracker just by talking to a chatbot, which understands natural language or special commands. We have recognized that trend and Opsidian.ai was born – an AWS chatbot developed jointly with Nordcloud to manage AWS environments directly from Slack channels.

With Opsidian.ai you can bring your everyday cloud management and monitoring tasks to where your team is – a Slack channel. This way, team members gain a better visibility into the discussed items and accelerate change by having a common view of a problem.

Run Lambdas functions from Slack for fun and profit with Opsidian.AI

Opsidian.ai can do a lot of nifty stuff, it can notify on CloudWatch alerts, display a filtered list of your load balancers, check DynamoDB throughput, start, stop and reboot EC2 instances and even plot metrics. Opsidian can understand free speech thanks to its advanced NLP algorithms but you can also talk to it with the /ops structured command. Now, here’s whats really new and interesting! Opsidian can run AWS Lambda functions directly from your Slack channel. The best part is that you can provide your own custom functions and effectively customize and extendOpsidian’s functionality! So how’s it done?

 

User Manual for Getting Started

Briefly, you register a Lambda function, existing in your account, with Opsidian. You choose your own command on which Lambda will be triggered (/ops run COMMAND). The Lambda has only one simple requirement: it needs to return a JSON object with a field called message. Whatever is placed in this field will be directly returned to the Slack, let us see this example:

import json
def lambda_handler(event, context):
    message = "Hi from a Lambda function !"
    return json.dumps({ “message” : message }

As for permissions, make sure that the IAM role of Opsidian has “lambda:InvokeFunction” permissions, as described in http://opsidian.ai/lambda/.

Let’s configure some Lambda functions! If you have your own function, feel free to configure it. I will use the summarize-aws-services function, which is already provided by Opsidian in their repository: http://github.com/OpsidianAI/opsidian-lambda-functions.

First, a function needs to be registered with Opsidian, to do that — log in to the Opsidian Dashboard — https://dashboard.opsidian.ai/dashboard and proceed to the View Lambda Function panel.

Run Lambdas functions from Slack for fun and profit with Opsidian.AINow, click the “Add a new Lambda function command”. Choose your region, command name and fill in your function’s ARN. The command you choose will be used to identify your function within Opsidian, i.e. /ops run COMMAND. Tick “wait for response” if you want to get the result from your Lambda passed back to Slack, Opsidian will wait 5s for the function to finish and wait for whatever is returned.

Run Lambdas functions from Slack for fun and profit with Opsidian.AIThat’s it! You can now test your function. Go to a Slack channel and execute your command, e.g./ops run summarise As you can see, the summarize-aws-services function provides a simple summary of the most common resources used in your AWS Account, such as a number of ELB load balancers, EC2 instances or EMR clusters.

 

Run Lambdas functions from Slack for fun and profit with Opsidian.AI

CredentialReport Lambda, also present in the repository generates a credential report and checks when IAM users last rotated their AWS access keys. By default, it checks last 90 days but you can adjust the function to your needs. Parameters may be passed to a function via the event object – Opsidian will place them in the event[‘args’] field.

 

Run Lambdas functions from Slack for fun and profit with Opsidian.AI

 

Having accomplished all of the above, you are good to go and are ready to explore and enjoy the rich features of opsidian.ai and ChatOps as a concept further on your own.

 

What’s next?

We are very eager to enable our customers and partners in using products like opsidian.ai more broadly in their daily operations on Amazon Web Services. We encourage you to take the next logical steps on this journey:

  1. Clone the https://github.com/OpsidianAI/opsidian-lambda-functions and code your Lambdas!
  2. Join the Opsidian slack channel http://opsidian.ai/slack/
  3. Meet Nordcloud at the AWS Summit Berlin and talk to us about how you can leverage ChatOps in your cloud!