clusters
Creates, updates, deletes or gets a cluster resource or lists clusters in a region
Overview
| Name | clusters |
| Type | Resource |
| Description | The AWS::DocDBElastic::Cluster Amazon DocumentDB (with MongoDB compatibility) Elastic Scale resource describes a Cluster |
| Id | awscc.docdbelastic.clusters |
Fields
- get (all properties)
- list (identifiers only)
| Name | Datatype | Description |
|---|---|---|
cluster_name | string | |
cluster_arn | string | |
cluster_endpoint | string | |
admin_user_name | string | |
admin_user_password | string | |
shard_capacity | integer | |
shard_count | integer | |
vpc_security_group_ids | array | |
subnet_ids | array | |
preferred_maintenance_window | string | |
preferred_backup_window | string | |
backup_retention_period | integer | |
shard_instance_count | integer | |
kms_key_id | string | |
tags | array | |
auth_type | string | |
region | string | AWS region. |
| Name | Datatype | Description |
|---|---|---|
cluster_arn | string | |
region | string | AWS region. |
For more information, see AWS::DocDBElastic::Cluster.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | clusters | INSERT | ClusterName, AdminUserName, ShardCapacity, ShardCount, AuthType, region |
delete_resource | clusters | DELETE | Identifier, region |
update_resource | clusters | UPDATE | Identifier, PatchDocument, region |
list_resources | clusters_list_only | SELECT | region |
get_resource | clusters | SELECT | Identifier, region |
SELECT examples
- get (all properties)
- list (identifiers only)
Gets all properties from an individual cluster.
SELECT
region,
cluster_name,
cluster_arn,
cluster_endpoint,
admin_user_name,
admin_user_password,
shard_capacity,
shard_count,
vpc_security_group_ids,
subnet_ids,
preferred_maintenance_window,
preferred_backup_window,
backup_retention_period,
shard_instance_count,
kms_key_id,
tags,
auth_type
FROM awscc.docdbelastic.clusters
WHERE
region = '{{ region }}' AND
Identifier = '{{ cluster_arn }}';
Lists all clusters in a region.
SELECT
region,
cluster_arn
FROM awscc.docdbelastic.clusters_list_only
WHERE
region = '{{ region }}';
INSERT example
Use the following StackQL query and manifest file to create a new cluster resource, using stack-deploy.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO awscc.docdbelastic.clusters (
ClusterName,
AdminUserName,
ShardCapacity,
ShardCount,
AuthType,
region
)
SELECT
'{{ cluster_name }}',
'{{ admin_user_name }}',
'{{ shard_capacity }}',
'{{ shard_count }}',
'{{ auth_type }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
/*+ create */
INSERT INTO awscc.docdbelastic.clusters (
ClusterName,
AdminUserName,
AdminUserPassword,
ShardCapacity,
ShardCount,
VpcSecurityGroupIds,
SubnetIds,
PreferredMaintenanceWindow,
PreferredBackupWindow,
BackupRetentionPeriod,
ShardInstanceCount,
KmsKeyId,
Tags,
AuthType,
region
)
SELECT
'{{ cluster_name }}',
'{{ admin_user_name }}',
'{{ admin_user_password }}',
'{{ shard_capacity }}',
'{{ shard_count }}',
'{{ vpc_security_group_ids }}',
'{{ subnet_ids }}',
'{{ preferred_maintenance_window }}',
'{{ preferred_backup_window }}',
'{{ backup_retention_period }}',
'{{ shard_instance_count }}',
'{{ kms_key_id }}',
'{{ tags }}',
'{{ auth_type }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: cluster
props:
- name: cluster_name
value: '{{ cluster_name }}'
- name: admin_user_name
value: '{{ admin_user_name }}'
- name: admin_user_password
value: '{{ admin_user_password }}'
- name: shard_capacity
value: '{{ shard_capacity }}'
- name: shard_count
value: '{{ shard_count }}'
- name: vpc_security_group_ids
value:
- '{{ vpc_security_group_ids[0] }}'
- name: subnet_ids
value:
- '{{ subnet_ids[0] }}'
- name: preferred_maintenance_window
value: '{{ preferred_maintenance_window }}'
- name: preferred_backup_window
value: '{{ preferred_backup_window }}'
- name: backup_retention_period
value: '{{ backup_retention_period }}'
- name: shard_instance_count
value: '{{ shard_instance_count }}'
- name: kms_key_id
value: '{{ kms_key_id }}'
- name: tags
value:
- key: '{{ key }}'
value: '{{ value }}'
- name: auth_type
value: '{{ auth_type }}'
UPDATE example
Use the following StackQL query and manifest file to update a cluster resource, using stack-deploy.
/*+ update */
UPDATE awscc.docdbelastic.clusters
SET PatchDocument = string('{{ {
"AdminUserPassword": admin_user_password,
"ShardCapacity": shard_capacity,
"ShardCount": shard_count,
"VpcSecurityGroupIds": vpc_security_group_ids,
"SubnetIds": subnet_ids,
"PreferredMaintenanceWindow": preferred_maintenance_window,
"PreferredBackupWindow": preferred_backup_window,
"BackupRetentionPeriod": backup_retention_period,
"ShardInstanceCount": shard_instance_count,
"Tags": tags
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ cluster_arn }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
DELETE example
/*+ delete */
DELETE FROM awscc.docdbelastic.clusters
WHERE
Identifier = '{{ cluster_arn }}' AND
region = '{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
Additional Parameters
Mutable resources in the Cloud Control provider support additional optional parameters which can be supplied with INSERT, UPDATE, or DELETE operations. These include:
| Parameter | Description |
|---|---|
ClientToken | A unique identifier to ensure the idempotency of the resource request.This allows the provider to accurately distinguish between retries and new requests.A client token is valid for 36 hours once used. After that, a resource request with the same client token is treated as a new request. If you do not specify a client token, one is generated for inclusion in the request. |
RoleArn | The ARN of the IAM role used to perform this resource operation.The role specified must have the permissions required for this operation.If you do not specify a role, a temporary session is created using your AWS user credentials. |
TypeVersionId | For private resource types, the type version to use in this resource operation.If you do not specify a resource version, the default version is used. |
Permissions
To operate on the clusters resource, the following permissions are required:
- Create
- Read
- Update
- Delete
- List
docdb-elastic:CreateCluster,
docdb-elastic:TagResource,
docdb-elastic:GetCluster,
docdb-elastic:ListTagsForResource,
ec2:CreateVpcEndpoint,
ec2:DescribeVpcEndpoints,
ec2:DeleteVpcEndpoints,
ec2:ModifyVpcEndpoint,
ec2:DescribeSecurityGroups,
ec2:DescribeSubnets,
ec2:DescribeVpcAttribute,
ec2:DescribeVpcs,
ec2:DescribeAvailabilityZones,
secretsmanager:ListSecrets,
secretsmanager:ListSecretVersionIds,
secretsmanager:DescribeSecret,
secretsmanager:GetSecretValue,
secretsmanager:GetResourcePolicy,
kms:DescribeKey,
kms:CreateGrant,
kms:GenerateDataKey,
kms:Decrypt,
iam:CreateServiceLinkedRole
docdb-elastic:GetCluster,
docdb-elastic:ListTagsForResource
docdb-elastic:UpdateCluster,
docdb-elastic:TagResource,
docdb-elastic:UntagResource,
docdb-elastic:GetCluster,
docdb-elastic:ListTagsForResource,
ec2:CreateVpcEndpoint,
ec2:DescribeVpcEndpoints,
ec2:DeleteVpcEndpoints,
ec2:ModifyVpcEndpoint,
ec2:DescribeSecurityGroups,
ec2:DescribeSubnets,
ec2:DescribeVpcAttribute,
ec2:DescribeVpcs,
ec2:DescribeAvailabilityZones,
secretsmanager:ListSecrets,
secretsmanager:ListSecretVersionIds,
secretsmanager:DescribeSecret,
secretsmanager:GetSecretValue,
secretsmanager:GetResourcePolicy,
kms:DescribeKey,
kms:CreateGrant,
kms:GenerateDataKey,
kms:Decrypt
docdb-elastic:DeleteCluster,
docdb-elastic:GetCluster,
ec2:DescribeVpcEndpoints,
ec2:DeleteVpcEndpoints,
ec2:ModifyVpcEndpoint,
ec2:DescribeSecurityGroups,
ec2:DescribeSubnets,
ec2:DescribeVpcAttribute,
ec2:DescribeVpcs,
ec2:DescribeAvailabilityZones
docdb-elastic:ListClusters