AWS Security ChangesHomeSearch

AWS aurora-dsql documentation change

Service: aurora-dsql · 2025-05-19 · Documentation low

File: aurora-dsql/latest/userguide/getting-started-delete-cluster.md

Summary

Updated code examples across multiple languages to add deletion waiters, improve error handling, use placeholders for cluster IDs, and clarify multi-region deletion sequencing

Security assessment

Changes focus on improving code examples with proper resource cleanup patterns and documentation clarity. While proper deletion prevents orphaned resources, there's no evidence this addresses a specific security vulnerability. The waiters and error handling improve operational reliability rather than address security flaws.

Diff

diff --git a/aurora-dsql/latest/userguide/getting-started-delete-cluster.md b/aurora-dsql/latest/userguide/getting-started-delete-cluster.md
index 062427373..d772aa6c1 100644
--- a//aurora-dsql/latest/userguide/getting-started-delete-cluster.md
+++ b//aurora-dsql/latest/userguide/getting-started-delete-cluster.md
@@ -7 +7 @@ Amazon Aurora DSQL is provided as a Preview service. To learn more, see [Betas a
-# Delete cluster in Aurora DSQL with AWS SDKs
+# Delete a cluster 
@@ -19 +19,2 @@ To delete a cluster in a single AWS Region, use the following example.
-    def delete_cluster(cluster_id, client):
+    
+    def delete_cluster(region, identifier):
@@ -21 +22,12 @@ To delete a cluster in a single AWS Region, use the following example.
-            return client.delete_cluster(identifier=cluster_id)
+            client = boto3.client("dsql", region_name=region)
+            cluster = client.delete_cluster(identifier=identifier)
+            print(f"Initiated delete of {cluster["arn"]}")
+    
+            print("Waiting for cluster to finish deletion")
+            client.get_waiter("cluster_not_exists").wait(
+                identifier=cluster["identifier"],
+                WaiterConfig={
+                    'Delay': 10,
+                    'MaxAttempts': 30
+                }
+            )
@@ -23 +35 @@ To delete a cluster in a single AWS Region, use the following example.
-            print("Unable to delete cluster " + cluster_id)
+            print("Unable to delete cluster " + identifier)
@@ -28,4 +41,4 @@ To delete a cluster in a single AWS Region, use the following example.
-        client = boto3.client("dsql", region_name=region)
-        cluster_id = "foo0bar1baz2quux3quuux4"
-        response = delete_cluster(cluster_id, client)
-        print("Deleting cluster with ID: " + cluster_id +  ", Cluster Status: " + response['status'])
+        cluster_id = "<cluster id>"  # Use a placeholder in docs
+        delete_cluster(region, cluster_id)
+        print(f"Deleted {cluster_id}")
+    
@@ -42,2 +55,39 @@ To delete a multi-Region cluster, use the following example.
-    def delete_multi_region_clusters(linkedClusterArns, client):
-        client.delete_multi_region_clusters(linkedClusterArns=linkedClusterArns)
+    
+    def delete_multi_region_clusters(region_1, cluster_id_1, region_2, cluster_id_2):
+        try:
+    
+            client_1 = boto3.client("dsql", region_name=region_1)
+            client_2 = boto3.client("dsql", region_name=region_2)
+    
+            client_1.delete_cluster(identifier=cluster_id_1)
+            print(f"Deleting cluster {cluster_id_1} in {region_1}")
+    
+            # cluster_1 will stay in PENDING_DELETE state until cluster_2 is deleted
+    
+            client_2.delete_cluster(identifier=cluster_id_2)
+            print(f"Deleting cluster {cluster_id_2} in {region_2}")
+    
+            # Now that both clusters have been marked for deletion they will transition
+            # to DELETING state and finalize deletion
+            print(f"Waiting for {cluster_id_1} to finish deletion")
+            client_1.get_waiter("cluster_not_exists").wait(
+                identifier=cluster_id_1,
+                WaiterConfig={
+                    'Delay': 10,
+                    'MaxAttempts': 30
+                }
+            )
+    
+            print(f"Waiting for {cluster_id_2} to finish deletion")
+            client_2.get_waiter("cluster_not_exists").wait(
+                identifier=cluster_id_2,
+                WaiterConfig={
+                    'Delay': 10,
+                    'MaxAttempts': 30
+                }
+            )
+    
+        except:
+            print("Unable to delete cluster")
+            raise
+    
@@ -46,8 +96,8 @@ To delete a multi-Region cluster, use the following example.
-        region = "us-east-1"
-        client = boto3.client("dsql", region_name=region)
-        linkedClusterArns = [
-            "arn:aws:dsql:us-east-1:111111999999::cluster/foo0bar1baz2quux3quuux4",
-            "arn:aws:dsql:us-east-2:111111999999::cluster/bar0foo1baz2quux3quuux4"
-        ]
-        delete_multi_region_clusters(linkedClusterArns, client)
-        print("Deleting clusters with ARNs:", linkedClusterArns)
+        region_1 = "us-east-1"
+        cluster_id_1 = "<cluster 1 id>"
+        region_2 = "us-east-2"
+        cluster_id_2 = "<cluster 2 id>"
+    
+        delete_multi_region_clusters(region_1, cluster_id_1, region_2, cluster_id_2)
+        print(f"Deleted {cluster_id_1} in {region_1} and {cluster_id_2} in {region_2}")
+    
@@ -62 +111 @@ C++
-The following example lets you delete a cluster in a single AWS Region.
+To delete a cluster in a single AWS Region, use the following example.
@@ -65,0 +115 @@ The following example lets you delete a cluster in a single AWS Region.
+    #include <aws/core/utils/Outcome.h>
@@ -67,0 +118 @@ The following example lets you delete a cluster in a single AWS Region.
+    #include <aws/dsql/model/GetClusterRequest.h>
@@ -68,0 +120,2 @@ The following example lets you delete a cluster in a single AWS Region.
+    #include <thread>
+    #include <chrono>
@@ -74,12 +127,19 @@ The following example lets you delete a cluster in a single AWS Region.
-    ClusterStatus deleteCluster(const String& clusterId, DSQLClient& client) {
-        DeleteClusterRequest request;
-        request.SetIdentifier(clusterId);
-    
-        DeleteClusterOutcome outcome = client.DeleteCluster(request);
-        ClusterStatus status = ClusterStatus::NOT_SET;
-    
-        if (outcome.IsSuccess()) {
-            const auto& cluster = outcome.GetResult();
-            status = cluster.GetStatus();
-        } else {
-            std::cerr << "Delete operation failed: " << outcome.GetError().GetMessage() << std::endl;
+    /**
+     * Deletes a single-region cluster in Amazon Aurora DSQL
+     */
+    void DeleteCluster(const Aws::String& region, const Aws::String& identifier) {
+        // Create client for the specified region
+        DSQL::DSQLClientConfiguration clientConfig;
+        clientConfig.region = region;
+        DSQL::DSQLClient client(clientConfig);
+        
+        // Delete the cluster
+        DeleteClusterRequest deleteRequest;
+        deleteRequest.SetIdentifier(identifier);
+        deleteRequest.SetClientToken(Aws::Utils::UUID::RandomUUID()); 
+        
+        auto deleteOutcome = client.DeleteCluster(deleteRequest);
+        if (!deleteOutcome.IsSuccess()) {
+            std::cerr << "Failed to delete cluster " << identifier << " in " << region << ": " 
+                      << deleteOutcome.GetError().GetMessage() << std::endl;
+            throw std::runtime_error("Unable to delete cluster " + identifier + " in " + region);
@@ -87,2 +147,3 @@ The following example lets you delete a cluster in a single AWS Region.
-        std::cout << "Cluster Status: " << ClusterStatusMapper::GetNameForClusterStatus(status) << std::endl;
-        return status;
+        
+        auto cluster = deleteOutcome.GetResult();
+        std::cout << "Initiated delete of " << cluster.GetArn() << std::endl;
@@ -94,3 +155,5 @@ The following example lets you delete a cluster in a single AWS Region.
-        DSQLClientConfiguration clientConfig;
-    
-        clientConfig.region = "us-east-1";
+        {
+            try {
+                // Define region and cluster ID
+                Aws::String region = "us-east-1";
+                Aws::String clusterId = "<your cluster id>";
@@ -98,2 +161 @@ The following example lets you delete a cluster in a single AWS Region.
-        DSQLClient client(clientConfig);
-        String clusterId = "foo0bar1baz2quux3quuux4";
+                DeleteCluster(region, clusterId);
@@ -101 +163,6 @@ The following example lets you delete a cluster in a single AWS Region.
-        deleteCluster(clusterId, client);
+                std::cout << "Deleted " << clusterId << std::endl;
+            }
+            catch (const std::exception& e) {
+                std::cerr << "Error: " << e.what() << std::endl;
+            }
+        }
@@ -110,0 +177 @@ To delete a multi-Region cluster, use the following example. Deleting a multi-Re
+    #include <aws/core/utils/Outcome.h>
@@ -112,2 +179,2 @@ To delete a multi-Region cluster, use the following example. Deleting a multi-Re
-    #include <aws/dsql/model/DeleteMultiRegionClustersRequest.h>
-    
+    #include <aws/dsql/model/DeleteClusterRequest.h>
+    #include <aws/dsql/model/GetClusterRequest.h>
@@ -115 +182,2 @@ To delete a multi-Region cluster, use the following example. Deleting a multi-Re
-    #include <vector>
+    #include <thread>
+    #include <chrono>
@@ -121,3 +189,31 @@ To delete a multi-Region cluster, use the following example. Deleting a multi-Re
-    std::vector<Aws::String> deleteMultiRegionClusters(const std::vector<Aws::String>& linkedClusterArns, DSQLClient& client) {
-        DeleteMultiRegionClustersRequest request;
-        request.SetLinkedClusterArns(linkedClusterArns);
+    /**
+     * Deletes multi-region clusters in Amazon Aurora DSQL
+     */
+    void DeleteMultiRegionClusters(
+        const Aws::String& region1,
+        const Aws::String& clusterId1,
+        const Aws::String& region2,
+        const Aws::String& clusterId2) {
+        
+        // Create clients for each region
+        DSQL::DSQLClientConfiguration clientConfig1;
+        clientConfig1.region = region1;
+        DSQL::DSQLClient client1(clientConfig1);
+        
+        DSQL::DSQLClientConfiguration clientConfig2;
+        clientConfig2.region = region2;
+        DSQL::DSQLClient client2(clientConfig2);
+        
+        // Delete the first cluster
+        std::cout << "Deleting cluster " << clusterId1 << " in " << region1 << std::endl;