Skip to main content

security_policies

Creates, updates, deletes, gets or lists a security_policies resource.

Overview

Namesecurity_policies
TypeResource
Idaws.opensearchserverless.security_policies

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
namestringThe name of the policy. (pattern: <code>[a-z][a-z0-9-]+</code>)
created_dateinteger (int64)The date the policy was created.
descriptionstringThe description of the security policy.
last_modified_dateinteger (int64)The timestamp of when the policy was last modified.
policyobjectThe JSON policy document without any whitespaces.
policy_versionstringThe version of the policy. (pattern: <code>([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?</code>)
type_stringThe type of security policy. (encryption, network)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_security_policyselectregionReturns information about a configured OpenSearch Serverless security policy. For more information, see Network access for Amazon OpenSearch Serverless and Encryption at rest for Amazon OpenSearch Serverless.
list_security_policiesselectregionReturns information about configured OpenSearch Serverless security policies.
create_security_policyinsertregion, type, name, policyCreates 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.
update_security_policyupdateregion, type, name, policyVersionUpdates an OpenSearch Serverless security policy. For more information, see Network access for Amazon OpenSearch Serverless and Encryption at rest for Amazon OpenSearch Serverless.
delete_security_policydeleteregionDeletes an OpenSearch Serverless security policy.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
regionstringAWS region (default: us-east-1)

SELECT examples

Returns information about a configured OpenSearch Serverless security policy. For more information, see Network access for Amazon OpenSearch Serverless and Encryption at rest for Amazon OpenSearch Serverless.

SELECT
name,
created_date,
description,
last_modified_date,
policy,
policy_version,
type_
FROM aws.opensearchserverless.security_policies
WHERE region = '{{ region }}' -- required
;

INSERT examples

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.

INSERT INTO aws.opensearchserverless.security_policies (
type,
name,
description,
policy,
clientToken,
region
)
SELECT
'{{ type }}' /* required */,
'{{ name }}' /* required */,
'{{ description }}',
'{{ policy }}' /* required */,
'{{ clientToken }}',
'{{ region }}'
RETURNING
security_policy_detail
;

UPDATE examples

Updates an OpenSearch Serverless security policy. For more information, see Network access for Amazon OpenSearch Serverless and Encryption at rest for Amazon OpenSearch Serverless.

UPDATE aws.opensearchserverless.security_policies
SET
type = '{{ type }}',
name = '{{ name }}',
policyVersion = '{{ policyVersion }}',
description = '{{ description }}',
policy = '{{ policy }}',
clientToken = '{{ clientToken }}'
WHERE
region = '{{ region }}' --required
AND type = '{{ type }}' --required
AND name = '{{ name }}' --required
AND policyVersion = '{{ policyVersion }}' --required
RETURNING
security_policy_detail;

DELETE examples

Deletes an OpenSearch Serverless security policy.

DELETE FROM aws.opensearchserverless.security_policies
WHERE region = '{{ region }}' --required
;