create_security_policy

create_security_policy(**kwargs)

Creates a security policy to be used by one or more OpenSearch Serverless collections. Security policies provide access to a collection and its OpenSearch Dashboards endpoint from public networks or specific VPC endpoints. They also allow you to secure a collection with a KMS encryption key. For more information, see Network access for Amazon OpenSearch Serverless and Encryption at rest for Amazon OpenSearch Serverless.

See also: AWS API Documentation

Request Syntax

response = client.create_security_policy(
    clientToken='string',
    description='string',
    name='string',
    policy='string',
    type='encryption'|'network'
)
Parameters
  • clientToken (string) --

    Unique, case-sensitive identifier to ensure idempotency of the request.

    This field is autopopulated if not provided.

  • description (string) -- A description of the policy. Typically used to store information about the permissions defined in the policy.
  • name (string) --

    [REQUIRED]

    The name of the policy.

  • policy (string) --

    [REQUIRED]

    The JSON policy document to use as the content for the new policy.

  • type (string) --

    [REQUIRED]

    The type of security policy.

Return type

dict

Returns

Response Syntax

{
    'securityPolicyDetail': {
        'createdDate': 123,
        'description': 'string',
        'lastModifiedDate': 123,
        'name': 'string',
        'policy': {...}|[...]|123|123.4|'string'|True|None,
        'policyVersion': 'string',
        'type': 'encryption'|'network'
    }
}

Response Structure

  • (dict) --

    • securityPolicyDetail (dict) --

      Details about the created security policy.

      • createdDate (integer) --

        The date the policy was created.

      • description (string) --

        The description of the security policy.

      • lastModifiedDate (integer) --

        The timestamp of when the policy was last modified.

      • name (string) --

        The name of the policy.

      • policy (document) --

        The JSON policy document without any whitespaces.

      • policyVersion (string) --

        The version of the policy.

      • type (string) --

        The type of security policy.

Exceptions

  • OpenSearchServiceServerless.Client.exceptions.InternalServerException
  • OpenSearchServiceServerless.Client.exceptions.ConflictException
  • OpenSearchServiceServerless.Client.exceptions.ValidationException