DevOps Just Got a Whole Lot Easier with Opsgenie and AWS CloudFormation Registry and CLI

Today AWS announced the release of an extension to its AWS CloudFormation service in the form of AWS CloudFormation Registry and AWS CloudFormation CLI. Opsgenie is a proud launch partner of the service extension. Users can now leverage Opsgenie’s CloudFormation Registry and CLI support to better their IaC capabilities in their AWS environments. Atlassian and AWS have strong partnerships across the suite. Opsgenie’s AWS CloudFormation Registry and CLI support is just another example of that. What does this mean for you? DevOps just got a whole lot easier in the cloud.

AWS CloudFormation and IaC

IaC, short for Infrastructure as Code, is the practice whereby resources are provisioned via programmable defined scripts as compared to using management consoles to manually create environments of resources. This means there is no need to navigate around configuration UIs. For example, Opsgenie Incident Management is brought directly to your AWS cloud infrastructure. There is no need to switch between the two management consoles. In general, IaC is imperative for a full DevOps experience. The question now is, what services does the largest cloud vendor out there, AWS, provide in terms of IaC? Enter AWS CloudFormation.

AWS CloudFormation allows you to define the desired AWS resources required along with their configurations and connections in blueprint documents called AWS CloudFormation templates. These templates then run within the AWS CloudFormation console to provision the defined infrastructure.

However, provisioning third-party resources was a challenge. This is where the new release of AWS CloudFormation Registry comes in. AWS CloudFormation Registry now allows the provisioning of these external third-party tools along with other AWS resources, and Opsgenie is proud to be one of the first SaaS tools to facilitate this. With Opsgenie’s support for AWS CloudFormation Registry and CLI, you can now provision Opsgenie resources such as users, teams, and integrations along with your AWS resources. Hence you can automate configuring Opsgenie incident management services into your AWS infrastructure.

This means that we can now further benefit from DevOps practices as AWS has extended its IaC services over external technology stacks, not only limited to AWS. Moreover, these external AWS CloudFormation resources are opensource so the community can constantly build more custom resources that can be provisioned automatically with the AWS CloudFormation Registry. This enhances development in the cloud, especially when using an AWS stack.

Opsgenie’s CloudFormation Registry and CLI Support

As a result of Opsgenie offering its resources on AWS CloudFormation Registry, there are several possibilities that we can achieve when developing in the cloud. Hence explaining the importance that Opsgenie demonstrated in ensuring that it allowed its users to secure the IaC benefits of AWS CloudFormation via the new release. Three crucial Opsgenie resources are currently available which can be provisioned via AWS CloudFormation templates. These include:

  • User
  • Team
  • Integration

Opsgenie decided to introduce these three entities as AWS CloudFormation resources in the initial stage as they are the core resources found in almost all use-cases, and constantly having to configure them can become tedious. Setting up your Opsgenie environment is a lot easier since Opsgenie’s core resources are available as AWS CloudFormation resources. We’re working to roll out more resources in upcoming releases, so stay tuned.

Automated Opsgenie Integrations with AWS

While speedily provisioning users and teams is compelling, one of the biggest benefits of using Opsgenie and AWS CloudFormation Registry and CLI is easily provisioning integrations between the two. For example, using the AWS CloudFormation template you can now configure an EC2 instance in AWS along with an EC2 integration on the Opsgenie side and associate it with a team. This means that you can always ensure that incident management is available to your AWS resources—regardless of the scale of your infrastructure.

When it comes to AWS integrations in Opsgenie, you were required to create an SNS topic and follow all the steps associated with that. It was a quick process but the context switching and repetition added time. Now you can bypass the tedious configurations by simply using AWS CloudFormation templates to provision your entire infrastructure. Including associating SNS topics with existing AWS resources and adding integrations to an existing team, as well as adding Opsgenie when you provision new resources.

A Real Integration Use Case

Let’s walk through the process so you can see how easy it really is.

Getting Your Users Ready

First, create resources for your users.

{
	"Marlin": {
		"Type": "Atlassian::Opsgenie::User",
		"Properties": {
			"ApiKey": {
				"Ref": "OpsgenieApiKey"
			},
			"Endpoint": {
				"Ref": "OpsgenieApiEndpoint"
			},
			"Username": "opsgenie-user1@opsgenie.com",
			"FullName": "Marlin The ClownFish",
			"Role": "User"
		}
	},
	"Dory": {
		"Type": "Atlassian::Opsgenie::User",
		"Properties": {
			"ApiKey": {
				"Ref": "OpsgenieApiKey"
			},
			"Endpoint": {
				"Ref": "OpsgenieApiEndpoint"
			},
			"Username": "opsgenie-user2@opsgenie.com",
			"FullName": "Dont Remember",
			"Role": "User"
		}
	}
}

 

As can be seen in the CloudFormation template above, apart from the expected user fields, you would also pass in your Opsgenie API Key and Opsgenie API Endpoint. You can read all about the configurable User properties here.

Setting Up Your Team

Now that you have your users, you could create a team with these users. Using the supported Opsgenie AWS CloudFormation resource, your AWS CloudFormation template would look similar to the template below:

{
	"NemoSearchParty": {
		"Type": "Atlassian::Opsgenie::Team",
		"Properties": {
			"ApiKey": {
				"Ref": "OpsgenieApiKey"
			},
			"ApiEndpoint": {
				"Ref": "OpsgenieApiEndpoint"
			},
			"Name": "uuu-test-team-ops",
			"Description": "Search party to find Nemo",
			"Members": [{
					"UserId": {
						"Ref": "Marlin"
					},
					"Role": "admin"
				},
				{
					"UserId": {
						"Ref": "Dory"
					},
					"Role": "user"
				}
			]
		}
	}
}

You can find out more about the configurable properties of Opsgenie’s Team resource here.

Setting up SNS Topic and Required Integration

Finally, we can set up the SNS topic and have the HTTPS subscription.

{
	"CommunicationsIntegration": {
		"Type": "Atlassian::Opsgenie::Integration",
		"Properties": {
			"ApiKey": {
				"Ref": "OpsgenieApiKey"
			},
			"Endpoint": {
				"Ref": "OpsgenieApiEndpoint"
			},
			"IntegrationType": "AmazonSns",
			"Name": "test awsSns",
			"Responders": [{
				"type": "team",
				"name": {
					"Fn::GetAtt": [
						"NemoSearchParty",
						"Name"
					]
				}
			}],
			"Enabled": true
		},
		"DependsOn": [
			"TeamA"
		]
	},
	"CommunicationsSNS": {
		"Type": "AWS::SNS::Topic",
		"Properties": {
			"DisplayName": "opsgenie-test-aws",
			"Subscription": [{
				"Endpoint": {
					"Fn::Join": [
						"",
						[{
								"Ref": "OpsgenieApiEndpoint"
							},
							"/v1/json/amazonsns?apiKey=",
							{
								"Fn::GetAtt": [
									"CommunicationsIntegration",
									"IntegrationApiKey"
								]
							}
						]
					]
				},
				"Protocol": "https"
			}],
			"TopicName": "nemo-search-comms"
		},
		"DependsOn": [
			"CommunicationsIntegration"
		]
	}
}

Find out more about the configurable properties of Opsgenie’s Integration resource here.

One thing to note here is the DependsOn property added at the end of the SNS resource definition. This is a property within the AWS Cloudformation template that enforces the order of resource creation. If we were to add all of our resource definitions into a single template file, we would also use the `DependsOn` property for the Team and Integration resource definitions. This is because the Team resource would be dependant on the two users being created first, and the Integration resource would be dependant on the creation of the Team resource for its Responders field.

Create Stack

Finally, once we have our templates defined, we can upload them to the AWS CloudFormation console, and hit 'Create Stack' and see all our required resources come to life for us.

 1.png2.png3.png

Going Further with Opsgenie and CloudFormation Registry and CLI

Using AWS CloudFormation templates with Opsgenie help you to save time, reduce errors, and cut back on repetitive work. Overtime infrastructure becomes more complex and small changes can lead to outages, or issues. Utilizing AWS CloudFormation templates reduces this risk and reassures the state of the infrastructure. Easily replicated Opsgenie’s Incident Management across your environments brings observability to the cloud without spending time on configuring for each test.
As DevOps evolves IaC has become an integral component. AWS CloudFormation makes it possible, easier, and less risky to build sophisticated architecture in the cloud. 

 

For more information on getting started with AWS CloudFormation Registry and CLI using Opsgenie, please visit the Opsgenie Documentation pages here.

TAGS
AUG Leaders

Atlassian Community Events