Describe Aurora database engine versions using an Amazon SDK - Amazon Aurora
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Describe Aurora database engine versions using an Amazon SDK

The following code examples show how to describe Aurora database engine versions.

.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> /// Get a list of DB engine versions for a particular DB engine. /// </summary> /// <param name="engine">The name of the engine.</param> /// <param name="parameterGroupFamily">Optional parameter group family name.</param> /// <returns>A list of DBEngineVersions.</returns> public async Task<List<DBEngineVersion>> DescribeDBEngineVersionsForEngineAsync(string engine, string? parameterGroupFamily = null) { var response = await _amazonRDS.DescribeDBEngineVersionsAsync( new DescribeDBEngineVersionsRequest() { Engine = engine, DBParameterGroupFamily = parameterGroupFamily }); return response.DBEngineVersions; }
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); //! Routine which gets available DB engine versions for an engine name and //! an optional parameter group family. /*! \sa getDBEngineVersions() \param engineName: A DB engine name. \param parameterGroupFamily: A parameter group family name, ignored if empty. \param engineVersionsResult: Vector of 'DBEngineVersion' objects returned by the routine. \param client: 'RDSClient' instance. \return bool: Successful completion. */ bool AwsDoc::Aurora::getDBEngineVersions(const Aws::String &engineName, const Aws::String &parameterGroupFamily, Aws::Vector<Aws::RDS::Model::DBEngineVersion> &engineVersionsResult, const Aws::RDS::RDSClient &client) { Aws::RDS::Model::DescribeDBEngineVersionsRequest request; request.SetEngine(engineName); if (!parameterGroupFamily.empty()) { request.SetDBParameterGroupFamily(parameterGroupFamily); } Aws::RDS::Model::DescribeDBEngineVersionsOutcome outcome = client.DescribeDBEngineVersions(request); if (outcome.IsSuccess()) { engineVersionsResult = outcome.GetResult().GetDBEngineVersions(); } else { std::cerr << "Error with Aurora::DescribeDBEngineVersionsRequest. " << outcome.GetError().GetMessage() << std::endl; } return outcome.IsSuccess(); }
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 describeDBEngines( RdsClient rdsClient) { try { DescribeDbEngineVersionsRequest engineVersionsRequest = DescribeDbEngineVersionsRequest.builder() .engine("aurora-mysql") .defaultOnly(true) .maxRecords(20) .build(); DescribeDbEngineVersionsResponse response = rdsClient.describeDBEngineVersions(engineVersionsRequest); List<DBEngineVersion> engines = response.dbEngineVersions(); // Get all DBEngineVersion objects. for (DBEngineVersion engineOb: engines) { System.out.println("The name of the DB parameter group family for the database engine is "+engineOb.dbParameterGroupFamily()); System.out.println("The name of the database engine "+engineOb.engine()); System.out.println("The version number of the database engine "+engineOb.engineVersion()); } } catch (RdsException e) { System.out.println(e.getLocalizedMessage()); System.exit(1); } }
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.

// Get a list of allowed engine versions. suspend fun getAllowedClusterEngines(dbParameterGroupFamilyVal: String?) { val versionsRequest = DescribeDbEngineVersionsRequest { dbParameterGroupFamily = dbParameterGroupFamilyVal engine = "aurora-mysql" } RdsClient { region = "us-west-2" }.use { rdsClient -> val response = rdsClient.describeDbEngineVersions(versionsRequest) response.dbEngineVersions?.forEach { dbEngine -> println("The engine version is ${dbEngine.engineVersion}") println("The engine description is ${dbEngine.dbEngineDescription}") } } }
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 get_engine_versions(self, engine, parameter_group_family=None): """ Gets database engine versions that are available for the specified engine and parameter group family. :param engine: The database engine to look up. :param parameter_group_family: When specified, restricts the returned list of engine versions to those that are compatible with this parameter group family. :return: The list of database engine versions. """ try: kwargs = {'Engine': engine} if parameter_group_family is not None: kwargs['DBParameterGroupFamily'] = parameter_group_family response = self.rds_client.describe_db_engine_versions(**kwargs) versions = response['DBEngineVersions'] except ClientError as err: logger.error( "Couldn't get engine versions for %s. Here's why: %s: %s", engine, err.response['Error']['Code'], err.response['Error']['Message']) raise else: return versions

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.