Skip to content

create_policy_store async

create_policy_store(
    validation_settings: ValidationSettings,
    *,
    config_overrides: Optional[AsyncVerifiedPermissionsClientConfig] = None,
    client_token: Optional[IdempotencyToken] = None,
    description: Optional[PolicyStoreDescription] = None,
    deletion_protection: Optional[DeletionProtection] = None,
    encryption_settings: Optional[EncryptionSettings] = None,
    tags: Optional[TagMap] = None,
) -> CreatePolicyStoreOutput

Creates a policy store. A policy store is a container for policy resources.

As of May 2026, Verified Permissions has aligned with Cedar and now supports multiple namespaces.

Verified Permissions is eventually consistent . It can take a few seconds for a new or changed element to propagate through the service and be visible in the results of other Verified Permissions operations.

Parameters:

  • client_token (Optional[IdempotencyToken], default: None ) –

    Specifies a unique, case-sensitive ID that you provide to ensure the idempotency of the request. This lets you safely retry the request without accidentally performing the same operation a second time. Passing the same value to a later call to an operation requires that you also pass the same value for all other parameters. We recommend that you use a UUID type of value..

    If you don't provide this value, then Amazon Web Services generates a random one for you.

    If you retry the operation with the same ClientToken, but with different parameters, the retry fails with an ConflictException error.

    Verified Permissions recognizes a ClientToken for eight hours. After eight hours, the next request with the same parameters performs the operation again regardless of the value of ClientToken.

  • validation_settings (ValidationSettings) –

    Specifies the validation setting for this policy store.

    Currently, the only valid and required value is Mode.

    We recommend that you turn on STRICT mode only after you define a schema. If a schema doesn't exist, then STRICT mode causes any policy to fail validation, and Verified Permissions rejects the policy. You can turn off validation by using the UpdatePolicyStore. Then, when you have a schema defined, use UpdatePolicyStore again to turn validation back on.

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

    Descriptive text that you can provide to help with identification of the current policy store.

  • deletion_protection (Optional[DeletionProtection], default: None ) –

    Specifies whether the policy store can be deleted. If enabled, the policy store can't be deleted.

    The default state is DISABLED.

  • encryption_settings (Optional[EncryptionSettings], default: None ) –

    Specifies the encryption settings used to encrypt the policy store and their child resources. Allows for the ability to use a customer owned KMS key for encryption of data.

    This is an optional field to be used when providing a customer-managed KMS key for encryption.

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

    The list of key-value pairs to associate with the policy store.

Raises:

  • AccessDeniedException –

    You don't have sufficient access to perform this action.

  • InternalServerException –

    The request failed because of an internal error. Try your request again later

  • ThrottlingException –

    The request failed because it exceeded a throttling quota.

  • ValidationException –

    The request failed because one or more input parameters don't satisfy their constraint requirements. The output is provided as a list of fields and a reason for each field that isn't valid.

    The possible reasons include the following:

    • UnrecognizedEntityType

      The policy includes an entity type that isn't found in the schema.

    • UnrecognizedActionId

      The policy includes an action id that isn't found in the schema.

    • InvalidActionApplication

      The policy includes an action that, according to the schema, doesn't support the specified principal and resource.

    • UnexpectedType

      The policy included an operand that isn't a valid type for the specified operation.

    • IncompatibleTypes

      The types of elements included in a set, or the types of expressions used in an if...then...else clause aren't compatible in this context.

    • MissingAttribute

      The policy attempts to access a record or entity attribute that isn't specified in the schema. Test for the existence of the attribute first before attempting to access its value. For more information, see the has (presence of attribute test) operator in the Cedar Policy Language Guide.

    • UnsafeOptionalAttributeAccess

      The policy attempts to access a record or entity attribute that is optional and isn't guaranteed to be present. Test for the existence of the attribute first before attempting to access its value. For more information, see the has (presence of attribute test) operator in the Cedar Policy Language Guide.

    • ImpossiblePolicy

      Cedar has determined that a policy condition always evaluates to false. If the policy is always false, it can never apply to any query, and so it can never affect an authorization decision.

    • WrongNumberArguments

      The policy references an extension type with the wrong number of arguments.

    • FunctionArgumentValidationError

      Cedar couldn't parse the argument passed to an extension type. For example, a string that is to be parsed as an IPv4 address can contain only digits and the period character.

  • ConflictException –

    The request failed because another request to modify a resource occurred at the same time.

  • ServiceQuotaExceededException –

    The request failed because it would cause a service quota to be exceeded.

  • UnknownServiceError –

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

Examples:

To create policy store The following example creates a new policy store with strict validation turned on.

>>> await client.create_policy_store(validation_settings={'mode': 'STRICT'}, client_token='a1b2c3d4-e5f6-a1b2-c3d4-TOKEN1111111')
To create an encrypted policy store
The following example creates a new policy store with encryption settings based on a provided KMS key.
>>> await client.create_policy_store(validation_settings={'mode': 'STRICT'}, encryption_settings={'kmsEncryptionSettings': {'key': 'arn:aws:kms:us-east-1:123456789012:key/abcdefgh-ijkl-mnop-qrst-uvwxyz123456', 'encryptionContext': {'policy_store_owner': 'Tim'}}}, client_token='a1b2c3d4-e5f6-a1b2-c3d4-TOKEN1111111')
Source code in docs_src/capo_verifiedpermissions/_services/async_verified_permissions.py
async def create_policy_store(
    self,
    validation_settings: "capo_verifiedpermissions.types.validation_settings.ValidationSettings",
    *,
    config_overrides: Optional[AsyncVerifiedPermissionsClientConfig] = None,
    client_token: Optional[
        "capo_verifiedpermissions.types.idempotency_token.IdempotencyToken"
    ] = None,
    description: Optional[
        "capo_verifiedpermissions.types.policy_store_description.PolicyStoreDescription"
    ] = None,
    deletion_protection: Optional[
        "capo_verifiedpermissions.types.deletion_protection.DeletionProtection"
    ] = None,
    encryption_settings: Optional[
        "capo_verifiedpermissions.types.encryption_settings.EncryptionSettings"
    ] = None,
    tags: Optional["capo_verifiedpermissions.types.tag_map.TagMap"] = None,
) -> "capo_verifiedpermissions.types.create_policy_store_output.CreatePolicyStoreOutput":
    """<p>Creates a policy store. A policy store is a container for policy resources.</p> <note> <p>As of May 2026, Verified Permissions has aligned with Cedar and now supports multiple namespaces.</p> </note> <note> <p>Verified Permissions is <i> <a href="https://wikipedia.org/wiki/Eventual_consistency">eventually consistent</a> </i>. It can take a few seconds for a new or changed element to propagate through the service and be visible in the results of other Verified Permissions operations.</p> </note>

    Args:
        client_token: <p>Specifies a unique, case-sensitive ID that you provide to ensure the idempotency of the request. This lets you safely retry the request without accidentally performing the same operation a second time. Passing the same value to a later call to an operation requires that you also pass the same value for all other parameters. We recommend that you use a <a href="https://wikipedia.org/wiki/Universally_unique_identifier">UUID type of value.</a>.</p> <p>If you don't provide this value, then Amazon Web Services generates a random one for you.</p> <p>If you retry the operation with the same <code>ClientToken</code>, but with different parameters, the retry fails with an <code>ConflictException</code> error.</p> <p>Verified Permissions recognizes a <code>ClientToken</code> for eight hours. After eight hours, the next request with the same parameters performs the operation again regardless of the value of <code>ClientToken</code>.</p>
        validation_settings: <p>Specifies the validation setting for this policy store.</p> <p>Currently, the only valid and required value is <code>Mode</code>.</p> <important> <p>We recommend that you turn on <code>STRICT</code> mode only after you define a schema. If a schema doesn't exist, then <code>STRICT</code> mode causes any policy to fail validation, and Verified Permissions rejects the policy. You can turn off validation by using the <a href="https://docs.aws.amazon.com/verifiedpermissions/latest/apireference/API_UpdatePolicyStore">UpdatePolicyStore</a>. Then, when you have a schema defined, use <a href="https://docs.aws.amazon.com/verifiedpermissions/latest/apireference/API_UpdatePolicyStore">UpdatePolicyStore</a> again to turn validation back on.</p> </important>
        description: <p>Descriptive text that you can provide to help with identification of the current policy store.</p>
        deletion_protection: <p>Specifies whether the policy store can be deleted. If enabled, the policy store can't be deleted.</p> <p>The default state is <code>DISABLED</code>.</p>
        encryption_settings: <p>Specifies the encryption settings used to encrypt the policy store and their child resources. Allows for the ability to use a customer owned KMS key for encryption of data.</p> <p>This is an optional field to be used when providing a customer-managed KMS key for encryption.</p>
        tags: <p>The list of key-value pairs to associate with the policy store.</p>

    Raises:
        capo_verifiedpermissions.errors.access_denied_exception.AccessDeniedException: <p>You don't have sufficient access to perform this action.</p>
        capo_verifiedpermissions.errors.internal_server_exception.InternalServerException: <p>The request failed because of an internal error. Try your request again later</p>
        capo_verifiedpermissions.errors.throttling_exception.ThrottlingException: <p>The request failed because it exceeded a throttling quota.</p>
        capo_verifiedpermissions.errors.validation_exception.ValidationException: <p>The request failed because one or more input parameters don't satisfy their constraint requirements. The output is provided as a list of fields and a reason for each field that isn't valid.</p> <p>The possible reasons include the following:</p> <ul> <li> <p> <b>UnrecognizedEntityType</b> </p> <p>The policy includes an entity type that isn't found in the schema.</p> </li> <li> <p> <b>UnrecognizedActionId</b> </p> <p>The policy includes an action id that isn't found in the schema.</p> </li> <li> <p> <b>InvalidActionApplication</b> </p> <p>The policy includes an action that, according to the schema, doesn't support the specified principal and resource.</p> </li> <li> <p> <b>UnexpectedType</b> </p> <p>The policy included an operand that isn't a valid type for the specified operation.</p> </li> <li> <p> <b>IncompatibleTypes</b> </p> <p>The types of elements included in a <code>set</code>, or the types of expressions used in an <code>if...then...else</code> clause aren't compatible in this context.</p> </li> <li> <p> <b>MissingAttribute</b> </p> <p>The policy attempts to access a record or entity attribute that isn't specified in the schema. Test for the existence of the attribute first before attempting to access its value. For more information, see the <a href="https://docs.cedarpolicy.com/policies/syntax-operators.html#has-presence-of-attribute-test">has (presence of attribute test) operator</a> in the <i>Cedar Policy Language Guide</i>.</p> </li> <li> <p> <b>UnsafeOptionalAttributeAccess</b> </p> <p>The policy attempts to access a record or entity attribute that is optional and isn't guaranteed to be present. Test for the existence of the attribute first before attempting to access its value. For more information, see the <a href="https://docs.cedarpolicy.com/policies/syntax-operators.html#has-presence-of-attribute-test">has (presence of attribute test) operator</a> in the <i>Cedar Policy Language Guide</i>.</p> </li> <li> <p> <b>ImpossiblePolicy</b> </p> <p>Cedar has determined that a policy condition always evaluates to false. If the policy is always false, it can never apply to any query, and so it can never affect an authorization decision.</p> </li> <li> <p> <b>WrongNumberArguments</b> </p> <p>The policy references an extension type with the wrong number of arguments.</p> </li> <li> <p> <b>FunctionArgumentValidationError</b> </p> <p>Cedar couldn't parse the argument passed to an extension type. For example, a string that is to be parsed as an IPv4 address can contain only digits and the period character.</p> </li> </ul>
        capo_verifiedpermissions.errors.conflict_exception.ConflictException: <p>The request failed because another request to modify a resource occurred at the same time.</p>
        capo_verifiedpermissions.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The request failed because it would cause a service quota to be exceeded.</p>
        capo_verifiedpermissions.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To create policy store
        The following example creates a new policy store with strict validation turned on.

        >>> await client.create_policy_store(validation_settings={'mode': 'STRICT'}, client_token='a1b2c3d4-e5f6-a1b2-c3d4-TOKEN1111111')
        To create an encrypted policy store
        The following example creates a new policy store with encryption settings based on a provided KMS key.

        >>> await client.create_policy_store(validation_settings={'mode': 'STRICT'}, encryption_settings={'kmsEncryptionSettings': {'key': 'arn:aws:kms:us-east-1:123456789012:key/abcdefgh-ijkl-mnop-qrst-uvwxyz123456', 'encryptionContext': {'policy_store_owner': 'Tim'}}}, client_token='a1b2c3d4-e5f6-a1b2-c3d4-TOKEN1111111')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_verifiedpermissions.types.create_policy_store_input.CreatePolicyStoreInput]",
    ) -> AsyncOperationResponse[
        "capo_verifiedpermissions.types.create_policy_store_output.CreatePolicyStoreOutput"
    ]:
        import capo_verifiedpermissions._operations.verified_permissions.create_policy_store

        (
            output,
            http_response,
        ) = await capo_verifiedpermissions._operations.verified_permissions.create_policy_store.async_create_policy_store(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_verifiedpermissions.types.create_policy_store_input.CreatePolicyStoreInput",
    ) -> dict[str, Any]:
        import capo_verifiedpermissions.types.create_policy_store_input

        return capo_verifiedpermissions.types.create_policy_store_input.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CreatePolicyStore", redact_input=_redact_input),
    )
    input_: capo_verifiedpermissions.types.create_policy_store_input.CreatePolicyStoreInput = {
        "validation_settings": validation_settings
    }
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if description is not None:
        input_["description"] = description
    if deletion_protection is not None:
        input_["deletion_protection"] = deletion_protection
    if encryption_settings is not None:
        input_["encryption_settings"] = encryption_settings
    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