Skip to content

put_organization_conformance_pack async

put_organization_conformance_pack(
    organization_conformance_pack_name: OrganizationConformancePackName,
    *,
    config_overrides: Optional[AsyncConfigServiceClientConfig] = None,
    template_s3_uri: Optional[TemplateS3Uri] = None,
    template_body: Optional[TemplateBody] = None,
    delivery_s3_bucket: Optional[DeliveryS3Bucket] = None,
    delivery_s3_key_prefix: Optional[DeliveryS3KeyPrefix] = None,
    conformance_pack_input_parameters: Optional[ConformancePackInputParameters] = None,
    excluded_accounts: Optional[ExcludedAccounts] = None,
    tags: Optional[TagsList] = None,
) -> PutOrganizationConformancePackResponse

Deploys conformance packs across member accounts in an Amazon Web Services Organization. For information on how many organization conformance packs and how many Config rules you can have per account, see Service Limits in the Config Developer Guide.

Only a management account and a delegated administrator can call this API. When calling this API with a delegated administrator, you must ensure Organizations ListDelegatedAdministrator permissions are added. An organization can have up to 3 delegated administrators.

When you use PutOrganizationConformancePack to deploy conformance packs across member accounts, the operation can create Config rules and remediation actions without requiring config:PutConfigRule or config:PutRemediationConfigurations permissions in member account IAM policies.

This API uses the AWSServiceRoleForConfigConforms service-linked role in each member account to create conformance pack resources. This service-linked role includes the permissions to create Config rules and remediation configurations, even if member account IAM policies explicitly deny these actions.

This API enables organization service access for config-multiaccountsetup.amazonaws.com through the EnableAWSServiceAccess action and creates a service-linked role AWSServiceRoleForConfigMultiAccountSetup in the management or delegated administrator account of your organization. The service-linked role is created only when the role does not exist in the caller account. To use this API with delegated administrator, register a delegated administrator by calling Amazon Web Services Organization register-delegate-admin for config-multiaccountsetup.amazonaws.com.

Prerequisite: Ensure you call EnableAllFeatures API to enable all features in an organization.

You must specify either the TemplateS3Uri or the TemplateBody parameter, but not both. If you provide both Config uses the TemplateS3Uri parameter and ignores the TemplateBody parameter.

Config sets the state of a conformance pack to CREATE_IN_PROGRESS and UPDATE_IN_PROGRESS until the conformance pack is created or updated. You cannot update a conformance pack while it is in this state.

Parameters:

  • organization_conformance_pack_name (OrganizationConformancePackName) –

    Name of the organization conformance pack you want to create.

  • template_s3_uri (Optional[TemplateS3Uri], default: None ) –

    Location of file containing the template body. The uri must point to the conformance pack template (max size: 300 KB).

    You must have access to read Amazon S3 bucket. In addition, in order to ensure a successful deployment, the template object must not be in an archived storage class if this parameter is passed.

  • template_body (Optional[TemplateBody], default: None ) –

    A string that contains the full conformance pack template body. Structure containing the template body with a minimum length of 1 byte and a maximum length of 51,200 bytes.

  • delivery_s3_bucket (Optional[DeliveryS3Bucket], default: None ) –

    The name of the Amazon S3 bucket where Config stores conformance pack templates.

    This field is optional. If used, it must be prefixed with awsconfigconforms.

  • delivery_s3_key_prefix (Optional[DeliveryS3KeyPrefix], default: None ) –

    The prefix for the Amazon S3 bucket.

    This field is optional.

  • conformance_pack_input_parameters (Optional[ConformancePackInputParameters], default: None ) –

    A list of ConformancePackInputParameter objects.

  • excluded_accounts (Optional[ExcludedAccounts], default: None ) –

    A list of Amazon Web Services accounts to be excluded from an organization conformance pack while deploying a conformance pack.

  • tags (Optional[TagsList], default: None ) –

    The tags for the organization conformance pack. Each tag consists of a key and an optional value, both of which you define.

Raises:

  • InsufficientPermissionsException –

    Indicates one of the following errors:

    • For PutConfigRule, the rule cannot be created because the IAM role assigned to Config lacks permissions to perform the config:Put* action.

    • For PutConfigRule, the 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 the following permissions:

      • You do not have permission to call IAM GetRole action or create a service-linked role.

      • You do not have permission to read Amazon S3 bucket or call SSM:GetDocument.

    • For PutServiceLinkedConfigurationRecorder, a service-linked configuration recorder cannot be created because you do not have the following permissions: IAM CreateServiceLinkedRole.

    • For PutConnector, a connector cannot be created because you do not have the following permissions: IAM CreateServiceLinkedRole.

  • MaxNumberOfOrganizationConformancePacksExceededException –

    You have reached the limit of the number of organization conformance packs you can create in an account. For more information, see Service Limits in the Config Developer Guide.

  • NoAvailableOrganizationException –

    Organization is no longer available.

  • 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 Amazon Web Services Organization management account or the delegated administrator role changed. Delete this aggregator and create a new one with the current Amazon Web Services Organization.

    • The configuration aggregator is associated with a previous Amazon Web Services Organization and Config cannot aggregate data with current Amazon Web Services Organization. Delete this aggregator and create a new one with the current Amazon Web Services Organization.

    • You are not a registered delegated administrator for Config with permissions to call ListDelegatedAdministrators API. Ensure that the management account registers delagated administrator for Config service principal name before the delegated administrator creates an aggregator.

    For all OrganizationConfigRule and OrganizationConformancePack APIs, Config throws an exception if APIs are called from member accounts. All APIs must be called from organization management account.

  • OrganizationAllFeaturesNotEnabledException –

    Config resource cannot be created because your organization does not have all features enabled.

  • OrganizationConformancePackTemplateValidationException –

    You have specified a template that is not valid or supported.

  • ResourceInUseException –

    You see this exception in the following cases:

    • For DeleteConfigRule, 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 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.

  • ValidationException –

    The requested operation is not valid. You will see this exception if there are missing required fields or if the input value fails the validation.

    For PutStoredQuery, one of the following errors:

    • There are missing required fields.

    • The input value fails the validation.

    • You are trying to create more than 300 queries.

    For DescribeConfigurationRecorders and DescribeConfigurationRecorderStatus, one of the following errors:

    • You have specified more than one configuration recorder.

    • You have provided a service principal for service-linked configuration recorder that is not valid.

    For AssociateResourceTypes and DisassociateResourceTypes, one of the following errors:

    • Your configuraiton recorder has a recording strategy that does not allow the association or disassociation of resource types.

    • One or more of the specified resource types are already associated or disassociated with the configuration recorder.

    • For service-linked configuration recorders, the configuration recorder does not record one or more of the specified resource types.

    For DeleteServiceLinkedConfigurationRecorder, one of the following errors:

    • You have provided both Arn and ServicePrincipal. Only one of Arn or ServicePrincipal can be specified.

    • You have provided a service principal for service-linked configuration recorder that is not valid.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_config_service/_services/async_config_service.py
async def put_organization_conformance_pack(
    self,
    organization_conformance_pack_name: "capo_config_service.types.organization_conformance_pack_name.OrganizationConformancePackName",
    *,
    config_overrides: Optional[AsyncConfigServiceClientConfig] = None,
    template_s3_uri: Optional[
        "capo_config_service.types.template_s3_uri.TemplateS3Uri"
    ] = None,
    template_body: Optional[
        "capo_config_service.types.template_body.TemplateBody"
    ] = None,
    delivery_s3_bucket: Optional[
        "capo_config_service.types.delivery_s3_bucket.DeliveryS3Bucket"
    ] = None,
    delivery_s3_key_prefix: Optional[
        "capo_config_service.types.delivery_s3_key_prefix.DeliveryS3KeyPrefix"
    ] = None,
    conformance_pack_input_parameters: Optional[
        "capo_config_service.types.conformance_pack_input_parameters.ConformancePackInputParameters"
    ] = None,
    excluded_accounts: Optional[
        "capo_config_service.types.excluded_accounts.ExcludedAccounts"
    ] = None,
    tags: Optional["capo_config_service.types.tags_list.TagsList"] = None,
) -> "capo_config_service.types.put_organization_conformance_pack_response.PutOrganizationConformancePackResponse":
    """<p>Deploys conformance packs across member accounts in an Amazon Web Services Organization. For information on how many organization conformance packs and how many Config rules you can have per account, see <a href="https://docs.aws.amazon.com/config/latest/developerguide/configlimits.html"> <b>Service Limits</b> </a> in the <i>Config Developer Guide</i>.</p> <p>Only a management account and a delegated administrator can call this API. When calling this API with a delegated administrator, you must ensure Organizations <code>ListDelegatedAdministrator</code> permissions are added. An organization can have up to 3 delegated administrators.</p> <important> <p>When you use <code>PutOrganizationConformancePack</code> to deploy conformance packs across member accounts, the operation can create Config rules and remediation actions without requiring <code>config:PutConfigRule</code> or <code>config:PutRemediationConfigurations</code> permissions in member account IAM policies.</p> <p>This API uses the <code>AWSServiceRoleForConfigConforms</code> service-linked role in each member account to create conformance pack resources. This service-linked role includes the permissions to create Config rules and remediation configurations, even if member account IAM policies explicitly deny these actions.</p> </important> <p>This API enables organization service access for <code>config-multiaccountsetup.amazonaws.com</code> through the <code>EnableAWSServiceAccess</code> action and creates a service-linked role <code>AWSServiceRoleForConfigMultiAccountSetup</code> in the management or delegated administrator account of your organization. The service-linked role is created only when the role does not exist in the caller account. To use this API with delegated administrator, register a delegated administrator by calling Amazon Web Services Organization <code>register-delegate-admin</code> for <code>config-multiaccountsetup.amazonaws.com</code>.</p> <note> <p>Prerequisite: Ensure you call <code>EnableAllFeatures</code> API to enable all features in an organization.</p> <p>You must specify either the <code>TemplateS3Uri</code> or the <code>TemplateBody</code> parameter, but not both. If you provide both Config uses the <code>TemplateS3Uri</code> parameter and ignores the <code>TemplateBody</code> parameter.</p> <p>Config sets the state of a conformance pack to CREATE_IN_PROGRESS and UPDATE_IN_PROGRESS until the conformance pack is created or updated. You cannot update a conformance pack while it is in this state.</p> </note>

    Args:
        organization_conformance_pack_name: <p>Name of the organization conformance pack you want to create.</p>
        template_s3_uri: <p>Location of file containing the template body. The uri must point to the conformance pack template (max size: 300 KB).</p> <note> <p>You must have access to read Amazon S3 bucket. In addition, in order to ensure a successful deployment, the template object must not be in an <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/storage-class-intro.html">archived storage class</a> if this parameter is passed.</p> </note>
        template_body: <p>A string that contains the full conformance pack template body. Structure containing the template body with a minimum length of 1 byte and a maximum length of 51,200 bytes.</p>
        delivery_s3_bucket: <p>The name of the Amazon S3 bucket where Config stores conformance pack templates.</p> <note> <p>This field is optional. If used, it must be prefixed with <code>awsconfigconforms</code>.</p> </note>
        delivery_s3_key_prefix: <p>The prefix for the Amazon S3 bucket.</p> <note> <p>This field is optional.</p> </note>
        conformance_pack_input_parameters: <p>A list of <code>ConformancePackInputParameter</code> objects.</p>
        excluded_accounts: <p>A list of Amazon Web Services accounts to be excluded from an organization conformance pack while deploying a conformance pack.</p>
        tags: <p>The tags for the organization conformance pack. Each tag consists of a key and an optional value, both of which you define.</p>

    Raises:
        capo_config_service.errors.insufficient_permissions_exception.InsufficientPermissionsException: <p>Indicates one of the following errors:</p> <ul> <li> <p>For <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_PutConfigRule.html">PutConfigRule</a>, the rule cannot be created because the IAM role assigned to Config lacks permissions to perform the config:Put* action.</p> </li> <li> <p>For <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_PutConfigRule.html">PutConfigRule</a>, the Lambda function cannot be invoked. Check the function ARN, and check the function's permissions.</p> </li> <li> <p>For <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_PutOrganizationConfigRule.html">PutOrganizationConfigRule</a>, organization Config rule cannot be created because you do not have permissions to call IAM <code>GetRole</code> action or create a service-linked role.</p> </li> <li> <p>For <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_PutConformancePack.html">PutConformancePack</a> and <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_PutOrganizationConformancePack.html">PutOrganizationConformancePack</a>, a conformance pack cannot be created because you do not have the following permissions: </p> <ul> <li> <p>You do not have permission to call IAM <code>GetRole</code> action or create a service-linked role.</p> </li> <li> <p>You do not have permission to read Amazon S3 bucket or call SSM:GetDocument.</p> </li> </ul> </li> <li> <p>For <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_PutServiceLinkedConfigurationRecorder.html">PutServiceLinkedConfigurationRecorder</a>, a service-linked configuration recorder cannot be created because you do not have the following permissions: IAM <code>CreateServiceLinkedRole</code>.</p> </li> <li> <p>For <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_PutConnector.html">PutConnector</a>, a connector cannot be created because you do not have the following permissions: IAM <code>CreateServiceLinkedRole</code>.</p> </li> </ul>
        capo_config_service.errors.max_number_of_organization_conformance_packs_exceeded_exception.MaxNumberOfOrganizationConformancePacksExceededException: <p>You have reached the limit of the number of organization conformance packs you can create in an account. For more information, see <a href="https://docs.aws.amazon.com/config/latest/developerguide/configlimits.html"> <b>Service Limits</b> </a> in the <i>Config Developer Guide</i>.</p>
        capo_config_service.errors.no_available_organization_exception.NoAvailableOrganizationException: <p>Organization is no longer available.</p>
        capo_config_service.errors.organization_access_denied_exception.OrganizationAccessDeniedException: <p>For <code>PutConfigurationAggregator</code> API, you can see this exception for the following reasons:</p> <ul> <li> <p>No permission to call <code>EnableAWSServiceAccess</code> API</p> </li> <li> <p>The configuration aggregator cannot be updated because your Amazon Web Services Organization management account or the delegated administrator role changed. Delete this aggregator and create a new one with the current Amazon Web Services Organization.</p> </li> <li> <p>The configuration aggregator is associated with a previous Amazon Web Services Organization and Config cannot aggregate data with current Amazon Web Services Organization. Delete this aggregator and create a new one with the current Amazon Web Services Organization.</p> </li> <li> <p>You are not a registered delegated administrator for Config with permissions to call <code>ListDelegatedAdministrators</code> API. Ensure that the management account registers delagated administrator for Config service principal name before the delegated administrator creates an aggregator.</p> </li> </ul> <p>For all <code>OrganizationConfigRule</code> and <code>OrganizationConformancePack</code> APIs, Config throws an exception if APIs are called from member accounts. All APIs must be called from organization management account.</p>
        capo_config_service.errors.organization_all_features_not_enabled_exception.OrganizationAllFeaturesNotEnabledException: <p>Config resource cannot be created because your organization does not have all features enabled.</p>
        capo_config_service.errors.organization_conformance_pack_template_validation_exception.OrganizationConformancePackTemplateValidationException: <p>You have specified a template that is not valid or supported.</p>
        capo_config_service.errors.resource_in_use_exception.ResourceInUseException: <p>You see this exception in the following cases: </p> <ul> <li> <p>For DeleteConfigRule, Config is deleting this rule. Try your request again later.</p> </li> <li> <p>For DeleteConfigRule, the rule is deleting your evaluation results. Try your request again later.</p> </li> <li> <p>For DeleteConfigRule, a remediation action is associated with the rule and Config cannot delete this rule. Delete the remediation action associated with the rule before deleting the rule and try your request again later.</p> </li> <li> <p>For PutConfigOrganizationRule, organization Config rule deletion is in progress. Try your request again later.</p> </li> <li> <p>For DeleteOrganizationConfigRule, organization Config rule creation is in progress. Try your request again later.</p> </li> <li> <p>For PutConformancePack and PutOrganizationConformancePack, a conformance pack creation, update, and deletion is in progress. Try your request again later.</p> </li> <li> <p>For DeleteConformancePack, a conformance pack creation, update, and deletion is in progress. Try your request again later.</p> </li> </ul>
        capo_config_service.errors.validation_exception.ValidationException: <p>The requested operation is not valid. You will see this exception if there are missing required fields or if the input value fails the validation.</p> <p>For <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_PutStoredQuery.html">PutStoredQuery</a>, one of the following errors:</p> <ul> <li> <p>There are missing required fields.</p> </li> <li> <p>The input value fails the validation.</p> </li> <li> <p>You are trying to create more than 300 queries.</p> </li> </ul> <p>For <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_DescribeConfigurationRecorders.html">DescribeConfigurationRecorders</a> and <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_DescribeConfigurationRecorderStatus.html">DescribeConfigurationRecorderStatus</a>, one of the following errors:</p> <ul> <li> <p>You have specified more than one configuration recorder.</p> </li> <li> <p>You have provided a service principal for service-linked configuration recorder that is not valid.</p> </li> </ul> <p>For <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_AssociateResourceTypes.html">AssociateResourceTypes</a> and <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_DisassociateResourceTypes.html">DisassociateResourceTypes</a>, one of the following errors:</p> <ul> <li> <p>Your configuraiton recorder has a recording strategy that does not allow the association or disassociation of resource types.</p> </li> <li> <p>One or more of the specified resource types are already associated or disassociated with the configuration recorder.</p> </li> <li> <p>For service-linked configuration recorders, the configuration recorder does not record one or more of the specified resource types.</p> </li> </ul> <p>For <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_DeleteServiceLinkedConfigurationRecorder.html">DeleteServiceLinkedConfigurationRecorder</a>, one of the following errors:</p> <ul> <li> <p>You have provided both <code>Arn</code> and <code>ServicePrincipal</code>. Only one of <code>Arn</code> or <code>ServicePrincipal</code> can be specified.</p> </li> <li> <p>You have provided a service principal for service-linked configuration recorder that is not valid.</p> </li> </ul>
        capo_config_service.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_config_service.types.put_organization_conformance_pack_request.PutOrganizationConformancePackRequest]",
    ) -> AsyncOperationResponse[
        "capo_config_service.types.put_organization_conformance_pack_response.PutOrganizationConformancePackResponse"
    ]:
        import capo_config_service._operations.starling_dove_service.put_organization_conformance_pack

        (
            output,
            http_response,
        ) = await capo_config_service._operations.starling_dove_service.put_organization_conformance_pack.async_put_organization_conformance_pack(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("PutOrganizationConformancePack")
    )
    input_: capo_config_service.types.put_organization_conformance_pack_request.PutOrganizationConformancePackRequest = {
        "organization_conformance_pack_name": organization_conformance_pack_name
    }
    if template_s3_uri is not None:
        input_["template_s3_uri"] = template_s3_uri
    if template_body is not None:
        input_["template_body"] = template_body
    if delivery_s3_bucket is not None:
        input_["delivery_s3_bucket"] = delivery_s3_bucket
    if delivery_s3_key_prefix is not None:
        input_["delivery_s3_key_prefix"] = delivery_s3_key_prefix
    if conformance_pack_input_parameters is not None:
        input_["conformance_pack_input_parameters"] = (
            conformance_pack_input_parameters
        )
    if excluded_accounts is not None:
        input_["excluded_accounts"] = excluded_accounts
    if tags is not None:
        input_["tags"] = tags

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output