为指定账号组创建合规包。
接口说明
合规包是一组规则的集合。新建合规包时,您可以选择合规包模板中的默认规则,也可以选择规则模板和已有规则列表中的规则。
新建合规包后,这些规则默认会执行一次评估,后续将根据规则的触发机制自动触发评估,也可以手动执行评估。
合规包模板是配置审计根据合规场景定制的一组规则的集合。
本文将提供一个示例,为账号组ca-f632626622af0079****通过合规包模板ClassifiedProtectionPreCheck(等保三级预检合规包)创建一个合规包。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
|
操作 |
访问级别 |
资源类型 |
条件关键字 |
关联操作 |
|
config:CreateAggregateCompliancePack |
create |
*AggregateCompliancePack
|
无 | 无 |
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| CompliancePackTemplateId |
string |
否 |
合规包模板 ID。 关于如何获取合规包模板 ID,请参见 ListCompliancePackTemplates 。 |
ct-5f26ff4e06a300c4**** |
| CompliancePackName |
string |
是 |
合规包名称。 |
等保三级预检合规包 |
| Description |
string |
否 |
合规包描述。 |
基于等保三级的部分要求,对阿里云上资源的合规性做检测。 |
| RiskLevel |
integer |
否 |
合规包风险等级。取值:
|
2 |
| AggregatorId |
string |
是 |
账号组 ID。 关于如何获取账号组 ID,请参见 ListAggregators 。 |
ca-f632626622af0079**** |
| ConfigRules |
array<object> |
否 |
合规包中的规则列表。 说明
本参数和 |
|
|
array<object> |
否 |
无 |
||
| ManagedRuleIdentifier |
string |
否 |
规则模板标识。配置审计根据规则模板标识自动创建规则,并将该规则加入到当前合规包中。
|
eip-bandwidth-limit |
| ConfigRuleName |
string |
否 |
规则名称。 |
弹性IP实例带宽满足最低要求 |
| ConfigRuleParameters |
array<object> |
否 |
规则参数信息。 |
|
|
object |
否 |
无 |
||
| ParameterName |
string |
否 |
规则参数名称。 参数 |
bandwidth |
| ParameterValue |
string |
否 |
规则参数值。 参数 |
10 |
| ConfigRuleId |
string |
否 |
规则 ID。配置审计将已有规则加入到当前合规包中。
|
cr-e918626622af000f**** |
| Description |
string |
否 |
规则描述。 |
弹性公网已绑定到ECS或者NAT实例,非闲置状态,视为“合规”。 |
| RiskLevel |
integer |
否 |
规则风险等级。取值:
|
1 |
| TemplateContent |
string |
否 |
用于生成合规包的模板信息。模板内容可以从已有合规包详情 API 中查看,或者参考编写配置化合规包模板进行编写。 说明
本参数和 |
{ "configRuleTemplates": [ { "configRuleName": "自定义条件规则示例", "scope": { "complianceResourceTypes": [ "ACS::ECS::Instance" ] }, "description": "", "source": { "owner": "CUSTOM_CONFIGURATION", "identifier": "acs-config-configuration", "sourceDetails": [ { "messageType": "ScheduledNotification", "maximumExecutionFrequency": "Twelve_Hours" }, { "messageType": "ConfigurationItemChangeNotification" } ], "conditions": "{\"ComplianceConditions\":\"{\\\"operator\\\":\\\"and\\\",\\\"children\\\":[{\\\"operator\\\":\\\"GreaterOrEquals\\\",\\\"featurePath\\\":\\\"$.Cpu\\\",\\\"featureSource\\\":\\\"CONFIGURATION\\\",\\\"desired\\\":\\\"2\\\"}]}\"}" }, "inputParameters": {} }, { "configRuleName": "OSS存储空间Referer在指定的防盗链白名单中", "scope": { "complianceResourceTypes": [ "ACS::OSS::Bucket" ] }, "description": "OSS存储空间开启防盗链并且Referer在指定白名单中,视为“合规”。", "source": { "owner": "ALIYUN", "identifier": "oss-bucket-referer-limit", "sourceDetails": [ { "messageType": "ConfigurationItemChangeNotification" } ] }, "inputParameters": { "allowEmptyReferer": "true", "allowReferers": "http://www.aliyun.com" } } ] } |
| ClientToken |
string |
否 |
保证请求幂等性。从您的客户端生成一个参数值,确保不同请求间该参数值唯一。 |
1594295238-f9361358-5843-4294-8d30-b5183fac**** |
| DefaultEnable |
boolean |
否 |
规则是否支持快速启用。取值:
|
false |
| RegionIdsScope |
string |
否 |
合规包仅对指定地域 ID 中的资源生效。多个地域 ID 之间用半角逗号(,)分隔。 |
cn-hangzhou |
| ExcludeRegionIdsScope |
string |
否 |
合规包对指定地域内资源无效,即不对该地域内资源执行评估。多个地域 ID 之间用半角逗号(,)分隔。 |
cn-shanghai |
| ExcludeResourceIdsScope |
string |
否 |
合规包对指定资源 ID 无效,即不对该资源执行评估。多个资源 ID 之间用半角逗号(,)分隔。 |
eip-8vbf3x310fn56ijfd**** |
| ResourceIdsScope |
string |
否 |
规则对指定资源 ID 生效。多个资源 ID 之间用半角逗号(,)分隔。 |
lb-5cmbowstbkss9ta03**** |
| ResourceGroupIdsScope |
string |
否 |
合规包仅对指定资源组 ID 中的资源生效。多个资源组 ID 之间用半角逗号(,)分隔。 |
rg-aekzc7r7rhx**** |
| ExcludeResourceGroupIdsScope |
string |
否 |
规则对指定资源组 ID 中的资源无效,即不对该资源组内的资源评估。多个资源组 ID 之间用半角逗号(,)分隔。 |
rg-bnczc6r7rml**** |
| TagKeyScope |
string |
否 |
合规包仅对绑定指定标签键的资源生效。 |
ECS |
| TagValueScope |
string |
否 |
合规包仅对绑定指定标签键值对的资源生效。 说明
TagValueScope 需结合 TagKeyScope 一起使用。 |
test |
| TagsScope |
array<object> |
否 |
生效标签。 |
|
|
object |
否 |
|||
| TagKey |
string |
否 |
资源的标签键。 |
tagKey1 |
| TagValue |
string |
否 |
资源的标签值。 |
tagValue1 |
| ExcludeTagsScope |
array<object> |
否 |
排除标签。 |
|
|
object |
否 |
排除的标签范围 |
||
| TagKey |
string |
否 |
资源的标签键。 |
4 |
| TagValue |
string |
否 |
资源的标签值。 |
user |
| Tag |
array<object> |
否 |
资源的标签。 最多支持绑定 20 个标签。 |
|
|
object |
否 |
资源的标签。 最多支持绑定 20 个标签。 |
||
| Key |
string |
否 |
资源的标签键。 最多支持绑定 20 个标签键。 |
key-1 |
| Value |
string |
否 |
资源的标签值。 最多支持绑定 20 个标签值。 |
value-1 |
关于公共请求参数的详情,请参见公共参数。
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
object |
无 |
||
| CompliancePackId |
string |
合规包 ID。 |
cp-fc56626622af00f9**** |
| RequestId |
string |
请求 ID。 |
CC0CE5EB-E51E-48EB-B4AB-9A9E131ECC0F |
示例
正常返回示例
JSON格式
{
"CompliancePackId": "cp-fc56626622af00f9****",
"RequestId": "CC0CE5EB-E51E-48EB-B4AB-9A9E131ECC0F"
}
错误码
|
HTTP status code |
错误码 |
错误信息 |
描述 |
|---|---|---|---|
| 400 | CompliancePackExists | The compliance pack already exists. | 合规包名称重复。 |
| 400 | Invalid.AggregatorId.Value | The specified AggregatorId is invalid. | 账号组ID不存在或无权限使用该账号组。 |
| 400 | CompliancePackExceedMaxCount | The maximum number of compliance pack is exceeded. | |
| 400 | Invalid.CompliancePackName.Value | The specified CompliancePackName is invalid. | 合规包名称格式不符合要求。 |
| 400 | Invalid.CompliancePackTemplateId.Value | The specified CompliancePackTemplateId does not exist. | 合规包模板ID不存在。 |
| 400 | Invalid.ConfigRules.Empty | You must specify ConfigRules. | |
| 400 | Invalid.ConfigRules.Value | The specified ConfigRules is invalid. | 合规包规则中参数输入错误。 |
| 400 | ConfigRuleExceedMaxRuleCount | The maximum number of config rules is exceeded. | |
| 403 | AggregatorMemberNoPermission | The aggregator member is not authorized to perform the operation. | 账号组内的成员账号无权限执行此操作。 |
| 404 | AccountNotExisted | Your account does not exist. | |
| 503 | ServiceUnavailable | The request has failed due to a temporary failure of the server. | 服务不可用。 |
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。