Creates a compliance package for an account group.
Operation Description
You can use your management account to create up to five compliance packages for each account group.
This topic provides an example on how to create a compliance package named ClassifiedProtectionPreCheck for the ca-f632626622af0079****
account group. The compliance package contains the eip-bandwidth-limit
managed rule.
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action
policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- The required resource types are displayed in bold characters.
- If the permissions cannot be granted at the resource level,
All Resources
is used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
Operation | Access level | Resource type | Condition key | Association operation |
---|---|---|---|---|
config:CreateAggregateCompliancePack | Write |
|
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
CompliancePackTemplateId | string | No | The ID of the compliance package template. For more information about how to obtain the ID of a compliance package template, see ListCompliancePackTemplates. | ct-5f26ff4e06a300c4**** |
CompliancePackName | string | Yes | The name of the compliance package. | |
Description | string | Yes | The description of the compliance package. | |
RiskLevel | integer | Yes | The risk level of the resources that are not compliant with the rules in the compliance package. Valid values:
| 1 |
AggregatorId | string | Yes | The ID of the account group. For more information about how to obtain the ID of an account group, see ListAggregators. | ca-f632626622af0079**** |
ConfigRules | array | Yes | The rules in the compliance package. | |
object | No | |||
ManagedRuleIdentifier | string | No | The ID of the managed rule. Cloud Config automatically create a managed rule of the specified ID and adds the rule to the compliance package. You only need to configure the | eip-bandwidth-limit |
ConfigRuleName | string | No | The name of the rule. | |
ConfigRuleParameters | array | No | The details of the input parameter of the rule. | |
object | No | |||
ParameterName | string | No | The name of the input parameter. You must configure the | bandwidth |
ParameterValue | string | No | The value of the input parameter. You must configure the | 10 |
ConfigRuleId | string | No | The ID of the rule. If you configure this parameter, Cloud Config adds the rule of the specified ID to the compliance package. You only need to configure the | cr-e918626622af000f**** |
Description | string | No | The description of the rule. | |
RiskLevel | integer | No | The risk level of the resources that are not compliant with the rule. Valid values:
| 1 |
ClientToken | string | No | The client token that you want to use to ensure the idempotency of the request. You can use the client to generate the value, but you must ensure that it is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length.`` | 1594295238-f9361358-5843-4294-8d30-b5183fac**** |
DefaultEnable | boolean | No | Specifies whether to enable the rule together with the compliance package. Valid values:
| false |
RegionIdsScope | string | No | The ID of the region whose resources you want to evaluate by using the compliance package. Separate multiple region IDs with commas (,). | cn-hangzhou |
ExcludeResourceIdsScope | string | No | The ID of the resource that you do not want to evaluate by using the compliance package. Separate multiple resource IDs with commas (,). | eip-8vbf3x310fn56ijfd**** |
ResourceGroupIdsScope | string | No | The ID of the resource group whose resources you want to evaluate by using the compliance package. Separate multiple resource group IDs with commas (,). | rg-aekzc7r7rhx**** |
TagKeyScope | string | No | The tag key of the resource that you want to evaluate by using the compliance package. | ECS |
TagValueScope | string | No | The tag value of the resource that you want to evaluate by using the compliance package. NoteYou must configure the TagValueScope parameter together with the TagKeyScope parameter. | test |
For more information about common request parameters, see Common parameters.
Response parameters
Examples
Sample success responses
JSON
format
{
"CompliancePackId": "cp-fc56626622af00f9****",
"RequestId": "CC0CE5EB-E51E-48EB-B4AB-9A9E131ECC0F"
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | CompliancePackExists | The compliance pack already exists. | The compliance pack name already exists. |
400 | Invalid.AggregatorId.Value | The specified AggregatorId is invalid. | The specified aggregator ID does not exist or you are not authorized to use the aggregator. |
400 | CompliancePackExceedMaxCount | The maximum number of compliance pack is exceeded. | The maximum number of compliance pack is exceeded. |
400 | Invalid.CompliancePackName.Value | The specified CompliancePackName is invalid. | The specified compliance pack name is invalid. |
400 | Invalid.CompliancePackTemplateId.Value | The specified CompliancePackTemplateId does not exist. | The specified compliance pack template ID does not exist. |
400 | Invalid.ConfigRules.Empty | You must specify ConfigRules. | You must specify ConfigRules. |
400 | Invalid.ConfigRules.Value | The specified ConfigRules is invalid. | The specified ConfigRules is invalid. |
400 | ConfigRuleExceedMaxRuleCount | The maximum number of config rules is exceeded. | The maximum number of config rules is exceeded. |
403 | AggregatorMemberNoPermission | The aggregator member is not authorized to perform the operation. | The aggregator member is not authorized to perform the operation. |
404 | AccountNotExisted | Your account does not exist. | The specified account does not exist. |
503 | ServiceUnavailable | The request has failed due to a temporary failure of the server. | The request has failed due to a temporary failure of the server. |
For a list of error codes, visit the Service error codes.