Cloud Config では、コンフィギュレーションファイルでコンプライアンスパッケージテンプレートを作成できます。Cloud Config でサポートされているマネージドルール、またはビジネス要件に基づいて作成した条件ルールを含むコンプライアンスパッケージテンプレートを定義、インポート、およびエクスポートできます。これは、ビジネスのコンプライアンスを管理するための強力なツールを提供します。このトピックでは、ビジネス要件に基づいてコンプライアンスルールのセットを効率的に定義できるように、コンプライアンスパッケージテンプレートの構造とパラメーターについて説明します。
テンプレート構造
コンプライアンスパッケージテンプレートは JSON ファイルでエクスポートされます。ファイル名はコンプライアンスパッケージの名前で、ファイル名拡張子は .json です。.txt または .json ファイルでコンプライアンスパッケージテンプレートをインポートできます。ファイルサイズは 1 MB を超えることはできません。ファイルの内容は、compliancePackTemplate(オプション)と configRuleTemplates(必須)の 2 つの部分で構成されます。
compliancePackTemplate
compliancePackTemplate には、コンプライアンスパッケージの名前、説明、およびリスクレベルが含まれます。JSON 形式の構文:
{
"riskLevel": 1,
"compliancePackName": "The name of the compliance package", // コンプライアンスパッケージの名前
"description": "The description of the compliance package", // コンプライアンスパッケージの説明
"scope": {
"complianceResourceTypes": [
"The resource types to which the rule is applicable" // ルールが適用可能なリソースタイプ
],
"complianceResourceIds": [
"The ID of the evaluated resource" // 評価対象リソースの ID
],
"complianceExcludeResourceIds": [
"The ID of the excluded resource" // 除外対象リソースの ID
],
"complianceRegionIds": [
"The ID of the evaluated region" // 評価対象リージョンの ID
],
"complianceExcludeRegionIds": [
"The ID of the excluded region" // 除外対象リージョンの ID
],
"complianceResourceGroupIds": [
"The ID of the evaluated resource group" // 評価対象リソースグループの ID
],
"complianceExcludeResourceGroupIds": [
"The ID of the excluded resource group" // 除外対象リソースグループの ID
],
"complianceTagsScope": [
{
"tagKey": "The effective tag key", // 有効なタグキー
"tagValue": "The effective tag value" // 有効なタグ値
}
],
"complianceExcludeTagsScope": [
{
"tagKey": "The excluded tag key", // 除外対象のタグキー
"tagValue": "The excluded tag value" // 除外対象のタグ値
}
]
}
}パラメーター | 必須 | 説明 |
compliancePackName | いいえ | コンプライアンスパッケージの名前。コンプライアンスシナリオに基づいて名前を指定することをお勧めします。コンプライアンスパッケージの名前は、次のルールに基づいて決定されます。
|
riskLevel | いいえ | コンプライアンスパッケージのリスクレベル。このパラメーターは、さまざまなコンプライアンスパッケージの重要度を区別するために使用されます。有効な値:
|
description | いいえ | コンプライアンスパッケージの説明。このパラメーターは、コンプライアンスパッケージのアプリケーションシナリオを説明するために使用されます。 |
scope | いいえ | ルールの適用範囲。 |
例:
{
"configRuleTemplates": [],
"compliancePackTemplate": {
"riskLevel": 2,
"compliancePackName": "Write a compliance package template in a configuration file", // コンフィギュレーションファイルでコンプライアンスパッケージテンプレートを作成する
"scope": {
"complianceResourceIds": [
"i-t4n3u1pz97547xg****.i-t4n3u1pz97547xg0****.",
"i-t4n1bxf3xr70wjh5****",
"i-t4n133q6k9czgun****",
"i-t4n3s3qqti2zaxu****"
],
"complianceResourceGroupIds": [
"rg-aek2yl36l*****"
],
"complianceTagsScope": [
{
"tagKey": "config",
"tagValue": "configTest"
}
],
"complianceRegionIds": [
"ap-southeast-1"
]
},
"description": "Performs the import and export testing for writing a compliance package template in a configuration file." // コンフィギュレーションファイルでコンプライアンスパッケージテンプレートを作成するためのインポートとエクスポートのテストを実行します。
}
}configRuleTemplates
configRuleTemplates には、コンプライアンスパッケージのルールが含まれています。ルールは JSON ARRAY タイプです。構文:
[
{
"configRuleName": "The name of the rule", // ルールの名前
"riskLevel": 3,
"scope": {
"complianceResourceTypes": [
"The resource types to which the rule is applicable" // ルールが適用可能なリソースタイプ
],
"complianceResourceIds": [
"The ID of the evaluated resource" // 評価対象リソースの ID
],
"complianceExcludeResourceIds": [
"The ID of the excluded resource" // 除外対象リソースの ID
],
"complianceRegionIds": [
"The ID of the evaluated region" // 評価対象リージョンの ID
],
"complianceExcludeRegionIds": [
"The ID of the excluded region" // 除外対象リージョンの ID
],
"complianceResourceGroupIds": [
"The ID of the evaluated resource group" // 評価対象リソースグループの ID
],
"complianceExcludeResourceGroupIds": [
"The ID of the excluded resource group" // 除外対象リソースグループの ID
],
"complianceTagsScope": [
{
"tagKey": "The effective tag key", // 有効なタグキー
"tagValue": "The effective tag value" // 有効なタグ値
}
],
"complianceExcludeTagsScope": [
{
"tagKey": "The excluded tag key", // 除外対象のタグキー
"tagValue": "The excluded tag value" // 除外対象のタグ値
}
]
},
"description": "The description of the rule", // ルールの説明
"source": {
"owner": "The source of the rule", // ルールのソース
"identifier": "The identifier of the rule", // ルールの識別子
"sourceDetails": [
{
"messageType": "The trigger type of the rule", // ルールのトリガータイプ
"maximumExecutionFrequency": "The interval at which the rule is triggered" // ルールがトリガーされる間隔
},
{
"messageType": "The trigger type of the rule" // ルールのトリガータイプ
}
],
"conditions": "The content of the condition rule" // 条件ルールの内容
},
"inputParameters": {
"paramName1": "The value of the paramName1 parameter", // paramName1 パラメーターの値
"paramName2": "The value of the paramName2 parameter" // paramName2 パラメーターの値
}
}
]パラメーター | 必須 | 説明 |
configRuleName | はい | ルールの名前。 |
scope.complianceResourceTypes | はい | ルールが適用可能なリソースタイプ。値は JSON 配列です。 |
description | いいえ | ルールの説明。 |
source.owner | はい | ルールのソース。有効な値:
|
source.identifier | はい | ルールの識別子。値はルールのソースによって異なります。
|
source.sourceDetails.messageType | はい | ルールのトリガータイプ。有効な値:
|
source.sourceDetails.maximumExecutionFrequency | いいえ | ルールがトリガーされる間隔。有効な値:
説明
|
source.conditions | いいえ | 条件ルールの内容。 説明
|
inputParameters | いいえ | ルールの入力パラメーター。マネージドルールの入力パラメーターについては、「マネージドルール」の対応するリンクをクリックし、「ルールの詳細」セクションの「入力パラメーター」項目の説明をご参照ください。すべての入力パラメーターは STRING タイプです。入力パラメータールールの詳細 |
scope | いいえ | ルールの適用範囲。 |
riskLevel | いいえ | ルールのリスクレベル。有効な値:
|
例:
{
"configRuleTemplates": [
{
"configRuleName": "ecs-instance-deletion-protection-enabled",
"riskLevel": 3,
"scope": {
"complianceResourceIds": [
"i-t4n3u1pz97547xg0****.i-t4n3u1pz97547xg0****",
"i-t4n1bxf3xr70wjh5****",
"i-t4n133q6k9czgun****",
"i-t4n3s3qqti2zaxu****"
],
"complianceResourceGroupIds": [
"rg-aek2yl36lg****"
],
"complianceTagsScope": [
{
"tagKey": "config",
"tagValue": "configTest"
}
],
"complianceRegionIds": [
"ap-southea****"
],
"complianceResourceTypes": [
"ACS::ECS::Instance"
]
},
"description": "Checks whether the release protection feature is enabled for each Elastic Compute Service (ECS) instance. If so, the evaluation result is Compliant.", // 各 Elastic Compute Service (ECS) インスタンスでリリース保護機能が有効になっているかどうかを確認します。有効になっている場合、評価結果は準拠です。
"source": {
"owner": "ALIYUN",
"identifier": "ecs-instance-deletion-protection-enabled",
"sourceDetails": [
{
"messageType": "ConfigurationItemChangeNotification"
}
]
},
"inputParameters": {}
}
],
"compliancePackTemplate": {
"riskLevel": 2,
"compliancePackName": "Write a compliance package template in a configuration file", // コンフィギュレーションファイルでコンプライアンスパッケージテンプレートを作成する
"scope": {
"complianceResourceIds": [
"i-t4n3u1pz97547xg****.i-t4n3u1pz97547xg****",
"i-t4n1bxf3xr70wjh5****",
"i-t4n133q6k9czgunx****",
"i-t4n3s3qqti2zaxux****"
],
"complianceResourceGroupIds": [
"rg-aek2yl36lgo****"
],
"complianceTagsScope": [
{
"tagKey": "config",
"tagValue": "configTest"
}
],
"complianceRegionIds": [
"ap-southeast-1"
]
},
"description": "Performs the import and export testing for writing a compliance package template in a configuration file." // コンフィギュレーションファイルでコンプライアンスパッケージテンプレートを作成するためのインポートとエクスポートのテストを実行します。
}
}例
{
"configRuleTemplates": [
{
"configRuleName": "ecs-instance-chargetype-check",
"riskLevel": 3,
"scope": {
"complianceResourceIds": [
"i-t4n3u1pz97547xg0****.i-t4n3u1pz97547xg*****",
"i-t4n1bxf3xr70wjh5*****",
"i-t4n133q6k9czgun*****",
"i-t4n3s3qqti2zaxu*****"
],
"complianceResourceGroupIds": [
"rg-aek2yl36l*****"
],
"complianceTagsScope": [
{
"tagKey": "config",
"tagValue": "configTest"
}
],
"complianceRegionIds": [
"ap-southeast-1"
],
"complianceResourceTypes": [
"ACS::ECS::Instance"
]
},
"description": "Checks whether the billing method of each ECS instance is subscription. If so, the evaluation result is Compliant.", // 各 ECS インスタンスの課金方法がサブスクリプションであるかどうかを確認します。そうである場合、評価結果は準拠です。
"source": {
"owner": "ALIYUN",
"identifier": "ecs-instance-chargetype-check",
"sourceDetails": [
{
"messageType": "ConfigurationItemChangeNotification"
}
]
},
"inputParameters": {}
},
{
"configRuleName": "ecs-public-access-check",
"riskLevel": 3,
"scope": {
"complianceResourceIds": [
"i-t4n3u1pz97547x*****.i-t4n3u1pz97547*****",
"i-t4n1bxf3xr70w*****",
"i-t4n133q6k9czg*****",
"i-t4n3s3qqti2zax******"
],
"complianceResourceGroupIds": [
"rg-aek2yl36l*****"
],
"complianceTagsScope": [
{
"tagKey": "config",
"tagValue": "configTest"
}
],
"complianceRegionIds": [
"ap-southeast-1"
],
"complianceResourceTypes": [
"ACS::ECS::Instance"
]
},
"description": "Checks whether a public IPv4 address or an EIP is specified for each ECS instance. If not, the evaluation result is Compliant.", // 各 ECS インスタンスにパブリック IPv4 アドレスまたは EIP が指定されているかどうかを確認します。指定されていない場合、評価結果は準拠です。
"source": {
"owner": "ALIYUN",
"identifier": "ecs-instance-no-public-ip",
"sourceDetails": [
{
"messageType": "ConfigurationItemChangeNotification"
}
]
},
"inputParameters": {}
},
{
"configRuleName": "ecs-instance-deletion-protection-enabled",
"riskLevel": 3,
"scope": {
"complianceResourceIds": [
"i-t4n3u1pz9754*****.i-t4n3u1pz97547x*****",
"i-t4n1bxf3xr70wj*****",
"i-t4n133q6k9czgu*****",
"i-t4n3s3qqti2zaxu*****"
],
"complianceResourceGroupIds": [
"rg-aek2yl36l****"
],
"complianceTagsScope": [
{
"tagKey": "config",
"tagValue": "configTest"
}
],
"complianceRegionIds": [
"ap-southeast-1"
],
"complianceResourceTypes": [
"ACS::ECS::Instance"
]
},
"description": "Checks whether the release protection feature is enabled for each ECS instance. If so, the evaluation result is Compliant.", // 各 ECS インスタンスでリリース保護機能が有効になっているかどうかを確認します。有効になっている場合、評価結果は準拠です。
"source": {
"owner": "ALIYUN",
"identifier": "ecs-instance-deletion-protection-enabled",
"sourceDetails": [
{
"messageType": "ConfigurationItemChangeNotification"
}
]
},
"inputParameters": {}
}
],
"compliancePackTemplate": {
"riskLevel": 2,
"compliancePackName": "Write a compliance package template in a configuration file", // コンフィギュレーションファイルでコンプライアンスパッケージテンプレートを作成する
"scope": {
"complianceResourceIds": [
"i-t4n3u1pz97547xg0*****.i-t4n3u1pz97547xg******",
"i-t4n1bxf3xr70w******",
"i-t4n133q6k9czgun*****",
"i-t4n3s3qqti2zaxux*****"
],
"complianceResourceGroupIds": [
"rg-aek2yl36l******"
],
"complianceTagsScope": [
{
"tagKey": "config",
"tagValue": "configTest"
}
],
"complianceRegionIds": [
"ap-southeast-1"
]
},
"description": "Performs the import and export testing for writing a compliance package template in a configuration file." // コンフィギュレーションファイルでコンプライアンスパッケージテンプレートを作成するためのインポートとエクスポートのテストを実行します。
}
}コンプライアンスパッケージテンプレートのインポートとエクスポート
.json または .txt ファイルのコンプライアンスパッケージテンプレートを Cloud Config にインポートできます。また、.json ファイルでコンプライアンスパッケージテンプレートをエクスポートすることもできます。その後、エクスポートされたテンプレートを共有およびバックアップできます。これは、ルールを柔軟かつ便利に管理するのに役立ちます。