• Products
  • Get started
  • Documentation
  • Resources

Opsgenie CloudFormation 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 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.

The latest version of the configuration is only available in the us-west-2 and eu-central-1 regions.

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.

Credentials must be set either through the AWS CLI or the AWS Console. It isn’t possible to set them within resource models.

Examples

CloudFormation CLI

1 2 3 4 5 6 aws cloudformation set-type-configuration \ --region $REGION \ --type RESOURCE \ --type-name $RESOURCE_NAME \ --configuration-alias default \ --configuration { "OpsgenieCredentials": { "OpsgenieApiEndpoint": "$API_ENDPOINT", "OpsgenieApiKey": "$API_KEY" }}

AWS Console

Pass the configuration during or after the activation of related CloudFormation resources in the AWS Console.

1 2 3 4 5 6 { "OpsgenieCredentials": { "OpsgenieApiEndpoint": <API_ENDPOINT>, "OpsgenieApiKey": "<API_KEY>" } }

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

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
The 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 { "AWSTemplateFormatVersion": "2010-09-09", "Description": "OG user", "Resources": { "TestUser": { "Type": "Atlassian::Opsgenie::User", "Properties": { "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

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 { "AWSTemplateFormatVersion": "2010-09-09", "Description": "Opsgenie Test Users", "Resources": { "TeamA": { "Type": "Atlassian::Opsgenie::Team", "Properties": { "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

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 { "AWSTemplateFormatVersion": "2010-09-09", "Description": "Opsgenie Integration", "Resources": { "IntegrationTest": { "Type": "Atlassian::Opsgenie::Integration", "Properties": { "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 { "AWSTemplateFormatVersion": "2010-09-09", "Description": "Opsgenie Test Users", "Resources": { "UserA": { "Type": "Atlassian::Opsgenie::User", "Properties": { "Username": "opsgenie-user1@opsgenie.com", "FullName": "user one", "Role": "User" } }, "UserB": { "Type": "Atlassian::Opsgenie::User", "Properties": { "Username": "opsgenie-user2@opsgenie.com", "FullName": "user two", "Role": "User" } }, "TeamA": { "Type": "Atlassian::Opsgenie::Team", "Properties": { "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": { "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" ] } } }

 

Still need help?

The Atlassian Community is here for you.