Skip to main content

cluster_policies

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

Overview

Namecluster_policies
TypeResource
Idaws.dsql.cluster_policies

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
policystringA resource-based policy document in JSON format. Length constraints: Minimum length of 1. Maximum length of 20480 characters (approximately 20KB).
policy_versionstringThe version of the policy document. This version number is incremented each time the policy is updated.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_cluster_policyselectidentifier, regionRetrieves the resource-based policy document attached to a cluster. This policy defines the access permissions and conditions for the cluster.
put_cluster_policyreplaceidentifier, region, policyAttaches a resource-based policy to a cluster. This policy defines access permissions and conditions for the cluster, allowing you to control which principals can perform actions on the cluster.
delete_cluster_policydeleteidentifier, regionexpected-policy-version, client-tokenDeletes the resource-based policy attached to a cluster. This removes all access permissions defined by the policy, reverting to default access controls.

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
identifierstring
regionstringAWS region (default: us-east-1)
client-tokenstring
expected-policy-versionstringThe expected version of the policy to delete. This parameter ensures that you're deleting the correct version of the policy and helps prevent accidental deletions.

SELECT examples

Retrieves the resource-based policy document attached to a cluster. This policy defines the access permissions and conditions for the cluster.

SELECT
policy,
policy_version
FROM aws.dsql.cluster_policies
WHERE identifier = '{{ identifier }}' -- required
AND region = '{{ region }}' -- required
;

REPLACE examples

Attaches a resource-based policy to a cluster. This policy defines access permissions and conditions for the cluster, allowing you to control which principals can perform actions on the cluster.

REPLACE aws.dsql.cluster_policies
SET
policy = '{{ policy }}',
bypassPolicyLockoutSafetyCheck = {{ bypassPolicyLockoutSafetyCheck }},
expectedPolicyVersion = '{{ expectedPolicyVersion }}',
clientToken = '{{ clientToken }}'
WHERE
identifier = '{{ identifier }}' --required
AND region = '{{ region }}' --required
AND policy = '{{ policy }}' --required
RETURNING
policy_version;

DELETE examples

Deletes the resource-based policy attached to a cluster. This removes all access permissions defined by the policy, reverting to default access controls.

DELETE FROM aws.dsql.cluster_policies
WHERE identifier = '{{ identifier }}' --required
AND region = '{{ region }}' --required
AND `expected-policy-version` = '{{ expected-policy-version }}'
AND `client-token` = '{{ client-token }}'
;