PutOrganizationConfigRule
Adds or updates organization config rule for your entire organization evaluating whether your AWS resources comply with your desired configurations.
Only a master account and a delegated administrator can create or update an organization
config rule.
When calling this API with a delegated administrator, you must ensure AWS Organizations
ListDelegatedAdministrator
permissions are added.
This API enables organization service access through the EnableAWSServiceAccess
action and creates a service linked
role AWSServiceRoleForConfigMultiAccountSetup
in the master or delegated administrator account of your organization.
The service linked role is created only when the role does not exist in the caller
account.
AWS Config verifies the existence of role with GetRole
action.
To use this API with delegated administrator, register a delegated administrator by
calling AWS Organization
register-delegated-administrator
for config-multiaccountsetup.amazonaws.com
.
You can use this action to create both custom AWS Config rules and AWS managed Config
rules.
If you are adding a new custom AWS Config rule, you must first create AWS Lambda
function in the master account or a delegated
administrator that the rule invokes to evaluate your resources.
When you use the PutOrganizationConfigRule
action to add the rule to AWS Config, you must
specify the Amazon Resource Name (ARN) that AWS Lambda assigns to the function.
If you are adding an AWS managed Config rule, specify the rule's identifier for
the RuleIdentifier
key.
The maximum number of organization config rules that AWS Config supports is 150 and 3 delegated administrator per organization.
Prerequisite: Ensure you call EnableAllFeatures
API to enable all features in an organization.
Specify either OrganizationCustomRuleMetadata
or OrganizationManagedRuleMetadata
.
Request Syntax
{
"ExcludedAccounts": [ "string
" ],
"OrganizationConfigRuleName": "string
",
"OrganizationCustomRuleMetadata": {
"Description": "string
",
"InputParameters": "string
",
"LambdaFunctionArn": "string
",
"MaximumExecutionFrequency": "string
",
"OrganizationConfigRuleTriggerTypes": [ "string
" ],
"ResourceIdScope": "string
",
"ResourceTypesScope": [ "string
" ],
"TagKeyScope": "string
",
"TagValueScope": "string
"
},
"OrganizationManagedRuleMetadata": {
"Description": "string
",
"InputParameters": "string
",
"MaximumExecutionFrequency": "string
",
"ResourceIdScope": "string
",
"ResourceTypesScope": [ "string
" ],
"RuleIdentifier": "string
",
"TagKeyScope": "string
",
"TagValueScope": "string
"
}
}
Request Parameters
For information about the parameters that are common to all actions, see Common Parameters.
The request accepts the following data in JSON format.
- ExcludedAccounts
-
A comma-separated list of accounts that you want to exclude from an organization config rule.
Type: Array of strings
Array Members: Minimum number of 0 items. Maximum number of 1000 items.
Pattern:
\d{12}
Required: No
- OrganizationConfigRuleName
-
The name that you assign to an organization config rule.
Type: String
Length Constraints: Minimum length of 1. Maximum length of 64.
Pattern:
.*\S.*
Required: Yes
- OrganizationCustomRuleMetadata
-
An
OrganizationCustomRuleMetadata
object.Type: OrganizationCustomRuleMetadata object
Required: No
- OrganizationManagedRuleMetadata
-
An
OrganizationManagedRuleMetadata
object.Type: OrganizationManagedRuleMetadata object
Required: No
Response Syntax
{
"OrganizationConfigRuleArn": "string"
}
Response Elements
If the action is successful, the service sends back an HTTP 200 response.
The following data is returned in JSON format by the service.
- OrganizationConfigRuleArn
-
The Amazon Resource Name (ARN) of an organization config rule.
Type: String
Length Constraints: Minimum length of 1. Maximum length of 256.
Errors
For information about the errors that are common to all actions, see Common Errors.
- InsufficientPermissionsException
-
Indicates one of the following errors:
-
For PutConfigRule, the rule cannot be created because the IAM role assigned to AWS Config lacks permissions to perform the config:Put* action.
-
For PutConfigRule, the AWS Lambda function cannot be invoked. Check the function ARN, and check the function's permissions.
-
For PutOrganizationConfigRule, organization config rule cannot be created because you do not have permissions to call IAM
GetRole
action or create a service linked role. -
For PutConformancePack and PutOrganizationConformancePack, a conformance pack cannot be created because you do not have permissions:
-
To call IAM
GetRole
action or create a service linked role. -
To read Amazon S3 bucket.
-
HTTP Status Code: 400
-
- InvalidParameterValueException
-
One or more of the specified parameters are invalid. Verify that your parameters are valid and try again.
HTTP Status Code: 400
- MaxNumberOfOrganizationConfigRulesExceededException
-
You have reached the limit of the number of organization config rules you can create.
HTTP Status Code: 400
- NoAvailableOrganizationException
-
Organization is no longer available.
HTTP Status Code: 400
- OrganizationAccessDeniedException
-
For
PutConfigurationAggregator
API, you can see this exception for the following reasons:-
No permission to call
EnableAWSServiceAccess
API -
The configuration aggregator cannot be updated because your AWS Organization management account or the delegated administrator role changed. Delete this aggregator and create a new one with the current AWS Organization.
-
The configuration aggregator is associated with a previous AWS Organization and AWS Config cannot aggregate data with current AWS Organization. Delete this aggregator and create a new one with the current AWS Organization.
-
You are not a registered delegated administrator for AWS Config with permissions to call
ListDelegatedAdministrators
API. Ensure that the management account registers delagated administrator for AWS Config service principle name before the delegated administrator creates an aggregator.
For all
OrganizationConfigRule
andOrganizationConformancePack
APIs, AWS Config throws an exception if APIs are called from member accounts. All APIs must be called from organization master account.HTTP Status Code: 400
-
- OrganizationAllFeaturesNotEnabledException
-
AWS Config resource cannot be created because your organization does not have all features enabled.
HTTP Status Code: 400
- ResourceInUseException
-
You see this exception in the following cases:
-
For DeleteConfigRule, AWS Config is deleting this rule. Try your request again later.
-
For DeleteConfigRule, the rule is deleting your evaluation results. Try your request again later.
-
For DeleteConfigRule, a remediation action is associated with the rule and AWS Config cannot delete this rule. Delete the remediation action associated with the rule before deleting the rule and try your request again later.
-
For PutConfigOrganizationRule, organization config rule deletion is in progress. Try your request again later.
-
For DeleteOrganizationConfigRule, organization config rule creation is in progress. Try your request again later.
-
For PutConformancePack and PutOrganizationConformancePack, a conformance pack creation, update, and deletion is in progress. Try your request again later.
-
For DeleteConformancePack, a conformance pack creation, update, and deletion is in progress. Try your request again later.
HTTP Status Code: 400
-
- ValidationException
-
The requested action is not valid.
For PutStoredQuery, you will see this exception if there are missing required fields or if the input value fails the validation, or if you are trying to create more than 300 queries.
For GetStoredQuery, ListStoredQuery, and DeleteStoredQuery you will see this exception if there are missing required fields or if the input value fails the validation.
HTTP Status Code: 400
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following: