• Products
  • Get started
  • Documentation
  • Resources

Opsgenie CloudFormation Resources

 

AWS CloudFormation provides an extensible Infrastructure as Code (IaC) capability which gives developers and businesses an easy way to create a collection of related AWS and third-party resources, and provision and manages them in an orderly and predictable fashion.

Using these capabilities, Atlassian Opsgenie has created its own Custom Resource types, namely:

1 2 3 4 5 Atlassian::Opsgenie::User Atlassian::Opsgenie::Team Atlassian::Opsgenie::Integration

These schemas can be leveraged by the CloudFormation users to potentially simplify the configuration of their Opsgenie and AWS environments.

Defining Opsgenie custom resources

To create resources using Opsgenie custom resource type, you will need:

  1. An AWS account to run CloudFormation stack operations.

  2. An Opsgenie account to create your resources.

  3. Optionally, you will need AWS CloudFormation CLI to perform CRUD operations in your stack.

There are two ways to enable Opsgenie Resource types:

  • You can use the resource types by enabling Opsgenie third-party resources from AWS third-party Registry in your AWS Account. Please follow this link to understand more.

  • You can publish these resources to your Private Registry. For more information go to Opsgenie's open source Github repository.

What are Opsgenie Custom Resources?

User

Atlassian::Opsgenie::User

This resource type allows creating user entities/resources in Opsgenie via the Amazon CloudFormation Registry console or CLI. User Resource supports three configurable properties (out of the ones mentioned in the Opsgenie API Docs) for the sake of simplicity along with the required Endpoint and ApiKey properties.

 

Property

Description

Required

Limit

ApiKey

Your Opsgenie provided API Key

Required

 

Endpoint

Endpoint of API according to your preferred environment

Required

Limited to one of the following:

Username

E-mail address of the user

Required

100 chars

Fullname

Name of the user

Required

512 chars

Role

Role of user

Required

Limited to one of the following:

  • Owner

  • Admin

  • User

  • Any custom Role created by you

Exported Properties
Following property is generated once your resource is created.

Property

Description

Id

Unique Id of the user that is used to reference the user entity

 

Example:

Following is an example of Opsgenie User Resource stack.json.

One thing to note; you can pass OpsgenieApiKey as a reference parameter which can be populated at the time of stack creation.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 { "AWSTemplateFormatVersion": "2010-09-09", "Description": "OG user", "Parameters": { "OpsgenieApiKey":{ "Description":"Enter Opsgenie Api Key", "Type":"String" }, }, "Resources": { "TestUser": { "Type": "Atlassian::Opsgenie::User", "Properties": { "OpsgenieApiKey": {"Ref": "OpsgenieApiKey"}, "OpsgenieApiEndpoint": "https://api.opsgenie.com", "Username": "test-user@opsgenie.com", "FullName": "test user", "Role": "User" } } } }


Team

Atlassian::Opsgenie::Team


This resource type allows you to create Team Resources/Entities in Opsgenie via Amazon CloudFormation Registry and CLI. You can also add team members, which are existing Opsgenie users. The Team Resource supports all the fields available in Opsgenie's Team entity, as can be seen in the Create Team section of the Team API.

 
Supported Properties

Property

Description

Required

Limit

ApiKey

Your Opsgenie provided API Key

Required

 

Endpoint

Endpoint of API according to your preferred environment

Required

Limited to one of the following:

Name

Name of the team

Required

100 chars

Description

The description of team

Optional

10000 chars

Members

The list of opsgenie users to be added to Team entity.

Optional

Refer to the Members properties table below for more details.

Members Properties:
Following are the properties available for configuration under the Members property of Opsgenie's Team Resource. For more details view What are teams in Opsgenie.

Property

Description

Required

Limit

UserId

User identifier

Required

 

Role

Role of user

Required

Limited to one of the following:

  • Owner

  • Admin

  • User

  • Any custom Role created by you

 

Example:

Following is an example of Opsgenie Team Resource stack.json file.

One thing to note; you can pass OpsgenieApiKey and OpsgenieApiEndpoint as a reference parameter that can be populated at the time of stack creation.

Also, make sure that the UserId already exists.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 { "AWSTemplateFormatVersion": "2010-09-09", "Description": "Opsgenie Test Users", "Parameters": { "ApiKey": { "Description": "Enter Opsgenie Api Key", "Type": "String" }, "ApiEndpoint": { "Description": "Enter Opsgenie Api endpoint", "Type": "String", "Default": "https://api.opsgenie.com", "AllowedValues": [ "https://api.opsgenie.com", "https://api.eu.opsgenie.com", "https://api.sandbox.opsgenie.com" ] } }, "Resources": { "TeamA": { "Type": "Atlassian::Opsgenie::Team", "Properties": { "OpsgenieApiKey": { "Ref": "ApiKey" }, "OpsgenieApiEndpoint": { "Ref": "ApiEndpoint" }, "Name": "uuuii-test-team-ops", "Description": "Test team with 2 user for demonstration", "Members": [ { "UserId": "04461d66-6ec6-4632-9904-f5429aec9535", "Role": "user" } ] } } } }

 

Integration

Atlassian::Opsgenie::Integration


This resource type allows the creation of an Opsgenie Integration which is then associated with an Opsgenie Team as integration owners. This resource allows Opsgenie's incident management capabilities to your third-party tools used in your technology stack. Learn more about Opsgenie's integrations.

 

Opsgenie's Integration resource properties reflect Opsgenie's Integration entity parameters which you can find more about in the Integration API.

Supported properties:

Property

Description

Required

Limit

ApiKey

Your Opsgenie provided API Key

Required

 

Endpoint

Endpoint of API according to your preferred environment

Required

Limited to one of the following:

Enabled

This parameter is for specifying whether the integration will be enabled or not. Defaults to true

Required

Boolean value with default value as true.

Name

Name of the integration

Required

Name must be unique for each integration.

IntegrationType

The API integration supported tool that is to be created. List of integrations on Opsgenie's Integrations page

Required

Can only create API integrations. Please filter by API in the list of integrations shown in your Opsgenie console to know which integrations are supported.

OwnerTeamId

The identifier of the team associated with the integration

Required

 

OwnerTeamName

The name of the team associated with the integration

Optional

 

AllowReadAccess

This parameter is for configuring the read access of integration. If read access is restricted, the integration will not be authorised to read within any domain.

Optional

Boolean value defaults to true.

AllowWriteAccess

This parameter is for configuring the write access of integration. If write access is restricted, the integration will not be authorised to write within any domain.

Optional

Boolean value defaults to true.

AllowDeleteAccess

This parameter is for configuring the delete access of integration. If delete access is restricted, the integration will not be authorised to delete within any domain.

Optional

Boolean value with default value as true.

AllowConfigurationAccess

This parameter is for allowing or restricting the configuration access. If configuration access is restricted, the integration will be limited to Alert API requests, Incident API requests and sending heartbeats.

Optional

Boolean value with default value as true.

Responders

Optional user, schedule, teams or escalation names to calculate which users will receive the notifications of the alert. Responders which are exceeding the limit are ignored.

Refer to the Responders properties table below.

Optional

 

 

Responder Properties:
These properties are available for configuration under the Responder property of Opsgenie's Integration resource:

Property

Description

Required

Limit

Type

The responder entity associated with the integration's alerts.

Required

Limited to one of the following:

  • Schedule

  • Team

  • User

Name

Name of the schedule or team acting as responder to the alerts generated by the integration

Required

 

Username

Name of the user acting as responder to the alerts generated by the integration

Required

 

 

Exported Properties
Generated after the creation of the resource.

Property

Description

Id

Unique identifier of the integration created

IntegrationApiKey

The integration's API key auto-generated

 

Example:

Following is an example of Opsgenie Integration Resource stack.json file.

One thing to note: you can pass OpsgenieApiKey and OpsgenieApiEndpoint as a reference parameter which can be populated at the time of stack creation.

Also, make sure that the Name/Username already exists before adding it to the list of responders.

 

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 { "AWSTemplateFormatVersion": "2010-09-09", "Description": "Opsgenie Integration", "Parameters": { "OpsgenieApiKey": { "Description": "Enter Opsgenie Api Key", "Type": "String" }, "OpsgenieEndpoint": { "Description": "Enter Opsgenie Api URL", "Type": "String" } }, "Resources": { "IntegrationTest": { "Type": "Atlassian::Opsgenie::Integration", "Properties": { "OpsgenieApiKey": { "Ref": "OpsgenieApiKey" }, "OpsgenieApiEndpoint": { "Ref": "OpsgenieEndpoint" }, "IntegrationType": "Marid", "Name": "test maridint", "Enabled":true } } } }

 

Create your own Opsgenie Resources

Let's create:

  • Two users using Atlassian::Opsgenie::User resource type schema.

  • A team using Atlassian::Opsgenie::Team with those users.

  • An Opsgenie SNS integration using Atlassian::Opsgenie::Integration of an SNS topic with a subscription.

The resource .json file would look something like the example below.

Once you have created the stack.json file, you can create your stacks using AWS console or AWS CLI

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 { "AWSTemplateFormatVersion": "2010-09-09", "Description": "Opsgenie Test Users", "Parameters": { "OpsgenieApiKey": { "Description": "Enter Opsgenie Api Key", "Type": "String" }, "OpsgenieApiEndpoint": { "Description": "Enter Opsgenie Api endpoint", "Type": "String", "Default": "https://api.opsgenie.com", "AllowedValues": [ "https://api.opsgenie.com", "https://api.eu.opsgenie.com", "https://api.sandbox.opsgenie.com" ] } }, "Resources": { "UserA": { "Type": "Atlassian::Opsgenie::User", "Properties": { "ApiKey": { "Ref": "OpsgenieApiKey" }, "Endpoint": { "Ref": "OpsgenieApiEndpoint" }, "Username": "opsgenie-user1@opsgenie.com", "FullName": "user one", "Role": "User" } }, "UserB": { "Type": "Atlassian::Opsgenie::User", "Properties": { "ApiKey": { "Ref": "OpsgenieApiKey" }, "Endpoint": { "Ref": "OpsgenieApiEndpoint" }, "Username": "opsgenie-user2@opsgenie.com", "FullName": "user two", "Role": "User" } }, "TeamA": { "Type": "Atlassian::Opsgenie::Team", "Properties": { "ApiKey": { "Ref": "OpsgenieApiKey" }, "ApiEndpoint": { "Ref": "OpsgenieApiEndpoint" }, "Name": "uuu-test-team-ops", "Description": "Test team with 2 user for demonstration", "Members": [ { "UserId": { "Ref": "UserA" }, "Role": "user" }, { "UserId": { "Ref": "UserB" }, "Role": "user" } ] }, "DependsOn": [ "UserA", "UserB" ] }, "IntegrationTest": { "Type": "Atlassian::Opsgenie::Integration", "Properties": { "ApiKey": { "Ref": "OpsgenieApiKey" }, "Endpoint": { "Ref": "OpsgenieApiEndpoint" }, "IntegrationType": "AmazonSns", "Name": "test awsSns", "Responders": [ { "type": "team", "name": { "Fn::GetAtt": [ "TeamA", "Name" ] } } ], "Enabled": true }, "DependsOn": [ "TeamA" ] }, "MySns": { "Type": "AWS::SNS::Topic", "Properties": { "DisplayName": "opsgenie-test-aws", "Subscription": [ { "Endpoint": { "Fn::Join": [ "", [ { "Ref": "OpsgenieApiEndpoint" }, "/v1/json/amazonsns?apiKey=", { "Fn::GetAtt": [ "IntegrationTest", "IntegrationApiKey" ] } ] ] }, "Protocol": "https" } ], "TopicName": "opsgenie-test-demo" }, "DependsOn": [ "IntegrationTest" ] } } }

 

 

Last modified on Jun 22, 2021
Cached at 4:13 AM on Oct 21, 2021 |

Additional Help