Run Lambdas from Slack for fun and profit with

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:

At Nordcloud, we are working closely with the team at 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 in the near future.

Opsidian helps you monitor and manage your AWS Infrastructure from Slack. Opsidian is a part of 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 was born — an AWS chatbot developed jointly with Nordcloud to manage AWS environments directly from Slack channels.

With you can bring your everyday cloud mananagement and monitoring tasks to where you 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 on a problem. 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 extend Opsidian'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 into the Slack, let us see this example:

import jsondef 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

Let’s now 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:

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

Now, 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.

That’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 number of ELB load balancers, EC2 instances or EMR clusters.

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.

Having accomplished all of the above, your are good to go and are ready to explore and enjoy the rich features of 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 more broadly in their daily operations on Amazon Web Services. We encourage you to take the next logical steps on this journey:

Originally published at

Dariusz Dwornikowski

Written by

Head Of Engineering at Nordcloud, CTO at Nordcloud Poland, Computer Scientist at PUT

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade