Skip to content

Instantly share code, notes, and snippets.

@faudeltn
Last active March 18, 2025 09:58
Show Gist options
  • Select an option

  • Save faudeltn/4e69efe9c7363f0d498841ff15750f01 to your computer and use it in GitHub Desktop.

Select an option

Save faudeltn/4e69efe9c7363f0d498841ff15750f01 to your computer and use it in GitHub Desktop.
#
# Copyright 2023 yallalabs.com. All Rights Reserved.
#
description: |-
## Id
Document Name: YALLALABS-StartDocdbCluster
Copyright 2023 yallalabs.com. All Rights Reserved.
## What does this document do?
This document starts an Amazon DocumentDB cluster.
## Type
TEST
## Risk
Small
## Requirements
* Available DocumentDB Cluster
## Permissions required for AutomationAssumeRole
* `rds:StartDBCluster` on the targeted cluster.
* `rds:DescribeDBClusters` on all clusters.
##### In case cluster is encrypted with a KMS key
* kms:DescribeKey
## Supports Rollback
No
## Cancellation behavior
Fails
## Inputs
### (Optional) AutomationAssumeRole
* type: String
* description: ARN of the IAM role with permissions listed above
### (Required) DBClusterIdentifier
* type: String
* description: DocumentDB Cluster Identifier
## Details
The document starts DocumentDB cluster and wait for it to become available.
## Steps executed in normal flow
* AssertNotStartingOrAvailable
* StartDbCluster
* CheckStart
## Outputs
None
schemaVersion: '0.3'
assumeRole: '{{ AutomationAssumeRole }}'
parameters:
DBClusterIdentifier:
type: String
description: (Required) DocDb Cluster Identifier
AutomationAssumeRole:
type: String
description: (Optional) The ARN of the role that allows Automation to perform the actions on your behalf.
default: ''
allowedPattern: ^arn:aws(-cn|-us-gov)?:iam::\d{12}:role/[\w+=,.@/-]+|^$
mainSteps:
- name: AssertNotStartingOrAvailable
action: aws:assertAwsResourceProperty
nextStep: CheckStart
isCritical: false
isEnd: false
onFailure: step:StartDBCluster
inputs:
Service: docdb
Api: DescribeDBInstances
Filters:
- Name: db-cluster-id
Values:
- '{{ DBClusterIdentifier }}'
PropertySelector: $.DBInstances..DBInstanceStatus
DesiredValues:
- available
- starting
- description: Start the DocumentDB cluster
name: StartDBCluster
action: aws:executeAwsApi
nextStep: CheckStart
isEnd: false
inputs:
Service: docdb
Api: StartDBCluster
DBClusterIdentifier: '{{ DBClusterIdentifier }}'
- name: CheckStart
action: aws:waitForAwsResourceProperty
maxAttempts: 10
timeoutSeconds: 600
isEnd: true
onFailure: Abort
inputs:
Service: docdb
Api: DescribeDBInstances
Filters:
- Name: db-cluster-id
Values:
- '{{ DBClusterIdentifier }}'
PropertySelector: $.DBInstances..DBInstanceStatus
DesiredValues:
- available
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment