Opsgenie CloudFormation リソース
Opsgenie CloudFormation リソース
AWS CloudFormation では、拡張可能なコードとしてのインフラストラクチャ (IaC) 機能を提供します。これによって、開発者や企業は、関連する AWS リソースとサードパーティのリソースのコレクションを簡単に作成して、整然とした予測可能な方法でプロビジョニングして管理できます。
Atlassian Opsgenie では、これらの機能を使用して独自のカスタム リソース タイプを作成しました。
Atlassian::Opsgenie::User
Atlassian::Opsgenie::Team
Atlassian::Opsgenie::Integrationこれらのスキーマを活用すると、CloudFormation ユーザーが Opsgenie 環境と AWS 環境の設定を簡素化できます。
設定の最新バージョンは us-west-2 と eu-central-1 リージョンでのみ利用可能です。
Opsgenie カスタム リソースの定義
Opsgenie カスタム リソース タイプを使用してリソースを作成するには、次が必要です。
CloudFormation スタック オペレーションを実行するための AWS アカウント。
リソースを作成するための Opsgenie アカウント。
スタックで CRUD オペレーションを実行するための AWS CloudFormation CLI (オプション)。
認証情報は、AWS CLIまたは AWS コンソールいずれかで設定する必要があります。リソース モデル内では設定できません。
例
CloudFormation CLI
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 コンソール
AWS コンソールで関連する CloudFormation リソースをアクティブ化する間、またはアクティブ化した後に構成を渡します。
{
"OpsgenieCredentials": {
"OpsgenieApiEndpoint": <API_ENDPOINT>,
"OpsgenieApiKey": "<API_KEY>"
}
}Opsgenie リソース タイプを有効にするには、次の 2 つの方法があります。
AWS アカウントで AWS サードパーティ レジストリの Opsgenie サードパーティ リソースを有効にすると、リソース タイプを使用できます。詳細については、このリンクをご参照ください。
You can publish these resources to your Private Registry. For more information go to Opsgenie's open source Github repository.
Opsgenie カスタム リソースとは何ですか?
ユーザー
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.
プロパティ | 説明 | 必須 | limit |
|---|---|---|---|
ユーザ名 | ユーザーのメール アドレス | 必須 | 100 文字 |
氏名 | ユーザーの名前 | 必須 | 512 文字 |
役割 | ユーザーのロール | 必須 | 次のいずれかに限定されます。
|
エクスポートされるプロパティ
リソースが作成されると、次のプロパティが生成されます。
プロパティ | 説明 |
|---|---|
ID | ユーザーエンティティを参照するために使用されるユーザーの一意の ID |
例:
Opsgenie ユーザー リソース stack.json の例をご参照ください。
スタック作成時に設定できる参照パラメーターとして OpsgenieApiKey を渡せる点にご注意ください。
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "OG user",
"Resources": {
"TestUser": {
"Type": "Atlassian::Opsgenie::User",
"Properties": {
"Username": "test-user@opsgenie.com",
"FullName": "test user",
"Role": "User"
}
}
}
}
チーム
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.
サポートされているプロパティ
プロパティ | 説明 | 必須 | limit |
|---|---|---|---|
名前 | チームの名前 | 必須 | 100 文字 |
説明 | チームの説明 | 任意 | 10,000 文字 |
members | Opsgenie ユーザーのリストをチーム エンティティに追加する | 任意 | 詳細については、以下のメンバー プロパティの表をご参照ください。 |
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.
プロパティ | 説明 | 必須 | limit |
|---|---|---|---|
userid | ユーザー識別子 | 必須 |
|
役割 | ユーザーのロール | 必須 | 次のいずれかに限定されます。
|
例:
Opsgenie チーム リソース stack.json ファイルの例をご参照ください。
スタック作成時に設定できる参照パラメーターとして OpsgenieApiKey と OpsgenieApiEndpoint を渡せる点にご注意ください。
また、UserID が既に存在していることを確認してください。
{
"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"
}
]
}
}
}
}
連携
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.
サポートされているプロパティは次のとおりです。
プロパティ | 説明 | 必須 | limit |
|---|---|---|---|
有効 | このパラメーターは、インテグレーションを有効にするかどうかを指定するためのものです。既定で true に設定されます。 | 必須 | デフォルト値が true のブール値。 |
名前 | インテグレーションの名前 | 必須 | 名前は、インテグレーションごとに一意である必要があります。 |
統合タイプ | The API integration supported tool that is to be created. List of integrations on Opsgenie's Integrations page | 必須 | API 統合のみを作成できます。サポートされる統合を確認するには、Opsgenie コンソールに表示される統合のリストを |
OwnerTeamId | インテグレーションに関連付けられているチームの識別子 | 必須 |
|
OwnerTeamName | インテグレーションに関連付けられているチームの名前 | 任意 |
|
AllowReadAccess | このパラメーターは、統合の読み取りアクセスを設定するためのものです。読み取りアクセスが制限されている場合、統合はどのドメイン内でも読み取りを許可されません。 | 任意 | ブール値は既定でtrueに設定されます。 |
AllowWriteAccess | このパラメーターは、統合の書き込みアクセスを設定するためのものです。書き込みアクセスが制限されている場合、統合はどのドメイン内にも書き込みを許可されません。 | 任意 | ブール値は既定でtrueに設定されます。 |
AllowDeleteAccess | このパラメーターは、統合の削除アクセスを設定するためのものです。削除アクセスが制限されている場合、統合はどのドメイン内でも削除を許可されません。 | 任意 | デフォルト値が true のブール値。 |
AllowConfigurationAccess | このパラメーターは、設定アクセスを許可または制限するためのものです。設定アクセスが制限されている場合、インテグレーションはアラート API リクエスト、インシデント API リクエスト、およびハートビートの送信に制限されます。 | 任意 | デフォルト値が true のブール値。 |
対応者 | アラートの通知を受信するユーザーを計算するためのオプションのユーザー、スケジュール、チーム、またはエスカレーションの名前。制限を超えている対応者は無視されます。 以下の対応者プロパティの表をご参照ください。 | 任意 |
|
対応者プロパティ:
次のプロパティは、Opsgenie の統合リソースの Responder プロパティで設定できます。
プロパティ | 説明 | 必須 | limit |
|---|---|---|---|
タイプ | インテグレーションのアラートに関連付けられている対応者エンティティ。 | 必須 | 次のいずれかに限定されます。
|
名前 | インテグレーションによって生成されたアラートの対応者となるスケジュールまたはチームの名前 | 必須 |
|
ユーザ名 | インテグレーションによって生成されたアラートの対応者となるユーザーの名前 | 必須 |
|
エクスポートされるプロパティ
リソースの作成後に生成されます。
プロパティ | 説明 |
|---|---|
ID | 作成されたインテグレーションの一意の識別子 |
IntegrationApiKey | 自動生成されるインテグレーションの API キー |
例:
Opsgenie インテグレーション リソース stack.json ファイルの例をご参照ください。
スタック作成時に設定できる参照パラメーターとして OpsgenieApiKey と OpsgenieApiEndpoint を渡せる点にご注意ください。
また、対応者のリストに追加する前に、名前/ユーザー名がすでに存在していることを確認してください。
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Opsgenie Integration",
"Resources": {
"IntegrationTest": {
"Type": "Atlassian::Opsgenie::Integration",
"Properties": {
"IntegrationType": "Marid",
"Name": "test maridint",
"Enabled":true
}
}
}
}独自の Opsgenie リソースを作成する
次を作成してみましょう。
Atlassian::Opsgenie::Userリソース タイプ スキーマを使用している 2 人のユーザー。Atlassian::Opsgenie::Teamをそれらのユーザーと共に使用しているチーム。SNS トピックとサブスクリプションの
Atlassian::Opsgenie::Integrationを使用している Opsgenie SNS 統合。
リソース .json ファイルは以下のようになります。
Once you have created the stack.json file, you can create your stacks using AWS console or AWS CLI
{
"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"
]
}
}
}
この内容はお役に立ちましたか?