• Products
  • Get started
  • Documentation
  • Resources

Integrate Opsgenie with Jira via AWS Lambda

Lambda is the compute service from AWS that runs code without servers. AWS Lambda is a great solution for many use cases including integrations, particularly when integrating SaaS solutions like Opsgenie and Jira.

The steps below describe how to integrate Opsgenie and Jira using AWS API Gateway and Lambda Services.

An image showing the process of integrating Jira with Opsgenie, using AWS Lambda.

Creating the Lambda Function over API Gateway endpoint

Go to AWS Lambda console.

An image showing the navigation item that redirects to Lambda console.

If accessing AWS Lambda for the first time, a welcome screen appears. Click Get Started Now.

An image showing the get started button for AWS Lambda.

Click "Blank Function" to select the blueprint.

An image showing the blank function navigation for AWS Lambda.

Select API Gateway as a function trigger.

An image showing API gateway option in Lambda's configure triggers options.

Enter an API Name for the API Gateway endpoint, e.g. OpsgenieJIRAIntegrationAPI.

Select prod as "Deployment stage" and Open as the "Security" option.

Click Next.

An image showing the navigation for configure triggers in AWS Lambda.


Enter a Name for the Lambda function, e.g. OpsgenieJIRAIntegration.

Description: Enter as desired or leave blank.

Runtime: "Node.js" and Code entry type: "Edit code inline."

An image showing definitions for Lambda functions.
An image showing Lambda functions for Jira integration.

Paste the JavaScript code from ogLambdaJira.js into the inline editor.

An image showing the code script for AWS Lambda configure function.

At the beginning of the code, there are a few options to set according to the Opsgenie and JIRA account information.

If a hosted version of Jira (from Atlassian) is being used, replace with the Jira account name.

If a custom installation of Jira is being used, update jiraHost, jiraBasePath, jiraProtocol and jiraPort variables accordingly.

For Customers from Another Region

If Opsgenie is being used from another domain(eg. EU, sandbox), update ogHost.

Replace with the Opsgenie API Key from the Default API Integration or any other API Integration.

Enter correct values for and in accordance with your Jira account.

An image showing where to enter Jira values in Opsgenie's AWS Lambda integration.

For each Alert created by Opsgenie, a new Jira Issue is created in a Jira Project. In order to be able to determine which Project an Issue will be created in, there are two settings in the code to utilize.

With the alertTagToJiraProjectKey map, associate Alert Tags to Jira Project Keys.

jiraDefaultProjectKey stands for the default Jira Project Key which is used if none of the tag-key mappings can be matched from the alert.

If there is only a single project in the Jira installation, or for all issues to be created in the same Jira Project, enter its key as the default and leave the mapping as an empty array.

An image showing where to enter Jira project key in Opsgenie's AWS lambda integration.

Leave Handler’s value as index.handler, select Create a custom role for the Role.

On the newly opened window click Allow to give the necessary permissions to the Lambda function to send logs to Amazon CloudWatch.

An image showing how to complete allowing the lambda function for Jira integration.

In the Advanced settings pane select Timeout value as 5 just to be safe for our case. Leave Memory value as 128 which is more that necessary for our case.

An image showing advanced settings for Lambda function in Opsgenie's Jira integration.

After completing all steps in the “Configure function” page click Next.

An image showing where to switch the next step in AWS Lambda.

On the next page, click Create function.

An image showing the create button for Lambda function.

Go AWS -> Services -> API Gateway.

Choose your API that you created for your lambda script under "APIs" tab on the left menu.

Click ANY under "/your_lambda_function_name".

Click Actions above and select Delete Method under "METHOD ACTIONS".

Confirm the delete action.

Click again on Actions and select Create Method under "RESOURCE ACTIONS".

Select POST on the newly created combobox.

Click on the check sign. A new page opens.

Select lambda region.

Type the name of your lambda function into the field.

Click Save on the bottom right side of the page.

Confirm "Add Permission to Lambda Function" dialog.

Click Actions again and select Deploy API under "API ACTIONS".

Select prod as the "Deployment stage".

Click Deploy.

Setting an action for AWS Lambda.

Configuring an Opsgenie Webhook Integration

  1. Go to the Settings → Integrations. Search for Webhook and select Add.

  2. Write the API endpoint that AWS API Gateway provided in the "Webhook URL" text field.

  3. To make our test more reliable by not sending all alerts to the Jira installation as issues, add an Alert Filter with a tag matching condition for a tag such as "jira". Give a name to the integration. We’ve named is as LambdaJiraWebhook in this example.

  4. After configuring the integration click Save Integration.

A screenshot showing where to save webhook for AWS lambda integration.

Testing the Integration

Now it's ready to be tested. Create a new Alert with a jira tag.

A screenshot of an alert with Jira tag.

Go to the default Jira project configured previously and see an issue is then created from the alert.

A screenshot of a Jira issue created with an alert.


Also check that the alert just created has been assigned a new tag with jiraProjectKey: prefix. This tag is used for associating this Opsgenie Alert to the Jira Issue whose key is included in the tag.

A screenshot of an alert in the list, with a Jira tag.

Integration flows supported by the implemented function

Besides creating new Jira issues upon new Alert creation, the following flows are also implemented with this integration:

  • when you add a new note to the alert, a new comment is added to the issue,

  • when you acknowledge the alert, progress on the issue gets started,

  • when you close or delete the alert, the issue is closed as well.

All these flows are depicted in the following sequence diagram. Note that all items in the diagram are representative and may not reflect the actual implementations of the mentioned systems.

A diagram that explains Opsgenie's Jira integration with AWS Lambda.

Of course, you can further customize the code in order to meet your own requirements.

Monitoring Lambda runtime and function logs via CloudWatch Logs

You can also check CloudWatch logs for the logs we’ve written over the console object and also the ones written by the AWS Lambda runtime. Go to CloudWatch console first.

An image showing the location of CloudWatch in Amazon web services platform.

Click on “Logs”.

An image showing the location of Logs in Amazon web services platform.

Click on the Log Group associated with our Lambda function.

An image showing the location of log streams in Amazon web services platform.

Click on one of the Log Streams, e.g. the most recent one after sorting them by Last Event Time.

An image showing the location of a log group in Amazon web services platform.


Check logs written by the runtime and our function itself.

An image showing the log in Amazon web services platform.

Exploring the auto configured API Gateway API

You can also check the API Gateway console to see what’s been created and configured for you automatically. Go to the service console first.

An image showing the location of API gateway in Amazon web services platform.

Then click on the API, OpsGenieJiraIntegrationAPI, and explore what’s been setup for you. Note that we could have created an API from scratch and associate it with the Lambda function from the API Gateway console but the Lambda console provided us a shortcut and managed some details itself.

An image showing where to create api for Jira integration.



Problems you may encounter would be likely because of configuration of your Jira installation. Jira is a flexible system and some of the features that seem central to it may not be part of your installation or they may be configured differently or the user accessing the API may not have necessary permissions to use them.

Our Lambda function has three assumptions about your installation and they are hardcoded in the code:

  • There is an issue type named ‘Bug’

  • Progress on issues can be started and the transition id for this action is ‘4’.

  • Issues can be closed and the transition id for this action is ‘2’.
    You may need to change these values to make the code run smoothly against your installation.

To see available issue types you can invoke the following call against the REST API endpoint of your Jira installation:


To see available transitions on a particular issue, you can invoke the following call against the REST API endpoint of your Jira installation:


The type of the Jira projects created to accompany this document are Jira Default Schemes.

A screenshot showing where the jira project for integration is created.

Still need help?

The Atlassian Community is here for you.