를 사용한 Aurora 예제 AWS SDK for .NET - AWS SDK for .NET

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

를 사용한 Aurora 예제 AWS SDK for .NET

다음 코드 예제에서는 Aurora와 AWS SDK for .NET 함께 를 사용하여 작업을 수행하고 일반적인 시나리오를 구현하는 방법을 보여줍니다.

기본 사항은 서비스 내에서 필수 작업을 수행하는 방법을 보여주는 코드 예제입니다.

작업은 대규모 프로그램에서 발췌한 코드이며 컨텍스트에 맞춰 실행해야 합니다. 작업은 개별 서비스 함수를 직접적으로 호출하는 방법을 보여주며 관련 시나리오의 컨텍스트에 맞는 작업을 볼 수 있습니다.

시나리오는 동일한 서비스 내에서 또는 다른 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 자세한 내용은 AWS SDK for .NET API 참조DescribeDBClusters를 참조하세요.

기본 사항

다음 코드 예시는 다음과 같은 작업을 수행하는 방법을 보여줍니다.

  • 사용자 지정 Aurora DB 클러스터 파라미터 그룹을 만들고 파라미터 값을 설정합니다.

  • 파라미터 그룹을 사용하는 DB 클러스터를 생성합니다.

  • 데이터베이스가 포함된 DB 인스턴스를 생성합니다.

  • DB 클러스터의 스냅샷을 만든 다음, 리소스를 정리합니다.

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; } }

작업

다음 코드 예시에서는 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 자세한 내용은 AWS SDK for .NET API 참조CreateDBCluster를 참조하세요.

다음 코드 예시에서는 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; }

다음 코드 예시에서는 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; }

다음 코드 예시에서는 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 자세한 내용은 AWS SDK for .NET API 참조CreateDBInstance를 참조하세요.

다음 코드 예시에서는 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 자세한 내용은 AWS SDK for .NET API 참조DeleteDBCluster를 참조하세요.

다음 코드 예시에서는 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; }

다음 코드 예시에서는 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 자세한 내용은 AWS SDK for .NET API 참조DeleteDBInstance를 참조하세요.

다음 코드 예시에서는 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(); }

다음 코드 예시에서는 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; }

다음 코드 예시에서는 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; }

다음 코드 예시에서는 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 자세한 내용은 AWS SDK for .NET API 참조DescribeDBClusters를 참조하세요.

다음 코드 예시에서는 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; }

다음 코드 예시에서는 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 자세한 내용은 AWS SDK for .NET API 참조DescribeDBInstances를 참조하세요.

다음 코드 예시에서는 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; }

다음 코드 예시에서는 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; }

시나리오

다음 코드 예제는 Amazon Aurora Serverless 데이터베이스의 작업 항목을 추적하고 Amazon Simple Email Service(AmazonSES)를 사용하여 보고서를 전송하는 웹 애플리케이션을 생성하는 방법을 보여줍니다.

AWS SDK for .NET

AWS SDK for .NET 를 사용하여 Amazon Aurora 데이터베이스의 작업 항목을 추적하고 Amazon Simple Email Service(Amazon)를 사용하여 보고서를 이메일로 보내는 웹 애플리케이션을 생성하는 방법을 보여줍니다SES. 이 예제에서는 React.js로 구축된 프런트 엔드를 사용하여 RESTful .NET 백엔드와 상호 작용합니다.

  • React 웹 애플리케이션을 AWS 서비스와 통합합니다.

  • Aurora 테이블의 항목을 나열, 추가, 업데이트 및 삭제합니다.

  • Amazon 를 사용하여 필터링된 작업 항목에 대한 이메일 보고서를 보냅니다SES.

  • 포함된 AWS CloudFormation 스크립트를 사용하여 예제 리소스를 배포하고 관리합니다.

전체 소스 코드와 설정 및 실행 방법에 대한 지침은 의 전체 예제를 참조하세요GitHub.

이 예시에서 사용되는 서비스
  • Aurora

  • Amazon RDS

  • Amazon RDS Data Service

  • Amazon SES