AWS Security ChangesHomeSearch

AWS code-library documentation change

Service: code-library · 2025-08-16 · Documentation low

File: code-library/latest/ug/rds_example_rds_CreateDBInstance_section.md

Summary

Added Swift SDK code example for CreateDBInstance API with parameters including masterUsername/password

Security assessment

The change adds a standard code example for database creation without any specific security warnings, credential handling guidance, or vulnerability mitigation. While it includes password parameter documentation, this is part of normal API usage documentation rather than addressing a security issue.

Diff

diff --git a/code-library/latest/ug/rds_example_rds_CreateDBInstance_section.md b/code-library/latest/ug/rds_example_rds_CreateDBInstance_section.md
index 516328123..56448c03c 100644
--- a//code-library/latest/ug/rds_example_rds_CreateDBInstance_section.md
+++ b//code-library/latest/ug/rds_example_rds_CreateDBInstance_section.md
@@ -684,0 +685,70 @@ There's more on GitHub. Find the complete example and learn how to set up and ru
+Swift
+    
+
+**SDK for Swift**
+    
+
+###### Note
+
+There's more on GitHub. Find the complete example and learn how to set up and run in the [AWS Code Examples Repository](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/swift/example_code/rds#code-examples). 
+    
+    
+    import AWSRDS
+    
+        /// Create a new database instance.
+        /// 
+        /// - Parameters:
+        ///   - name: The name of the database to create.
+        ///   - instanceIdentifier: The identifier to give the new database
+        ///     instance.
+        ///   - parameterGroupName: The name of the parameter group to associate
+        ///     with the new database instance.
+        ///   - engine: The database engine to use.
+        ///   - engineVersion: The version of the database given by `engine` to
+        ///     use.
+        ///   - instanceClass: The memory and compute capacity of the database
+        ///     instance, such as `db.m5.large``.
+        ///   - username: The admin user's username to establish for the new
+        ///     instance.
+        ///   - password: The password to use for the specified user's access.
+        /// 
+        /// - Returns: A string indicating the ARN of the newly created database
+        ///   instance, or nil if the instance couldn't be created.
+        func createDBInstance(name: String, instanceIdentifier: String, parameterGroupName: String,
+                              engine: String, engineVersion: String, instanceClass: String,
+                              username: String, password: String) async -> String? {
+            do {
+                let output = try await rdsClient.createDBInstance(
+                    input: CreateDBInstanceInput(
+                        allocatedStorage: 100,
+                        dbInstanceClass: instanceClass,
+                        dbInstanceIdentifier: instanceIdentifier,
+                        dbName: name,
+                        dbParameterGroupName: parameterGroupName,
+                        engine: engine,
+                        engineVersion: engineVersion,
+                        masterUserPassword: password,
+                        masterUsername: username,
+                        storageType: "gp2"
+                    )
+                )
+    
+                guard let dbInstance = output.dbInstance else {
+                    print("*** Unable to get the database instance.")
+                    return nil
+                }
+    
+                return dbInstance.dbInstanceArn
+            } catch {
+                print("*** An error occurred while creating the database instance: \(error.localizedDescription)")
+                return nil
+            }
+        }
+    
+    
+
+  * For API details, see [CreateDBInstance](https://sdk.amazonaws.com/swift/api/awsrds/latest/documentation/awsrds/rdsclient/createdbinstance\(input:\)) in _AWS SDK for Swift API reference_. 
+
+
+
+