cluster_policies
Creates, updates, deletes, gets or lists a cluster_policies resource.
Overview
| Name | cluster_policies |
| Type | Resource |
| Id | aws.dsql.cluster_policies |
Fields
The following fields are returned by SELECT queries:
- get_cluster_policy
| Name | Datatype | Description |
|---|---|---|
policy | string | A resource-based policy document in JSON format. Length constraints: Minimum length of 1. Maximum length of 20480 characters (approximately 20KB). |
policy_version | string | The 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:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_cluster_policy | select | identifier, region | Retrieves the resource-based policy document attached to a cluster. This policy defines the access permissions and conditions for the cluster. | |
put_cluster_policy | replace | identifier, region, policy | 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. | |
delete_cluster_policy | delete | identifier, region | expected-policy-version, client-token | Deletes 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.
| Name | Datatype | Description |
|---|---|---|
identifier | string | |
region | string | AWS region (default: us-east-1) |
client-token | string | |
expected-policy-version | string | The 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
- get_cluster_policy
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
- put_cluster_policy
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
- delete_cluster_policy
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 }}'
;