AWS Cloud Operations Blog
Streamline AWS Support with AWS Chatbot and Microsoft Teams
ChatOps is a collaborative approach to operations that integrates chat platforms with automation tools and processes. It’s a way to bring together people, tools, and processes in a single chat interface to facilitate communication, collaboration, and execution of tasks within a team or organization.
It is critical for an Operations team to act quickly and efficiently to address issues, minimize outages, and improve incident response. One of the key tasks for an Operations team is to interact with AWS Support portal to obtain help from AWS support experts. To streamline operations as part of ChatOps practice, you can use AWS Chatbot to get updates from AWS Support directly in your Microsoft Teams (Teams) or Slack channels. AWS Chatbot enables DevOps teams to operationalize their operations workflows (i.e. monitor and operate AWS applications) in chat channels such as Amazon Chime chat rooms, Teams or Slack, to significantly enhance team’s productivity.
In this post, you will learn how to set up notifications from AWS Support via your Microsoft Teams room:
- Receive notifications on a new AWS Support case creation
- Receive notifications on an update to an AWS Support case
- Get support case status and latest updates
- Add a note into the Support case
The diagram below shows how AWS Chatbot allows users to receive notifications, run commands, and interact with AWS Support or AWS services directly from their preferred chat environment.
Fig-1: Two-way communication between chat application and AWS services through AWS Chatbot.
Prerequisites
To get started, you need to configure AWS Chatbot with your Microsoft Teams app and appropriate administration level permissions is required.
- Ensure Microsoft Teams is installed and approved by your organization administrator
- Verify that your Microsoft Teams administrator has approved the AWS Chatbot app for Microsoft Teams, and you have required IAM privileges in the AWS console.
- You have a Business, Enterprise On-Ramp, or Enterprise Support plan to be able to use the AWS Support API. Refer AWS Support for more information.
Getting started
Follow steps in Get started with Microsoft Teams tutorial to setup basic connectivity between Teams and AWS Chatbot. You need to consider following notes during the process:
Notes:
- Steps listed under “Step 1: Configure a Microsoft Teams client” are to be followed in your Teams channel. Ensure that the Teams channel is of type Standard (Public). Teams doesn’t currently support AWS Chatbot in private channels.
- Steps listed under “Step 2: Configure a Microsoft Teams channel” are to be followed in your AWS console.
- You must set up “Amazon Simple Notification Service (Amazon SNS) topic” for notifications in your Teams channel to receive notification of new AWS Support cases. Create a new SNS Topic (of Type:Standard) without subscription and this step will automatically add a Chatbot subscription into the given SNS Topic. Note that since AWS Support service is currently available in US East (N. Virginia), US West (Oregon), and Europe (Ireland) regions, so you must setup your SNS topic in one of these regions.
- For Channel role, ensure at least “AWS Support command permission” and “Read-only command permissions” are added into your Chatbot role if creating a new IAM role.
- For Channel guardrail policies, ensure at least “SupportUser” and “ReadOnlyAccess” are added.
- Steps listed under “Step 3: Test notifications from AWS services to Microsoft Teams” are to be followed in your AWS console, and verify the test message (refer Fig 2 below) in your Teams channel.
- Do not proceed further until you have received the ‘test message‘ in your Teams channel. This is an important step to ensure the setup is working as expected. Refer to this page to troubleshoot further.
Sample test message:
Fig-2: A sample default Chatbot message or notification showing successful integration.
Setup Teams notifications on new AWS Support case creation or updates
Amazon EventBridge is a serverless services that make easier for you to receive, filter, transform, route, and deliver AWS service events in your AWS cloud. You will use EventBridge to transform the AWS Support events into a Chatbot-compatible format, and route them to the Amazon SNS. SNS will then forward the notification to the Chatbot, which will ultimately send the notification to your Microsoft Teams channel. The diagram below illustrates the complete workflow.
Fig-3: An event journey from AWS Support to a transformed message in Microsoft Teams.
Create an Amazon EventBridge rule for AWS Support cases
Note that AWS Support service is currently available in US East (N. Virginia), US West (Oregon), and Europe (Ireland) regions, so you must setup the EventBridge rule & SNS topic in one of these regions to receive Support events. Region US East is used in this post.
Follow the Creating an EventBridge rule for AWS Support cases guide to setup an event rule for events emitted by AWS Support
service (Ref: Step-3, Fig-3).
Consider following during the process:
- Under Event pattern, for AWS service, choose Support, for Event type, choose Support Case Update. It should look like below:
{
"source": ["aws.support"],
"detail-type": ["Support Case Update"]
}
- For Target, use the SNS topic that you created as part of the pre-requisites. It has integration with AWS Chatbot endpoint.
Setup EventBridge transformation
You will need to transform the event to suit AWS Chatbot formatting (Ref: Step-4, Fig-3). Use parameters and transformation rules provided below. You can refer AWS Chatbot’s Custom notifications section to learn further about custom notification event schema.
To create a target Input transformer either as part of creating a rule, or as part of editing an existing rule:
- On the step Select target(s), expand Additional settings, under Configure target input, select Input transformer (from the drop-down menu)
- Click on Configure Input transformer button to setup the transformation in a new window
- For the Sample event, use Support Case Update (keep a copy for later reference)
- Under Target input transformer use:
-
{ "account": "$.account", "case-id": "$.detail.display-id", "case-event": "$.detail.event-name" }
-
- Under Template use below template:
-
{ "version": "1.0", "source": "custom", "id": "c-wvermaf", "content": { "textType": "client-markdown", "title": ":warning: AWS support case <case-id> updated", "description": "AWS Support case <case-id> is in **<case-event>** state, in **<account>** account", "nextSteps": [ "Check out case details here: <https://console.aws.amazon.com/support/home#/case/?displayId=<case-id>|<case-id>> and take the appropriate action." ] }, "metadata": { "caseID": "<case-id>" } }
-
- Click on Generate output to see your final transformed event message. If all looks good, click Confirm to close the window. Click Next to setup Tags and click Create rule to create the rule. You can change the Input transformation later as needed.
Test complete workflow
You can now test the end-to-end workflow by creating or updating an AWS Support case, and following message should appear in your Teams channel (Ref: Fig-3).
Fig-4: Custom message (notification) received upon an update to AWS Support case.
Responding to AWS Support cases within Teams channel
AWS Chatbot allows you to run AWS commands directly from your chat channels. It also enables you to use custom actions, which can be used to set up preconfigured action buttons that can be automatically added to your future similar / custom notification. These actions allow you to automate commonly used DevOps processes and incident response tasks. Using custom action, you can configure an action button to run either an AWS Command Line Interface (AWS CLI) or a Lambda function. In this case, we will use AWS CLI commands to interact with AWS Support cases via these custom actions.
Creating a custom action
To create an AWS CLI command action
- Choose the vertical ellipsis (3 dots) button on the bottom of the above. Support Case notification in your Teams channel (Ref: Fig-4). It should open a workflow in new window.
- In Manage actions, choose Create.
- Enter a custom action name, say
GetSupportCaseDetails
. - Enter a name for your custom action button, say
GetCaseDetails
. This name is shown on a button on your notification. - For Custom action type, choose CLI action, click Next
- Enter below command (without
aws
in front)support describe-cases --display-id $caseID --query Cases[0].{CaseID: caseId, Status: Status, Subject: Subject, Notes: RecentCommunications.Communications[0].Body} --region us-east-1
Note: Chatbot exposes predefined variables from your custom notifications to be used as variables for these custom actions. If you noticed in the previous section (Step-5 of Setup EventBridge transformation), we added “metadata
“: “caseID
” in the event transformation template. Let’s make use of it, so that same button/action can be used for all AWS Support case notifications and the Case ID is automatically substituted via this variable.
- Add our new variable by choosing + Add more variables.
- Variable name:
caseID
- Name expression:
event.metadata.caseID
- Variable name:
- Click Next
- Verify Display criteria i.e. the conditions that must be met to display this custom action button on a specific notification. In this case they are:
- NotificationType equals Custom
- caseID has any value
- Choose Save. Wait until you get the message “Successfully created
GetSupportCaseDetails
”. - You should get a message like below:
Fig-5: Snapshot showing a custom action button has been created.
Test Scenarios
- Let’s test the end-to-end flow by updating an AWS Support case. Following message should soon appear in your Teams channel. Notice the new
GetCaseDetails
custom action button now appearing with the latest chat message. The Chatbot is intelligent enough to recognize that the custom action button belongs to these types of messages, and it automatically applies the button.
Fig-6: Snapshot showing presence of the custom action button in a custom chat massage.
- Test the button action to fetch the case update in your Teams channel. Notice it should autofill the required variable i.e.
CaseID
in this case. Choose Run to fetch the case Status, Title and latest note.
Fig-7: Snapshot showing execution of the custom action button.
- You will receive a response with the latest case details, as per the defined CLI action. Example response below:
Fig-8: Snapshot showing output post execution of the custom action button.
What next?
Well, you can use the above information to effectively manage common Support case management tasks per your business needs. For example, if your AWS account is being managed by AWS Managed Services (AMS), their proactive monitoring will identify an issue, create an AWS Support case, and simultaneously request your approval before remediating a non-preapproved issue. To boost productivity, you can create custom action button or an alias, such as ‘Approved’ or ‘Need More Info’, within your Teams channel. These buttons or aliases allow you to add instructions directly into a Support case, enabling seamless communication with the AMS operations team. For example: @aws alias create update_case support add-communication-to-case --case-id $caseid --communication-body "$message" --region $region
You can also use AWS Chatbot to manage your Support case management workflows for your multi-account cross-region applications in chat channels. For example, you can set up AWS Chatbot in multiple AWS accounts to send AWS Support notifications into the same Teams channel. All your custom action buttons setup in that channel will be automatically applied across related notifications from all AWS accounts. Depending on your ChatOps practices, you can choose to set up separate Microsoft Teams channels based on criteria such as AWS account, application, or environment (production/non-production). In addition, you can directly interact with Amazon Q Developer in Microsoft Teams and Slack messaging platforms that are configured with AWS Chatbot, to answer questions about AWS best practices, troubleshooting issues, or identifying next steps.
Resources
- To learn about available AWS Support CLI commands, or variables in the request and response API calls, refer to the Running AWS CLI commands from chat channels and AWS Support API documentation.
- Refer Monitoring AWS services using AWS Chatbot to use AWS Chatbot to monitor and receive notifications about other AWS services
Conclusion
In this blog, you learned how to use AWS Chatbot features, such as Custom notifications and Custom actions for Microsoft Teams, to enhance your ChatOps experience. Additionally, you gained insights on performing common AWS Support management tasks directly within the Microsoft Teams channel, such as receiving case notifications and making updates to cases, significantly enhancing your team’s productivity.