Skip to content

create_configuration_profile async

create_configuration_profile(
    application_id: Name,
    name: LongName,
    location_uri: Uri,
    *,
    config_overrides: Optional[AsyncAppConfigClientConfig] = None,
    description: Optional[Description] = None,
    retrieval_role_arn: Optional[RoleArn] = None,
    validators: Optional[ValidatorList] = None,
    tags: Optional[TagMap] = None,
    type: Optional[ConfigurationProfileType] = None,
    kms_key_identifier: Optional[KmsKeyIdentifier] = None,
) -> ConfigurationProfile

Creates a configuration profile, which is information that enables AppConfig to access the configuration source. Valid configuration sources include the following:

  • Configuration data in YAML, JSON, and other formats stored in the AppConfig hosted configuration store

  • Configuration data stored as objects in an Amazon Simple Storage Service (Amazon S3) bucket

  • Pipelines stored in CodePipeline

  • Secrets stored in Secrets Manager

  • Standard and secure string parameters stored in Amazon Web Services Systems Manager Parameter Store

  • Configuration data in SSM documents stored in the Systems Manager document store

A configuration profile includes the following information:

  • The URI location of the configuration data.

  • The Identity and Access Management (IAM) role that provides access to the configuration data.

  • A validator for the configuration data. Available validators include either a JSON Schema or an Amazon Web Services Lambda function.

For more information, see Create a Configuration and a Configuration Profile in the AppConfig User Guide.

Parameters:

  • application_id (Name) –

    The application ID.

  • name (LongName) –

    A name for the configuration profile.

  • description (Optional[Description], default: None ) –

    A description of the configuration profile.

  • location_uri (Uri) –

    A URI to locate the configuration. You can specify the following:

    • For the AppConfig hosted configuration store and for feature flags, specify hosted.

    • For an Amazon Web Services Systems Manager Parameter Store parameter, specify either the parameter name in the format ssm-parameter:// or the ARN.

    • For an Amazon Web Services CodePipeline pipeline, specify the URI in the following format: codepipeline://.

    • For an Secrets Manager secret, specify the URI in the following format: secretsmanager://.

    • For an Amazon S3 object, specify the URI in the following format: s3:/// . Here is an example: s3://amzn-s3-demo-bucket/my-app/us-east-1/my-config.json

    • For an SSM document, specify either the document name in the format ssm-document:// or the Amazon Resource Name (ARN).

  • retrieval_role_arn (Optional[RoleArn], default: None ) –

    The ARN of an IAM role with permission to access the configuration at the specified LocationUri.

    A retrieval role ARN is not required for configurations stored in CodePipeline or the AppConfig hosted configuration store. It is required for all other sources that store your configuration.

  • validators (Optional[ValidatorList], default: None ) –

    A list of methods for validating the configuration.

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

    Metadata to assign to the configuration profile. Tags help organize and categorize your AppConfig resources. Each tag consists of a key and an optional value, both of which you define.

  • type (Optional[ConfigurationProfileType], default: None ) –

    The type of configurations contained in the profile. AppConfig supports feature flags and freeform configurations. We recommend you create feature flag configurations to enable or disable new features and freeform configurations to distribute configurations to an application. When calling this API, enter one of the following values for Type:

    AWS.AppConfig.FeatureFlags

    AWS.Freeform

  • kms_key_identifier (Optional[KmsKeyIdentifier], default: None ) –

    The identifier for an Key Management Service key to encrypt new configuration data versions in the AppConfig hosted configuration store. This attribute is only used for hosted configuration types. The identifier can be an KMS key ID, alias, or the Amazon Resource Name (ARN) of the key ID or alias. To encrypt data managed in other configuration stores, see the documentation for how to specify an KMS key for that particular service.

Raises:

  • BadRequestException –

    The input fails to satisfy the constraints specified by an Amazon Web Services service.

  • InternalServerException –

    There was an internal failure in the AppConfig service.

  • ResourceNotFoundException –

    The requested resource could not be found.

  • ServiceQuotaExceededException –

    The number of one more AppConfig resources exceeds the maximum allowed. Verify that your environment doesn't exceed the following service quotas:

    Applications: 100 max

    To resolve this issue, you can delete one or more resources and try again. Or, you can request a quota increase. For more information about quotas and to request an increase, see Service quotas for AppConfig in the Amazon Web Services General Reference.

  • UnknownServiceError –

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

Examples:

To create a configuration profile The following create-configuration-profile example creates a configuration profile using a configuration stored in Parameter Store, a capability of Systems Manager.

>>> await client.create_configuration_profile(application_id='339ohji', name='Example-Configuration-Profile', location_uri='ssm-parameter://Example-Parameter', retrieval_role_arn='arn:aws:iam::111122223333:role/Example-App-Config-Role')
Source code in docs_src/capo_appconfig/_services/async_app_config.py
async def create_configuration_profile(
    self,
    application_id: "capo_appconfig.types.name.Name",
    name: "capo_appconfig.types.long_name.LongName",
    location_uri: "capo_appconfig.types.uri.Uri",
    *,
    config_overrides: Optional[AsyncAppConfigClientConfig] = None,
    description: Optional["capo_appconfig.types.description.Description"] = None,
    retrieval_role_arn: Optional["capo_appconfig.types.role_arn.RoleArn"] = None,
    validators: Optional[
        "capo_appconfig.types.validator_list.ValidatorList"
    ] = None,
    tags: Optional["capo_appconfig.types.tag_map.TagMap"] = None,
    type: Optional[
        "capo_appconfig.types.configuration_profile_type.ConfigurationProfileType"
    ] = None,
    kms_key_identifier: Optional[
        "capo_appconfig.types.kms_key_identifier.KmsKeyIdentifier"
    ] = None,
) -> "capo_appconfig.types.configuration_profile.ConfigurationProfile":
    """<p>Creates a configuration profile, which is information that enables AppConfig to access the configuration source. Valid configuration sources include the following:</p> <ul> <li> <p>Configuration data in YAML, JSON, and other formats stored in the AppConfig hosted configuration store</p> </li> <li> <p>Configuration data stored as objects in an Amazon Simple Storage Service (Amazon S3) bucket</p> </li> <li> <p>Pipelines stored in CodePipeline</p> </li> <li> <p>Secrets stored in Secrets Manager</p> </li> <li> <p>Standard and secure string parameters stored in Amazon Web Services Systems Manager Parameter Store</p> </li> <li> <p>Configuration data in SSM documents stored in the Systems Manager document store</p> </li> </ul> <p>A configuration profile includes the following information:</p> <ul> <li> <p>The URI location of the configuration data.</p> </li> <li> <p>The Identity and Access Management (IAM) role that provides access to the configuration data.</p> </li> <li> <p>A validator for the configuration data. Available validators include either a JSON Schema or an Amazon Web Services Lambda function.</p> </li> </ul> <p>For more information, see <a href="http://docs.aws.amazon.com/appconfig/latest/userguide/appconfig-creating-configuration-and-profile.html">Create a Configuration and a Configuration Profile</a> in the <i>AppConfig User Guide</i>.</p>

    Args:
        application_id: <p>The application ID.</p>
        name: <p>A name for the configuration profile.</p>
        description: <p>A description of the configuration profile.</p>
        location_uri: <p>A URI to locate the configuration. You can specify the following:</p> <ul> <li> <p>For the AppConfig hosted configuration store and for feature flags, specify <code>hosted</code>.</p> </li> <li> <p>For an Amazon Web Services Systems Manager Parameter Store parameter, specify either the parameter name in the format <code>ssm-parameter://<parameter name></code> or the ARN.</p> </li> <li> <p>For an Amazon Web Services CodePipeline pipeline, specify the URI in the following format: <code>codepipeline</code>://<pipeline name>.</p> </li> <li> <p>For an Secrets Manager secret, specify the URI in the following format: <code>secretsmanager</code>://<secret name>.</p> </li> <li> <p>For an Amazon S3 object, specify the URI in the following format: <code>s3://<bucket>/<objectKey> </code>. Here is an example: <code>s3://amzn-s3-demo-bucket/my-app/us-east-1/my-config.json</code> </p> </li> <li> <p>For an SSM document, specify either the document name in the format <code>ssm-document://<document name></code> or the Amazon Resource Name (ARN).</p> </li> </ul>
        retrieval_role_arn: <p>The ARN of an IAM role with permission to access the configuration at the specified <code>LocationUri</code>.</p> <important> <p>A retrieval role ARN is not required for configurations stored in CodePipeline or the AppConfig hosted configuration store. It is required for all other sources that store your configuration. </p> </important>
        validators: <p>A list of methods for validating the configuration.</p>
        tags: <p>Metadata to assign to the configuration profile. Tags help organize and categorize your AppConfig resources. Each tag consists of a key and an optional value, both of which you define.</p>
        type: <p>The type of configurations contained in the profile. AppConfig supports <code>feature flags</code> and <code>freeform</code> configurations. We recommend you create feature flag configurations to enable or disable new features and freeform configurations to distribute configurations to an application. When calling this API, enter one of the following values for <code>Type</code>:</p> <p> <code>AWS.AppConfig.FeatureFlags</code> </p> <p> <code>AWS.Freeform</code> </p>
        kms_key_identifier: <p>The identifier for an Key Management Service key to encrypt new configuration data versions in the AppConfig hosted configuration store. This attribute is only used for <code>hosted</code> configuration types. The identifier can be an KMS key ID, alias, or the Amazon Resource Name (ARN) of the key ID or alias. To encrypt data managed in other configuration stores, see the documentation for how to specify an KMS key for that particular service.</p>

    Raises:
        capo_appconfig.errors.bad_request_exception.BadRequestException: <p>The input fails to satisfy the constraints specified by an Amazon Web Services service.</p>
        capo_appconfig.errors.internal_server_exception.InternalServerException: <p>There was an internal failure in the AppConfig service.</p>
        capo_appconfig.errors.resource_not_found_exception.ResourceNotFoundException: <p>The requested resource could not be found.</p>
        capo_appconfig.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The number of one more AppConfig resources exceeds the maximum allowed. Verify that your environment doesn't exceed the following service quotas:</p> <p>Applications: 100 max</p> <p>To resolve this issue, you can delete one or more resources and try again. Or, you can request a quota increase. For more information about quotas and to request an increase, see <a href="https://docs.aws.amazon.com/general/latest/gr/appconfig.html#limits_appconfig">Service quotas for AppConfig</a> in the Amazon Web Services General Reference.</p>
        capo_appconfig.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To create a configuration profile
        The following create-configuration-profile example creates a configuration profile using a configuration stored in Parameter Store, a capability of Systems Manager.

        >>> await client.create_configuration_profile(application_id='339ohji', name='Example-Configuration-Profile', location_uri='ssm-parameter://Example-Parameter', retrieval_role_arn='arn:aws:iam::111122223333:role/Example-App-Config-Role')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_appconfig.types.create_configuration_profile_request.CreateConfigurationProfileRequest]",
    ) -> AsyncOperationResponse[
        "capo_appconfig.types.configuration_profile.ConfigurationProfile"
    ]:
        import capo_appconfig._operations.amazon_app_config.create_configuration_profile

        (
            output,
            http_response,
        ) = await capo_appconfig._operations.amazon_app_config.create_configuration_profile.async_create_configuration_profile(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_appconfig.types.create_configuration_profile_request.CreateConfigurationProfileRequest",
    ) -> dict[str, Any]:
        import capo_appconfig.types.create_configuration_profile_request

        return capo_appconfig.types.create_configuration_profile_request.redact_sensitive(
            input_
        )

    def _redact_output(
        output: "capo_appconfig.types.configuration_profile.ConfigurationProfile",
    ) -> dict[str, Any]:
        import capo_appconfig.types.configuration_profile

        return capo_appconfig.types.configuration_profile.redact_sensitive(output)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "CreateConfigurationProfile",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_appconfig.types.create_configuration_profile_request.CreateConfigurationProfileRequest = {
        "application_id": application_id,
        "name": name,
        "location_uri": location_uri,
    }
    if description is not None:
        input_["description"] = description
    if retrieval_role_arn is not None:
        input_["retrieval_role_arn"] = retrieval_role_arn
    if validators is not None:
        input_["validators"] = validators
    if tags is not None:
        input_["tags"] = tags
    if type is not None:
        input_["type"] = type
    if kms_key_identifier is not None:
        input_["kms_key_identifier"] = kms_key_identifier

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