使用 的 Aurora 範例 AWS SDK for .NET - AWS SDK 程式碼範例

文件範例儲存庫中有更多 AWS SDK可用的範例。 AWS SDK GitHub

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

使用 的 Aurora 範例 AWS SDK for .NET

下列程式碼範例示範如何搭配 AWS SDK for .NET Aurora 使用 來執行動作和實作常見案例。

基本作業要點是程式碼範例,示範如何在 服務中執行基本操作。

Actions 是大型程式的程式碼摘錄,必須在內容中執行。雖然動作會示範如何呼叫個別服務函數,但您可以在其相關案例中查看內容中的動作。

案例是程式碼範例,示範如何透過呼叫服務內的多個函數或與其他 結合來完成特定任務 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 資料庫叢集參數群組並設定參數值。

  • 建立使用該參數群組的資料庫叢集。

  • 建立包含該資料庫的資料庫執行個體。

  • 拍攝該資料庫叢集的快照,並清理資源。

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

下列程式碼範例示範如何使用 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; }

案例

下列程式碼範例示範如何建立 Web 應用程式,追蹤 Amazon Aurora Serverless 資料庫中的工作項目,並使用 Amazon Simple Email Service (Amazon SES) 傳送報告。

AWS SDK for .NET

示範如何使用 AWS SDK for .NET 建立 Web 應用程式,以使用 Amazon Simple Email Service (Amazon ) 追蹤 Amazon Aurora 資料庫和電子郵件報告中的工作項目SES。此範例使用使用 React.js 建置的前端與 RESTful .NET 後端互動。

  • 將 React Web 應用程式與 AWS 服務整合。

  • 列出、新增、更新和刪除 Aurora 資料表中的項目。

  • 使用 Amazon 傳送已篩選工作項目的電子郵件報告SES。

  • 使用隨附的 AWS CloudFormation 指令碼部署和管理範例資源。

如需設定和執行的完整原始程式碼和指示,請參閱 上的完整範例GitHub

此範例中使用的服務
  • Aurora

  • Amazon RDS

  • Amazon RDS Data Service

  • Amazon SES