Create an Aurora DB cluster parameter group using an Amazon SDK
The following code examples show how to create an Aurora DB cluster parameter group.
- .NET
-
- Amazon SDK for .NET
-
Note There's more on GitHub. Find the complete example and learn how to set up and run in the Amazon Code Examples Repository
. /// <summary> /// Create a custom cluster parameter group. /// </summary> /// <param name="parameterGroupFamily">The family of the parameter group.</param> /// <param name="groupName">The name for the new parameter group.</param> /// <param name="description">A description for the new parameter group.</param> /// <returns>The new parameter group object.</returns> public async Task<DBClusterParameterGroup> CreateCustomClusterParameterGroupAsync( string parameterGroupFamily, string groupName, string description) { var request = new CreateDBClusterParameterGroupRequest { DBParameterGroupFamily = parameterGroupFamily, DBClusterParameterGroupName = groupName, Description = description, }; var response = await _amazonRDS.CreateDBClusterParameterGroupAsync(request); return response.DBClusterParameterGroup; }
-
For API details, see CreateDBClusterParameterGroup in Amazon SDK for .NET API Reference.
-
- C++
-
- SDK for C++
-
Note There's more on GitHub. Find the complete example and learn how to set up and run in the Amazon Code Examples Repository
. Aws::Client::ClientConfiguration clientConfig; // Optional: Set to the AWS Region (overrides config file). // clientConfig.region = "us-east-1"; Aws::RDS::RDSClient client(clientConfig); Aws::RDS::Model::CreateDBClusterParameterGroupRequest request; request.SetDBClusterParameterGroupName(CLUSTER_PARAMETER_GROUP_NAME); request.SetDBParameterGroupFamily(dbParameterGroupFamily); request.SetDescription("Example cluster parameter group."); Aws::RDS::Model::CreateDBClusterParameterGroupOutcome outcome = client.CreateDBClusterParameterGroup(request); if (outcome.IsSuccess()) { std::cout << "The DB cluster parameter group was successfully created." << std::endl; } else { std::cerr << "Error with Aurora::CreateDBClusterParameterGroup. " << outcome.GetError().GetMessage() << std::endl; return false; }
-
For API details, see CreateDBClusterParameterGroup in Amazon SDK for C++ API Reference.
-
- Java
-
- SDK for Java 2.x
-
Note There's more on GitHub. Find the complete example and learn how to set up and run in the Amazon Code Examples Repository
. public static void createDBClusterParameterGroup(RdsClient rdsClient, String dbClusterGroupName, String dbParameterGroupFamily) { try { CreateDbClusterParameterGroupRequest groupRequest = CreateDbClusterParameterGroupRequest.builder() .dbClusterParameterGroupName(dbClusterGroupName) .dbParameterGroupFamily(dbParameterGroupFamily) .description("Created by using the AWS SDK for Java") .build(); CreateDbClusterParameterGroupResponse response = rdsClient.createDBClusterParameterGroup(groupRequest); System.out.println("The group name is "+ response.dbClusterParameterGroup().dbClusterParameterGroupName()); } catch (RdsException e) { System.out.println(e.getLocalizedMessage()); System.exit(1); } }
-
For API details, see CreateDBClusterParameterGroup in Amazon SDK for Java 2.x API Reference.
-
- Kotlin
-
- SDK for Kotlin
-
Note This is prerelease documentation for a feature in preview release. It is subject to change.
Note There's more on GitHub. Find the complete example and learn how to set up and run in the Amazon Code Examples Repository
. suspend fun createDBClusterParameterGroup(dbClusterGroupNameVal: String?, dbParameterGroupFamilyVal: String?) { val groupRequest = CreateDbClusterParameterGroupRequest { dbClusterParameterGroupName = dbClusterGroupNameVal dbParameterGroupFamily = dbParameterGroupFamilyVal description = "Created by using the AWS SDK for Kotlin" } RdsClient { region = "us-west-2" }.use { rdsClient -> val response = rdsClient.createDbClusterParameterGroup(groupRequest) println("The group name is ${response.dbClusterParameterGroup?.dbClusterParameterGroupName}") } }
-
For API details, see CreateDBClusterParameterGroup
in Amazon SDK for Kotlin API reference.
-
- Python
-
- SDK for Python (Boto3)
-
Note There's more on GitHub. Find the complete example and learn how to set up and run in the Amazon Code Examples Repository
. class AuroraWrapper: """Encapsulates Aurora DB cluster actions.""" def __init__(self, rds_client): """ :param rds_client: A Boto3 Amazon Relational Database Service (Amazon RDS) client. """ self.rds_client = rds_client @classmethod def from_client(cls): """ Instantiates this class from a Boto3 client. """ rds_client = boto3.client('rds') return cls(rds_client) def create_parameter_group(self, parameter_group_name, parameter_group_family, description): """ Creates a DB cluster parameter group that is based on the specified parameter group family. :param parameter_group_name: The name of the newly created parameter group. :param parameter_group_family: The family that is used as the basis of the new parameter group. :param description: A description given to the parameter group. :return: Data about the newly created parameter group. """ try: response = self.rds_client.create_db_cluster_parameter_group( DBClusterParameterGroupName=parameter_group_name, DBParameterGroupFamily=parameter_group_family, Description=description) except ClientError as err: logger.error( "Couldn't create parameter group %s. Here's why: %s: %s", parameter_group_name, err.response['Error']['Code'], err.response['Error']['Message']) raise else: return response
-
For API details, see CreateDBClusterParameterGroup in Amazon SDK for Python (Boto3) API Reference.
-
For a complete list of Amazon SDK developer guides and code examples, see Using this service with an Amazon SDK. This topic also includes information about getting started and details about previous SDK versions.