🔥Let’s Do DevOps: Building a Slack Bot with AI Capabilities — From Scratch! Part 2: AWS Bedrock and Python🔥
aka, “oh hey there world-eating AI, can you do a small task for me, as a favor?”
This blog series focuses on presenting complex DevOps projects as simple and approachable via plain language and lots of pictures. You can do it!
This article is part of a series of articles, because 1 article would be absolutely massive with all parts.
- Part 1: Covers how to build a slack bot in websocket mode and connect to it with python
- Part 2 (this article): How to deploy an AWS Bedrock AI resource and connect to it to ask a request locally from your terminal with python3
- Part 3 (link coming when published): We’ll connect our slack bot with Bedrock locally using python3 with ngrok so slack users can have conversations with AI
- Part 4 (link coming when published): How to convert your local script to an event-driven serverless, cloud-based app in AWS Lambda
Hey all!
During the last article, we went over how to build a slack app that can listen for tags in shared rooms, or for DMs from your users. We connected it with websocket mode, which is great for testing, but less so for enterprise consumption.
However, we didn’t see it really *do* anything — we got a json packaged “ok” that our slack app is connected, but we’re not posting anything back to slack. That’ll change in this article.
We’re going to get our AI ready inside AWS BedRock, where we’ll deploy Anthropic’s Claude v3.5 Sonnet. Then we’ll update our python script to connect to it and serve queries.
THEN we’ll stitch the two together so you can locally run your python script and it’ll receive queries from slack, then relay those requests to Bedrock, then get responses and post them back to Slack. This will create a fully functional Bedrock AI chat bot.
That’s not going to quite get to enterprise quality — running any bridge script forever on a single machine is going to break a lot. Like, your machine will hibernate or reboot sometimes, right? So in the next article we’ll talk about how we can embed this script in an AWS Lambda that’ll receive webhooks from the slack app, and do all the stitching work of connecting it to Bedrock. That’ll run forever in the cloud, and never require us to touch it again, lazy (over?-)engineering at its finest!.
With no further ado, lets dive in!
Let’s Do DevOps
From here on out, all content will be published on Let’s Do DevOps. I want to give back to the community as much as I’m able. Please subscribe there to avoid missing any content. Thanks all ❤.
This article is available on LetsDoDevOps, please subscribe there to support my work! ❤