AWS 文档 AWS SDK示例 GitHub 存储库中还有更多SDK示例
本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
使用 Aurora 的示例 AWS SDK for .NET
以下代码示例向您展示了如何通过 AWS SDK for .NET 与 Aurora 一起使用来执行操作和实现常见场景。
基础知识是向您展示如何在服务中执行基本操作的代码示例。
操作是大型程序的代码摘录,必须在上下文中运行。您可以通过操作了解如何调用单个服务函数,还可以通过函数相关场景的上下文查看操作。
场景是向您展示如何通过在一个服务中调用多个函数或与其他 AWS 服务结合来完成特定任务的代码示例。
每个示例都包含一个指向完整源代码的链接,您可以在其中找到有关如何在上下文中设置和运行代码的说明。
开始使用
以下代码示例显示如何开始使用 Aurora。
- AWS SDK for .NET
-
注意
还有更多相关信息 GitHub。查找完整示例,学习如何在 AWS 代码示例存储库
中进行设置和运行。 using Amazon.RDS; using Amazon.RDS.Model; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; namespace AuroraActions; public static class HelloAurora { static async Task Main(string[] args) { // Use the AWS .NET Core Setup package to set up dependency injection for the // Amazon Relational Database Service (Amazon RDS). // Use your AWS profile name, or leave it blank to use the default profile. using var host = Host.CreateDefaultBuilder(args) .ConfigureServices((_, services) => services.AddAWSService<IAmazonRDS>() ).Build(); // Now the client is available for injection. Fetching it directly here for example purposes only. var rdsClient = host.Services.GetRequiredService<IAmazonRDS>(); // You can use await and any of the async methods to get a response. var response = await rdsClient.DescribeDBClustersAsync(new DescribeDBClustersRequest { IncludeShared = true }); Console.WriteLine($"Hello Amazon RDS Aurora! Let's list some clusters in this account:"); foreach (var cluster in response.DBClusters) { Console.WriteLine($"\tCluster: database: {cluster.DatabaseName} identifier: {cluster.DBClusterIdentifier}."); } } }
-
有关API详细信息,请参阅escribeDBClusters《AWS SDK for .NET API参考资料》中的 D。
-
基础知识
以下代码示例展示了如何:
创建自定义 Aurora 数据库集群参数组并设置参数值。
创建一个使用参数组的数据库集群。
创建包含数据库的数据库实例。
拍摄数据库集群的快照,然后清理资源。
- AWS SDK for .NET
-
注意
还有更多相关信息 GitHub。查找完整示例,学习如何在 AWS 代码示例存储库
中进行设置和运行。 在命令提示符中运行交互式场景。
using Amazon.RDS; using Amazon.RDS.Model; using AuroraActions; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Console; using Microsoft.Extensions.Logging.Debug; namespace AuroraScenario; /// <summary> /// Scenario for Amazon Aurora examples. /// </summary> public class AuroraScenario { /* Before running this .NET code example, set up your development environment, including your credentials. This .NET example performs the following tasks: 1. Return a list of the available DB engine families for Aurora MySql using the DescribeDBEngineVersionsAsync method. 2. Select an engine family and create a custom DB cluster parameter group using the CreateDBClusterParameterGroupAsync method. 3. Get the parameter group using the DescribeDBClusterParameterGroupsAsync method. 4. Get some parameters in the group using the DescribeDBClusterParametersAsync method. 5. Parse and display some parameters in the group. 6. Modify the auto_increment_offset and auto_increment_increment parameters using the ModifyDBClusterParameterGroupAsync method. 7. Get and display the updated parameters using the DescribeDBClusterParametersAsync method with a source of "user". 8. Get a list of allowed engine versions using the DescribeDBEngineVersionsAsync method. 9. Create an Aurora DB cluster that contains a MySql database and uses the parameter group. using the CreateDBClusterAsync method. 10. Wait for the DB cluster to be ready using the DescribeDBClustersAsync method. 11. Display and select from a list of instance classes available for the selected engine and version using the paginated DescribeOrderableDBInstanceOptions method. 12. Create a database instance in the cluster using the CreateDBInstanceAsync method. 13. Wait for the DB instance to be ready using the DescribeDBInstances method. 14. Display the connection endpoint string for the new DB cluster. 15. Create a snapshot of the DB cluster using the CreateDBClusterSnapshotAsync method. 16. Wait for DB snapshot to be ready using the DescribeDBClusterSnapshotsAsync method. 17. Delete the DB instance using the DeleteDBInstanceAsync method. 18. Delete the DB cluster using the DeleteDBClusterAsync method. 19. Wait for DB cluster to be deleted using the DescribeDBClustersAsync methods. 20. Delete the cluster parameter group using the DeleteDBClusterParameterGroupAsync. */ private static readonly string sepBar = new('-', 80); private static AuroraWrapper auroraWrapper = null!; private static ILogger logger = null!; private static readonly string engine = "aurora-mysql"; static async Task Main(string[] args) { // Set up dependency injection for the Amazon Relational Database Service (Amazon RDS). using var host = Host.CreateDefaultBuilder(args) .ConfigureLogging(logging => logging.AddFilter("System", LogLevel.Debug) .AddFilter<DebugLoggerProvider>("Microsoft", LogLevel.Information) .AddFilter<ConsoleLoggerProvider>("Microsoft", LogLevel.Trace)) .ConfigureServices((_, services) => services.AddAWSService<IAmazonRDS>() .AddTransient<AuroraWrapper>() ) .Build(); logger = LoggerFactory.Create(builder => { builder.AddConsole(); }).CreateLogger<AuroraScenario>(); auroraWrapper = host.Services.GetRequiredService<AuroraWrapper>(); Console.WriteLine(sepBar); Console.WriteLine( "Welcome to the Amazon Aurora: get started with DB clusters example."); Console.WriteLine(sepBar); DBClusterParameterGroup parameterGroup = null!; DBCluster? newCluster = null; DBInstance? newInstance = null; try { var parameterGroupFamily = await ChooseParameterGroupFamilyAsync(); parameterGroup = await CreateDBParameterGroupAsync(parameterGroupFamily); var parameters = await DescribeParametersInGroupAsync(parameterGroup.DBClusterParameterGroupName, new List<string> { "auto_increment_offset", "auto_increment_increment" }); await ModifyParametersAsync(parameterGroup.DBClusterParameterGroupName, parameters); await DescribeUserSourceParameters(parameterGroup.DBClusterParameterGroupName); var engineVersionChoice = await ChooseDBEngineVersionAsync(parameterGroupFamily); var newClusterIdentifier = "Example-Cluster-" + DateTime.Now.Ticks; newCluster = await CreateNewCluster ( parameterGroup, engine, engineVersionChoice.EngineVersion, newClusterIdentifier ); var instanceClassChoice = await ChooseDBInstanceClass(engine, engineVersionChoice.EngineVersion); var newInstanceIdentifier = "Example-Instance-" + DateTime.Now.Ticks; newInstance = await CreateNewInstance( newClusterIdentifier, engine, engineVersionChoice.EngineVersion, instanceClassChoice.DBInstanceClass, newInstanceIdentifier ); DisplayConnectionString(newCluster!); await CreateSnapshot(newCluster!); await CleanupResources(newInstance, newCluster, parameterGroup); Console.WriteLine("Scenario complete."); Console.WriteLine(sepBar); } catch (Exception ex) { await CleanupResources(newInstance, newCluster, parameterGroup); logger.LogError(ex, "There was a problem executing the scenario."); } } /// <summary> /// Choose the Aurora DB parameter group family from a list of available options. /// </summary> /// <returns>The selected parameter group family.</returns> public static async Task<string> ChooseParameterGroupFamilyAsync() { Console.WriteLine(sepBar); // 1. Get a list of available engines. var engines = await auroraWrapper.DescribeDBEngineVersionsForEngineAsync(engine); Console.WriteLine($"1. The following is a list of available DB parameter group families for engine {engine}:"); var parameterGroupFamilies = engines.GroupBy(e => e.DBParameterGroupFamily).ToList(); for (var i = 1; i <= parameterGroupFamilies.Count; i++) { var parameterGroupFamily = parameterGroupFamilies[i - 1]; // List the available parameter group families. Console.WriteLine( $"\t{i}. Family: {parameterGroupFamily.Key}"); } var choiceNumber = 0; while (choiceNumber < 1 || choiceNumber > parameterGroupFamilies.Count) { Console.WriteLine("2. Select an available DB parameter group family by entering a number from the preceding list:"); var choice = Console.ReadLine(); Int32.TryParse(choice, out choiceNumber); } var parameterGroupFamilyChoice = parameterGroupFamilies[choiceNumber - 1]; Console.WriteLine(sepBar); return parameterGroupFamilyChoice.Key; } /// <summary> /// Create and get information on a DB parameter group. /// </summary> /// <param name="dbParameterGroupFamily">The DBParameterGroupFamily for the new DB parameter group.</param> /// <returns>The new DBParameterGroup.</returns> public static async Task<DBClusterParameterGroup> CreateDBParameterGroupAsync(string dbParameterGroupFamily) { Console.WriteLine(sepBar); Console.WriteLine($"2. Create new DB parameter group with family {dbParameterGroupFamily}:"); var parameterGroup = await auroraWrapper.CreateCustomClusterParameterGroupAsync( dbParameterGroupFamily, "ExampleParameterGroup-" + DateTime.Now.Ticks, "New example parameter group"); var groupInfo = await auroraWrapper.DescribeCustomDBClusterParameterGroupAsync(parameterGroup.DBClusterParameterGroupName); Console.WriteLine( $"3. New DB parameter group created: \n\t{groupInfo?.Description}, \n\tARN {groupInfo?.DBClusterParameterGroupName}"); Console.WriteLine(sepBar); return parameterGroup; } /// <summary> /// Get and describe parameters from a DBParameterGroup. /// </summary> /// <param name="parameterGroupName">The name of the DBParameterGroup.</param> /// <param name="parameterNames">Optional specific names of parameters to describe.</param> /// <returns>The list of requested parameters.</returns> public static async Task<List<Parameter>> DescribeParametersInGroupAsync(string parameterGroupName, List<string>? parameterNames = null) { Console.WriteLine(sepBar); Console.WriteLine("4. Get some parameters from the group."); Console.WriteLine(sepBar); var parameters = await auroraWrapper.DescribeDBClusterParametersInGroupAsync(parameterGroupName); var matchingParameters = parameters.Where(p => parameterNames == null || parameterNames.Contains(p.ParameterName)).ToList(); Console.WriteLine("5. Parameter information:"); matchingParameters.ForEach(p => Console.WriteLine( $"\n\tParameter: {p.ParameterName}." + $"\n\tDescription: {p.Description}." + $"\n\tAllowed Values: {p.AllowedValues}." + $"\n\tValue: {p.ParameterValue}.")); Console.WriteLine(sepBar); return matchingParameters; } /// <summary> /// Modify a parameter from a DBParameterGroup. /// </summary> /// <param name="parameterGroupName">Name of the DBParameterGroup.</param> /// <param name="parameters">The parameters to modify.</param> /// <returns>Async task.</returns> public static async Task ModifyParametersAsync(string parameterGroupName, List<Parameter> parameters) { Console.WriteLine(sepBar); Console.WriteLine("6. Modify some parameters in the group."); await auroraWrapper.ModifyIntegerParametersInGroupAsync(parameterGroupName, parameters); Console.WriteLine(sepBar); } /// <summary> /// Describe the user source parameters in the group. /// </summary> /// <param name="parameterGroupName">The name of the DBParameterGroup.</param> /// <returns>Async task.</returns> public static async Task DescribeUserSourceParameters(string parameterGroupName) { Console.WriteLine(sepBar); Console.WriteLine("7. Describe updated user source parameters in the group."); var parameters = await auroraWrapper.DescribeDBClusterParametersInGroupAsync(parameterGroupName, "user"); parameters.ForEach(p => Console.WriteLine( $"\n\tParameter: {p.ParameterName}." + $"\n\tDescription: {p.Description}." + $"\n\tAllowed Values: {p.AllowedValues}." + $"\n\tValue: {p.ParameterValue}.")); Console.WriteLine(sepBar); } /// <summary> /// Choose a DB engine version. /// </summary> /// <param name="dbParameterGroupFamily">DB parameter group family for engine choice.</param> /// <returns>The selected engine version.</returns> public static async Task<DBEngineVersion> ChooseDBEngineVersionAsync(string dbParameterGroupFamily) { Console.WriteLine(sepBar); // Get a list of allowed engines. var allowedEngines = await auroraWrapper.DescribeDBEngineVersionsForEngineAsync(engine, dbParameterGroupFamily); Console.WriteLine($"Available DB engine versions for parameter group family {dbParameterGroupFamily}:"); int i = 1; foreach (var version in allowedEngines) { Console.WriteLine( $"\t{i}. {version.DBEngineVersionDescription}."); i++; } var choiceNumber = 0; while (choiceNumber < 1 || choiceNumber > allowedEngines.Count) { Console.WriteLine("8. Select an available DB engine version by entering a number from the list above:"); var choice = Console.ReadLine(); Int32.TryParse(choice, out choiceNumber); } var engineChoice = allowedEngines[choiceNumber - 1]; Console.WriteLine(sepBar); return engineChoice; } /// <summary> /// Create a new RDS DB cluster. /// </summary> /// <param name="parameterGroup">Parameter group to use for the DB cluster.</param> /// <param name="engineName">Engine to use for the DB cluster.</param> /// <param name="engineVersion">Engine version to use for the DB cluster.</param> /// <param name="clusterIdentifier">Cluster identifier to use for the DB cluster.</param> /// <returns>The new DB cluster.</returns> public static async Task<DBCluster?> CreateNewCluster(DBClusterParameterGroup parameterGroup, string engineName, string engineVersion, string clusterIdentifier) { Console.WriteLine(sepBar); Console.WriteLine($"9. Create a new DB cluster with identifier {clusterIdentifier}."); DBCluster newCluster; var clusters = await auroraWrapper.DescribeDBClustersPagedAsync(); var isClusterCreated = clusters.Any(i => i.DBClusterIdentifier == clusterIdentifier); if (isClusterCreated) { Console.WriteLine("Cluster already created."); newCluster = clusters.First(i => i.DBClusterIdentifier == clusterIdentifier); } else { Console.WriteLine("Enter an admin username:"); var username = Console.ReadLine(); Console.WriteLine("Enter an admin password:"); var password = Console.ReadLine(); newCluster = await auroraWrapper.CreateDBClusterWithAdminAsync( "ExampleDatabase", clusterIdentifier, parameterGroup.DBClusterParameterGroupName, engineName, engineVersion, username!, password! ); Console.WriteLine("10. Waiting for DB cluster to be ready..."); while (newCluster.Status != "available") { Console.Write("."); Thread.Sleep(5000); clusters = await auroraWrapper.DescribeDBClustersPagedAsync(clusterIdentifier); newCluster = clusters.First(); } } Console.WriteLine(sepBar); return newCluster; } /// <summary> /// Choose a DB instance class for a particular engine and engine version. /// </summary> /// <param name="engine">DB engine for DB instance choice.</param> /// <param name="engineVersion">DB engine version for DB instance choice.</param> /// <returns>The selected orderable DB instance option.</returns> public static async Task<OrderableDBInstanceOption> ChooseDBInstanceClass(string engine, string engineVersion) { Console.WriteLine(sepBar); // Get a list of allowed DB instance classes. var allowedInstances = await auroraWrapper.DescribeOrderableDBInstanceOptionsPagedAsync(engine, engineVersion); Console.WriteLine($"Available DB instance classes for engine {engine} and version {engineVersion}:"); int i = 1; foreach (var instance in allowedInstances) { Console.WriteLine( $"\t{i}. Instance class: {instance.DBInstanceClass} (storage type {instance.StorageType})"); i++; } var choiceNumber = 0; while (choiceNumber < 1 || choiceNumber > allowedInstances.Count) { Console.WriteLine("11. Select an available DB instance class by entering a number from the preceding list:"); var choice = Console.ReadLine(); Int32.TryParse(choice, out choiceNumber); } var instanceChoice = allowedInstances[choiceNumber - 1]; Console.WriteLine(sepBar); return instanceChoice; } /// <summary> /// Create a new DB instance. /// </summary> /// <param name="engineName">Engine to use for the DB instance.</param> /// <param name="engineVersion">Engine version to use for the DB instance.</param> /// <param name="instanceClass">Instance class to use for the DB instance.</param> /// <param name="instanceIdentifier">Instance identifier to use for the DB instance.</param> /// <returns>The new DB instance.</returns> public static async Task<DBInstance?> CreateNewInstance( string clusterIdentifier, string engineName, string engineVersion, string instanceClass, string instanceIdentifier) { Console.WriteLine(sepBar); Console.WriteLine($"12. Create a new DB instance with identifier {instanceIdentifier}."); bool isInstanceReady = false; DBInstance newInstance; var instances = await auroraWrapper.DescribeDBInstancesPagedAsync(); isInstanceReady = instances.FirstOrDefault(i => i.DBInstanceIdentifier == instanceIdentifier)?.DBInstanceStatus == "available"; if (isInstanceReady) { Console.WriteLine("Instance already created."); newInstance = instances.First(i => i.DBInstanceIdentifier == instanceIdentifier); } else { newInstance = await auroraWrapper.CreateDBInstanceInClusterAsync( clusterIdentifier, instanceIdentifier, engineName, engineVersion, instanceClass ); Console.WriteLine("13. Waiting for DB instance to be ready..."); while (!isInstanceReady) { Console.Write("."); Thread.Sleep(5000); instances = await auroraWrapper.DescribeDBInstancesPagedAsync(instanceIdentifier); isInstanceReady = instances.FirstOrDefault()?.DBInstanceStatus == "available"; newInstance = instances.First(); } } Console.WriteLine(sepBar); return newInstance; } /// <summary> /// Display a connection string for an Amazon RDS DB cluster. /// </summary> /// <param name="cluster">The DB cluster to use to get a connection string.</param> public static void DisplayConnectionString(DBCluster cluster) { Console.WriteLine(sepBar); // Display the connection string. Console.WriteLine("14. New DB cluster connection string: "); Console.WriteLine( $"\n{engine} -h {cluster.Endpoint} -P {cluster.Port} " + $"-u {cluster.MasterUsername} -p [YOUR PASSWORD]\n"); Console.WriteLine(sepBar); } /// <summary> /// Create a snapshot from an Amazon RDS DB cluster. /// </summary> /// <param name="cluster">DB cluster to use when creating a snapshot.</param> /// <returns>The snapshot object.</returns> public static async Task<DBClusterSnapshot> CreateSnapshot(DBCluster cluster) { Console.WriteLine(sepBar); // Create a snapshot. Console.WriteLine($"15. Creating snapshot from DB cluster {cluster.DBClusterIdentifier}."); var snapshot = await auroraWrapper.CreateClusterSnapshotByIdentifierAsync( cluster.DBClusterIdentifier, "ExampleSnapshot-" + DateTime.Now.Ticks); // Wait for the snapshot to be available. bool isSnapshotReady = false; Console.WriteLine($"16. Waiting for snapshot to be ready..."); while (!isSnapshotReady) { Console.Write("."); Thread.Sleep(5000); var snapshots = await auroraWrapper.DescribeDBClusterSnapshotsByIdentifierAsync(cluster.DBClusterIdentifier); isSnapshotReady = snapshots.FirstOrDefault()?.Status == "available"; snapshot = snapshots.First(); } Console.WriteLine( $"Snapshot {snapshot.DBClusterSnapshotIdentifier} status is {snapshot.Status}."); Console.WriteLine(sepBar); return snapshot; } /// <summary> /// Clean up resources from the scenario. /// </summary> /// <param name="newInstance">The instance to clean up.</param> /// <param name="newCluster">The cluster to clean up.</param> /// <param name="parameterGroup">The parameter group to clean up.</param> /// <returns>Async Task.</returns> private static async Task CleanupResources( DBInstance? newInstance, DBCluster? newCluster, DBClusterParameterGroup? parameterGroup) { Console.WriteLine(new string('-', 80)); Console.WriteLine($"Clean up resources."); if (newInstance is not null && GetYesNoResponse($"\tClean up instance {newInstance.DBInstanceIdentifier}? (y/n)")) { // Delete the DB instance. Console.WriteLine($"17. Deleting the DB instance {newInstance.DBInstanceIdentifier}."); await auroraWrapper.DeleteDBInstanceByIdentifierAsync(newInstance.DBInstanceIdentifier); } if (newCluster is not null && GetYesNoResponse($"\tClean up cluster {newCluster.DBClusterIdentifier}? (y/n)")) { // Delete the DB cluster. Console.WriteLine($"18. Deleting the DB cluster {newCluster.DBClusterIdentifier}."); await auroraWrapper.DeleteDBClusterByIdentifierAsync(newCluster.DBClusterIdentifier); // Wait for the DB cluster to delete. Console.WriteLine($"19. Waiting for the DB cluster to delete..."); bool isClusterDeleted = false; while (!isClusterDeleted) { Console.Write("."); Thread.Sleep(5000); var cluster = await auroraWrapper.DescribeDBClustersPagedAsync(); isClusterDeleted = cluster.All(i => i.DBClusterIdentifier != newCluster.DBClusterIdentifier); } Console.WriteLine("DB cluster deleted."); } if (parameterGroup is not null && GetYesNoResponse($"\tClean up parameter group? (y/n)")) { Console.WriteLine($"20. Deleting the DB parameter group {parameterGroup.DBClusterParameterGroupName}."); await auroraWrapper.DeleteClusterParameterGroupByNameAsync(parameterGroup.DBClusterParameterGroupName); Console.WriteLine("Parameter group deleted."); } Console.WriteLine(new string('-', 80)); } /// <summary> /// Get a yes or no response from the user. /// </summary> /// <param name="question">The question string to print on the console.</param> /// <returns>True if the user responds with a yes.</returns> private static bool GetYesNoResponse(string question) { Console.WriteLine(question); var ynResponse = Console.ReadLine(); var response = ynResponse != null && ynResponse.Equals("y", StringComparison.InvariantCultureIgnoreCase); return response; }
场景调用以管理 Aurora 操作的包装程序方法。
using Amazon.RDS; using Amazon.RDS.Model; namespace AuroraActions; /// <summary> /// Wrapper for the Amazon Aurora cluster client operations. /// </summary> public class AuroraWrapper { private readonly IAmazonRDS _amazonRDS; public AuroraWrapper(IAmazonRDS amazonRDS) { _amazonRDS = amazonRDS; } /// <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; } /// <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; } /// <summary> /// Describe the cluster parameters in a parameter group. /// </summary> /// <param name="groupName">The name of the parameter group.</param> /// <param name="source">The optional name of the source filter.</param> /// <returns>The collection of parameters.</returns> public async Task<List<Parameter>> DescribeDBClusterParametersInGroupAsync(string groupName, string? source = null) { var paramList = new List<Parameter>(); DescribeDBClusterParametersResponse response; var request = new DescribeDBClusterParametersRequest { DBClusterParameterGroupName = groupName, Source = source, }; // Get the full list if there are multiple pages. do { response = await _amazonRDS.DescribeDBClusterParametersAsync(request); paramList.AddRange(response.Parameters); request.Marker = response.Marker; } while (response.Marker is not null); return paramList; } /// <summary> /// Get the description of a DB cluster parameter group by name. /// </summary> /// <param name="name">The name of the DB parameter group to describe.</param> /// <returns>The parameter group description.</returns> public async Task<DBClusterParameterGroup?> DescribeCustomDBClusterParameterGroupAsync(string name) { var response = await _amazonRDS.DescribeDBClusterParameterGroupsAsync( new DescribeDBClusterParameterGroupsRequest() { DBClusterParameterGroupName = name }); return response.DBClusterParameterGroups.FirstOrDefault(); } /// <summary> /// Modify the specified integer parameters with new values from user input. /// </summary> /// <param name="groupName">The group name for the parameters.</param> /// <param name="parameters">The list of integer parameters to modify.</param> /// <param name="newValue">Optional int value to set for parameters.</param> /// <returns>The name of the group that was modified.</returns> public async Task<string> ModifyIntegerParametersInGroupAsync(string groupName, List<Parameter> parameters, int newValue = 0) { foreach (var p in parameters) { if (p.IsModifiable && p.DataType == "integer") { while (newValue == 0) { Console.WriteLine( $"Enter a new value for {p.ParameterName} from the allowed values {p.AllowedValues} "); var choice = Console.ReadLine(); int.TryParse(choice, out newValue); } p.ParameterValue = newValue.ToString(); } } var request = new ModifyDBClusterParameterGroupRequest { Parameters = parameters, DBClusterParameterGroupName = groupName, }; var result = await _amazonRDS.ModifyDBClusterParameterGroupAsync(request); return result.DBClusterParameterGroupName; } /// <summary> /// Get a list of orderable DB instance options for a specific /// engine and engine version. /// </summary> /// <param name="engine">Name of the engine.</param> /// <param name="engineVersion">Version of the engine.</param> /// <returns>List of OrderableDBInstanceOptions.</returns> public async Task<List<OrderableDBInstanceOption>> DescribeOrderableDBInstanceOptionsPagedAsync(string engine, string engineVersion) { // Use a paginator to get a list of DB instance options. var results = new List<OrderableDBInstanceOption>(); var paginateInstanceOptions = _amazonRDS.Paginators.DescribeOrderableDBInstanceOptions( new DescribeOrderableDBInstanceOptionsRequest() { Engine = engine, EngineVersion = engineVersion, }); // Get the entire list using the paginator. await foreach (var instanceOptions in paginateInstanceOptions.OrderableDBInstanceOptions) { results.Add(instanceOptions); } return results; } /// <summary> /// Delete a particular parameter group by name. /// </summary> /// <param name="groupName">The name of the parameter group.</param> /// <returns>True if successful.</returns> public async Task<bool> DeleteClusterParameterGroupByNameAsync(string groupName) { var request = new DeleteDBClusterParameterGroupRequest { DBClusterParameterGroupName = groupName, }; var response = await _amazonRDS.DeleteDBClusterParameterGroupAsync(request); return response.HttpStatusCode == System.Net.HttpStatusCode.OK; } /// <summary> /// Create a new cluster and database. /// </summary> /// <param name="dbName">The name of the new database.</param> /// <param name="clusterIdentifier">The identifier of the cluster.</param> /// <param name="parameterGroupName">The name of the parameter group.</param> /// <param name="dbEngine">The engine to use for the new cluster.</param> /// <param name="dbEngineVersion">The version of the engine to use.</param> /// <param name="adminName">The admin username.</param> /// <param name="adminPassword">The primary admin password.</param> /// <returns>The cluster object.</returns> public async Task<DBCluster> CreateDBClusterWithAdminAsync( string dbName, string clusterIdentifier, string parameterGroupName, string dbEngine, string dbEngineVersion, string adminName, string adminPassword) { var request = new CreateDBClusterRequest { DatabaseName = dbName, DBClusterIdentifier = clusterIdentifier, DBClusterParameterGroupName = parameterGroupName, Engine = dbEngine, EngineVersion = dbEngineVersion, MasterUsername = adminName, MasterUserPassword = adminPassword, }; var response = await _amazonRDS.CreateDBClusterAsync(request); return response.DBCluster; } /// <summary> /// Returns a list of DB instances. /// </summary> /// <param name="dbInstanceIdentifier">Optional name of a specific DB instance.</param> /// <returns>List of DB instances.</returns> public async Task<List<DBInstance>> DescribeDBInstancesPagedAsync(string? dbInstanceIdentifier = null) { var results = new List<DBInstance>(); var instancesPaginator = _amazonRDS.Paginators.DescribeDBInstances( new DescribeDBInstancesRequest { DBInstanceIdentifier = dbInstanceIdentifier }); // Get the entire list using the paginator. await foreach (var instances in instancesPaginator.DBInstances) { results.Add(instances); } return results; } /// <summary> /// Returns a list of DB clusters. /// </summary> /// <param name="dbInstanceIdentifier">Optional name of a specific DB cluster.</param> /// <returns>List of DB clusters.</returns> public async Task<List<DBCluster>> DescribeDBClustersPagedAsync(string? dbClusterIdentifier = null) { var results = new List<DBCluster>(); DescribeDBClustersResponse response; DescribeDBClustersRequest request = new DescribeDBClustersRequest { DBClusterIdentifier = dbClusterIdentifier }; // Get the full list if there are multiple pages. do { response = await _amazonRDS.DescribeDBClustersAsync(request); results.AddRange(response.DBClusters); request.Marker = response.Marker; } while (response.Marker is not null); return results; } /// <summary> /// Create an Amazon Relational Database Service (Amazon RDS) DB instance /// with a particular set of properties. Use the action DescribeDBInstancesAsync /// to determine when the DB instance is ready to use. /// </summary> /// <param name="dbInstanceIdentifier">DB instance identifier.</param> /// <param name="dbClusterIdentifier">DB cluster identifier.</param> /// <param name="dbEngine">The engine for the DB instance.</param> /// <param name="dbEngineVersion">Version for the DB instance.</param> /// <param name="instanceClass">Class for the DB instance.</param> /// <returns>DB instance object.</returns> public async Task<DBInstance> CreateDBInstanceInClusterAsync( string dbClusterIdentifier, string dbInstanceIdentifier, string dbEngine, string dbEngineVersion, string instanceClass) { // When creating the instance within a cluster, do not specify the name or size. var response = await _amazonRDS.CreateDBInstanceAsync( new CreateDBInstanceRequest() { DBClusterIdentifier = dbClusterIdentifier, DBInstanceIdentifier = dbInstanceIdentifier, Engine = dbEngine, EngineVersion = dbEngineVersion, DBInstanceClass = instanceClass }); return response.DBInstance; } /// <summary> /// Create a snapshot of a cluster. /// </summary> /// <param name="dbClusterIdentifier">DB cluster identifier.</param> /// <param name="snapshotIdentifier">Identifier for the snapshot.</param> /// <returns>DB snapshot object.</returns> public async Task<DBClusterSnapshot> CreateClusterSnapshotByIdentifierAsync(string dbClusterIdentifier, string snapshotIdentifier) { var response = await _amazonRDS.CreateDBClusterSnapshotAsync( new CreateDBClusterSnapshotRequest() { DBClusterIdentifier = dbClusterIdentifier, DBClusterSnapshotIdentifier = snapshotIdentifier, }); return response.DBClusterSnapshot; } /// <summary> /// Return a list of DB snapshots for a particular DB cluster. /// </summary> /// <param name="dbClusterIdentifier">DB cluster identifier.</param> /// <returns>List of DB snapshots.</returns> public async Task<List<DBClusterSnapshot>> DescribeDBClusterSnapshotsByIdentifierAsync(string dbClusterIdentifier) { var results = new List<DBClusterSnapshot>(); DescribeDBClusterSnapshotsResponse response; DescribeDBClusterSnapshotsRequest request = new DescribeDBClusterSnapshotsRequest { DBClusterIdentifier = dbClusterIdentifier }; // Get the full list if there are multiple pages. do { response = await _amazonRDS.DescribeDBClusterSnapshotsAsync(request); results.AddRange(response.DBClusterSnapshots); request.Marker = response.Marker; } while (response.Marker is not null); return results; } /// <summary> /// Delete a particular DB cluster. /// </summary> /// <param name="dbClusterIdentifier">DB cluster identifier.</param> /// <returns>DB cluster object.</returns> public async Task<DBCluster> DeleteDBClusterByIdentifierAsync(string dbClusterIdentifier) { var response = await _amazonRDS.DeleteDBClusterAsync( new DeleteDBClusterRequest() { DBClusterIdentifier = dbClusterIdentifier, SkipFinalSnapshot = true }); return response.DBCluster; } /// <summary> /// Delete a particular DB instance. /// </summary> /// <param name="dbInstanceIdentifier">DB instance identifier.</param> /// <returns>DB instance object.</returns> public async Task<DBInstance> DeleteDBInstanceByIdentifierAsync(string dbInstanceIdentifier) { var response = await _amazonRDS.DeleteDBInstanceAsync( new DeleteDBInstanceRequest() { DBInstanceIdentifier = dbInstanceIdentifier, SkipFinalSnapshot = true, DeleteAutomatedBackups = true }); return response.DBInstance; } }
-
有关API详细信息,请参阅 “参AWS SDK for .NET API考” 中的以下主题。
-
操作
以下代码示例演示如何使用 CreateDBCluster
。
- AWS SDK for .NET
-
注意
还有更多相关信息 GitHub。查找完整示例,学习如何在 AWS 代码示例存储库
中进行设置和运行。 /// <summary> /// Create a new cluster and database. /// </summary> /// <param name="dbName">The name of the new database.</param> /// <param name="clusterIdentifier">The identifier of the cluster.</param> /// <param name="parameterGroupName">The name of the parameter group.</param> /// <param name="dbEngine">The engine to use for the new cluster.</param> /// <param name="dbEngineVersion">The version of the engine to use.</param> /// <param name="adminName">The admin username.</param> /// <param name="adminPassword">The primary admin password.</param> /// <returns>The cluster object.</returns> public async Task<DBCluster> CreateDBClusterWithAdminAsync( string dbName, string clusterIdentifier, string parameterGroupName, string dbEngine, string dbEngineVersion, string adminName, string adminPassword) { var request = new CreateDBClusterRequest { DatabaseName = dbName, DBClusterIdentifier = clusterIdentifier, DBClusterParameterGroupName = parameterGroupName, Engine = dbEngine, EngineVersion = dbEngineVersion, MasterUsername = adminName, MasterUserPassword = adminPassword, }; var response = await _amazonRDS.CreateDBClusterAsync(request); return response.DBCluster; }
-
有关API详细信息,请参阅reateDBCluster《AWS SDK for .NET API参考资料》中的 C。
-
以下代码示例演示如何使用 CreateDBClusterParameterGroup
。
- AWS SDK for .NET
-
注意
还有更多相关信息 GitHub。查找完整示例,学习如何在 AWS 代码示例存储库
中进行设置和运行。 /// <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; }
-
有关API详细信息,请参阅reateDBClusterParameterGroup《AWS SDK for .NET API参考资料》中的 C。
-
以下代码示例演示如何使用 CreateDBClusterSnapshot
。
- AWS SDK for .NET
-
注意
还有更多相关信息 GitHub。查找完整示例,学习如何在 AWS 代码示例存储库
中进行设置和运行。 /// <summary> /// Create a snapshot of a cluster. /// </summary> /// <param name="dbClusterIdentifier">DB cluster identifier.</param> /// <param name="snapshotIdentifier">Identifier for the snapshot.</param> /// <returns>DB snapshot object.</returns> public async Task<DBClusterSnapshot> CreateClusterSnapshotByIdentifierAsync(string dbClusterIdentifier, string snapshotIdentifier) { var response = await _amazonRDS.CreateDBClusterSnapshotAsync( new CreateDBClusterSnapshotRequest() { DBClusterIdentifier = dbClusterIdentifier, DBClusterSnapshotIdentifier = snapshotIdentifier, }); return response.DBClusterSnapshot; }
-
有关API详细信息,请参阅《AWS SDK for .NET API参考资料》中的 C reateDBCluster 快照。
-
以下代码示例演示如何使用 CreateDBInstance
。
- AWS SDK for .NET
-
注意
还有更多相关信息 GitHub。查找完整示例,学习如何在 AWS 代码示例存储库
中进行设置和运行。 /// <summary> /// Create an Amazon Relational Database Service (Amazon RDS) DB instance /// with a particular set of properties. Use the action DescribeDBInstancesAsync /// to determine when the DB instance is ready to use. /// </summary> /// <param name="dbInstanceIdentifier">DB instance identifier.</param> /// <param name="dbClusterIdentifier">DB cluster identifier.</param> /// <param name="dbEngine">The engine for the DB instance.</param> /// <param name="dbEngineVersion">Version for the DB instance.</param> /// <param name="instanceClass">Class for the DB instance.</param> /// <returns>DB instance object.</returns> public async Task<DBInstance> CreateDBInstanceInClusterAsync( string dbClusterIdentifier, string dbInstanceIdentifier, string dbEngine, string dbEngineVersion, string instanceClass) { // When creating the instance within a cluster, do not specify the name or size. var response = await _amazonRDS.CreateDBInstanceAsync( new CreateDBInstanceRequest() { DBClusterIdentifier = dbClusterIdentifier, DBInstanceIdentifier = dbInstanceIdentifier, Engine = dbEngine, EngineVersion = dbEngineVersion, DBInstanceClass = instanceClass }); return response.DBInstance; }
-
有关API详细信息,请参阅reateDBInstance《AWS SDK for .NET API参考资料》中的 C。
-
以下代码示例演示如何使用 DeleteDBCluster
。
- AWS SDK for .NET
-
注意
还有更多相关信息 GitHub。查找完整示例,学习如何在 AWS 代码示例存储库
中进行设置和运行。 /// <summary> /// Delete a particular DB cluster. /// </summary> /// <param name="dbClusterIdentifier">DB cluster identifier.</param> /// <returns>DB cluster object.</returns> public async Task<DBCluster> DeleteDBClusterByIdentifierAsync(string dbClusterIdentifier) { var response = await _amazonRDS.DeleteDBClusterAsync( new DeleteDBClusterRequest() { DBClusterIdentifier = dbClusterIdentifier, SkipFinalSnapshot = true }); return response.DBCluster; }
-
有关API详细信息,请参阅eleteDBCluster《AWS SDK for .NET API参考资料》中的 D。
-
以下代码示例演示如何使用 DeleteDBClusterParameterGroup
。
- AWS SDK for .NET
-
注意
还有更多相关信息 GitHub。查找完整示例,学习如何在 AWS 代码示例存储库
中进行设置和运行。 /// <summary> /// Delete a particular parameter group by name. /// </summary> /// <param name="groupName">The name of the parameter group.</param> /// <returns>True if successful.</returns> public async Task<bool> DeleteClusterParameterGroupByNameAsync(string groupName) { var request = new DeleteDBClusterParameterGroupRequest { DBClusterParameterGroupName = groupName, }; var response = await _amazonRDS.DeleteDBClusterParameterGroupAsync(request); return response.HttpStatusCode == System.Net.HttpStatusCode.OK; }
-
有关API详细信息,请参阅eleteDBClusterParameterGroup《AWS SDK for .NET API参考资料》中的 D。
-
以下代码示例演示如何使用 DeleteDBInstance
。
- AWS SDK for .NET
-
注意
还有更多相关信息 GitHub。查找完整示例,学习如何在 AWS 代码示例存储库
中进行设置和运行。 /// <summary> /// Delete a particular DB instance. /// </summary> /// <param name="dbInstanceIdentifier">DB instance identifier.</param> /// <returns>DB instance object.</returns> public async Task<DBInstance> DeleteDBInstanceByIdentifierAsync(string dbInstanceIdentifier) { var response = await _amazonRDS.DeleteDBInstanceAsync( new DeleteDBInstanceRequest() { DBInstanceIdentifier = dbInstanceIdentifier, SkipFinalSnapshot = true, DeleteAutomatedBackups = true }); return response.DBInstance; }
-
有关API详细信息,请参阅eleteDBInstance《AWS SDK for .NET API参考资料》中的 D。
-
以下代码示例演示如何使用 DescribeDBClusterParameterGroups
。
- AWS SDK for .NET
-
注意
还有更多相关信息 GitHub。查找完整示例,学习如何在 AWS 代码示例存储库
中进行设置和运行。 /// <summary> /// Get the description of a DB cluster parameter group by name. /// </summary> /// <param name="name">The name of the DB parameter group to describe.</param> /// <returns>The parameter group description.</returns> public async Task<DBClusterParameterGroup?> DescribeCustomDBClusterParameterGroupAsync(string name) { var response = await _amazonRDS.DescribeDBClusterParameterGroupsAsync( new DescribeDBClusterParameterGroupsRequest() { DBClusterParameterGroupName = name }); return response.DBClusterParameterGroups.FirstOrDefault(); }
-
有关API详细信息,请参阅escribeDBClusterParameterGroups《AWS SDK for .NET API参考资料》中的 D。
-
以下代码示例演示如何使用 DescribeDBClusterParameters
。
- AWS SDK for .NET
-
注意
还有更多相关信息 GitHub。查找完整示例,学习如何在 AWS 代码示例存储库
中进行设置和运行。 /// <summary> /// Describe the cluster parameters in a parameter group. /// </summary> /// <param name="groupName">The name of the parameter group.</param> /// <param name="source">The optional name of the source filter.</param> /// <returns>The collection of parameters.</returns> public async Task<List<Parameter>> DescribeDBClusterParametersInGroupAsync(string groupName, string? source = null) { var paramList = new List<Parameter>(); DescribeDBClusterParametersResponse response; var request = new DescribeDBClusterParametersRequest { DBClusterParameterGroupName = groupName, Source = source, }; // Get the full list if there are multiple pages. do { response = await _amazonRDS.DescribeDBClusterParametersAsync(request); paramList.AddRange(response.Parameters); request.Marker = response.Marker; } while (response.Marker is not null); return paramList; }
-
有关API详细信息,请参阅《AWS SDK for .NET API参考资料》中的 D escribeDBCluster 参数。
-
以下代码示例演示如何使用 DescribeDBClusterSnapshots
。
- AWS SDK for .NET
-
注意
还有更多相关信息 GitHub。查找完整示例,学习如何在 AWS 代码示例存储库
中进行设置和运行。 /// <summary> /// Return a list of DB snapshots for a particular DB cluster. /// </summary> /// <param name="dbClusterIdentifier">DB cluster identifier.</param> /// <returns>List of DB snapshots.</returns> public async Task<List<DBClusterSnapshot>> DescribeDBClusterSnapshotsByIdentifierAsync(string dbClusterIdentifier) { var results = new List<DBClusterSnapshot>(); DescribeDBClusterSnapshotsResponse response; DescribeDBClusterSnapshotsRequest request = new DescribeDBClusterSnapshotsRequest { DBClusterIdentifier = dbClusterIdentifier }; // Get the full list if there are multiple pages. do { response = await _amazonRDS.DescribeDBClusterSnapshotsAsync(request); results.AddRange(response.DBClusterSnapshots); request.Marker = response.Marker; } while (response.Marker is not null); return results; }
-
有关API详细信息,请参阅《AWS SDK for .NET API参考资料》中的 D escribeDBCluster 快照。
-
以下代码示例演示如何使用 DescribeDBClusters
。
- AWS SDK for .NET
-
注意
还有更多相关信息 GitHub。查找完整示例,学习如何在 AWS 代码示例存储库
中进行设置和运行。 /// <summary> /// Returns a list of DB clusters. /// </summary> /// <param name="dbInstanceIdentifier">Optional name of a specific DB cluster.</param> /// <returns>List of DB clusters.</returns> public async Task<List<DBCluster>> DescribeDBClustersPagedAsync(string? dbClusterIdentifier = null) { var results = new List<DBCluster>(); DescribeDBClustersResponse response; DescribeDBClustersRequest request = new DescribeDBClustersRequest { DBClusterIdentifier = dbClusterIdentifier }; // Get the full list if there are multiple pages. do { response = await _amazonRDS.DescribeDBClustersAsync(request); results.AddRange(response.DBClusters); request.Marker = response.Marker; } while (response.Marker is not null); return results; }
-
有关API详细信息,请参阅escribeDBClusters《AWS SDK for .NET API参考资料》中的 D。
-
以下代码示例演示如何使用 DescribeDBEngineVersions
。
- AWS SDK for .NET
-
注意
还有更多相关信息 GitHub。查找完整示例,学习如何在 AWS 代码示例存储库
中进行设置和运行。 /// <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; }
-
有关API详细信息,请参阅AWS SDK for .NET API参考中的 D escribeDBEngine 版本。
-
以下代码示例演示如何使用 DescribeDBInstances
。
- AWS SDK for .NET
-
注意
还有更多相关信息 GitHub。查找完整示例,学习如何在 AWS 代码示例存储库
中进行设置和运行。 /// <summary> /// Returns a list of DB instances. /// </summary> /// <param name="dbInstanceIdentifier">Optional name of a specific DB instance.</param> /// <returns>List of DB instances.</returns> public async Task<List<DBInstance>> DescribeDBInstancesPagedAsync(string? dbInstanceIdentifier = null) { var results = new List<DBInstance>(); var instancesPaginator = _amazonRDS.Paginators.DescribeDBInstances( new DescribeDBInstancesRequest { DBInstanceIdentifier = dbInstanceIdentifier }); // Get the entire list using the paginator. await foreach (var instances in instancesPaginator.DBInstances) { results.Add(instances); } return results; }
-
有关API详细信息,请参阅escribeDBInstances《AWS SDK for .NET API参考资料》中的 D。
-
以下代码示例演示如何使用 DescribeOrderableDBInstanceOptions
。
- AWS SDK for .NET
-
注意
还有更多相关信息 GitHub。查找完整示例,学习如何在 AWS 代码示例存储库
中进行设置和运行。 /// <summary> /// Get a list of orderable DB instance options for a specific /// engine and engine version. /// </summary> /// <param name="engine">Name of the engine.</param> /// <param name="engineVersion">Version of the engine.</param> /// <returns>List of OrderableDBInstanceOptions.</returns> public async Task<List<OrderableDBInstanceOption>> DescribeOrderableDBInstanceOptionsPagedAsync(string engine, string engineVersion) { // Use a paginator to get a list of DB instance options. var results = new List<OrderableDBInstanceOption>(); var paginateInstanceOptions = _amazonRDS.Paginators.DescribeOrderableDBInstanceOptions( new DescribeOrderableDBInstanceOptionsRequest() { Engine = engine, EngineVersion = engineVersion, }); // Get the entire list using the paginator. await foreach (var instanceOptions in paginateInstanceOptions.OrderableDBInstanceOptions) { results.Add(instanceOptions); } return results; }
-
有关API详细信息,请参阅 “AWS SDK for .NET API参考 DescribeOrderableDBInstanceOptions” 中的。
-
以下代码示例演示如何使用 ModifyDBClusterParameterGroup
。
- AWS SDK for .NET
-
注意
还有更多相关信息 GitHub。查找完整示例,学习如何在 AWS 代码示例存储库
中进行设置和运行。 /// <summary> /// Modify the specified integer parameters with new values from user input. /// </summary> /// <param name="groupName">The group name for the parameters.</param> /// <param name="parameters">The list of integer parameters to modify.</param> /// <param name="newValue">Optional int value to set for parameters.</param> /// <returns>The name of the group that was modified.</returns> public async Task<string> ModifyIntegerParametersInGroupAsync(string groupName, List<Parameter> parameters, int newValue = 0) { foreach (var p in parameters) { if (p.IsModifiable && p.DataType == "integer") { while (newValue == 0) { Console.WriteLine( $"Enter a new value for {p.ParameterName} from the allowed values {p.AllowedValues} "); var choice = Console.ReadLine(); int.TryParse(choice, out newValue); } p.ParameterValue = newValue.ToString(); } } var request = new ModifyDBClusterParameterGroupRequest { Parameters = parameters, DBClusterParameterGroupName = groupName, }; var result = await _amazonRDS.ModifyDBClusterParameterGroupAsync(request); return result.DBClusterParameterGroupName; }
-
有关API详细信息,请参阅odifyDBClusterParameterGroup《AWS SDK for .NET API参考资料》中的 M。
-
场景
以下代码示例演示如何创建一个 Web 应用程序,该应用程序可跟踪 Amazon Aurora Serverless 数据库中的工作项目,并使用亚马逊简单电子邮件服务 (AmazonSES) 发送报告。
- AWS SDK for .NET
-
演示如何使用创建一个 Web 应用程序,该 AWS SDK for .NET 应用程序可跟踪 Amazon Aurora 数据库中的工作项目,并使用亚马逊简单电子邮件服务 (AmazonSES) 通过电子邮件发送报告。此示例使用使用 React.js 构建的前端与进行交互RESTful。 NET后端。
将 React Web 应用程序与 AWS 服务集成。
列出、添加、更新和删除 Aurora 表中的项目。
使用 Amazon 发送已筛选工作项的电子邮件报告SES。
使用随附的 AWS CloudFormation 脚本部署和管理示例资源。
有关如何设置和运行的完整源代码和说明,请参阅上的完整示例GitHub
。 本示例中使用的服务
Aurora
Amazon RDS
亚马逊RDS数据服务
Amazon SES