aws-doc-sdk-examples icon indicating copy to clipboard operation
aws-doc-sdk-examples copied to clipboard

[Epic]: Aurora MVP

Open Laren-AWS opened this issue 2 years ago • 0 comments

The RDS guides are divided into two feature groups: RDS, which is focused on instances, and Aurora, which is focused on clusters. The APIs for both of these features are mixed together in the same RDS service client.

This epic is about the Aurora cluster APIs. The Aurora guide is here.

Service actions

Service actions can either be pulled out as individual functions or can be incorporated into the scenario, but each service action must be included as an excerpt in the SOS output.

RDS client:

DescribeDbClusterParameterGroups CreateDbClusterParameterGroup ModifyDbClusterParameterGroup DeleteDbClusterParameterGroup DescribeDbEngineVersions DescribeDbClusterParameters DescribeDbClusters CreateDbCluster DeleteDbCluster DescribeOrderableDbInstanceOptions DescribeDbInstances CreateDbInstance DeleteDbInstance CreateDbClusterSnapshot DescribeDbClusterSnapshots

Scenario

A scenario runs at a command prompt and prints output to the user on the result of each service action. A scenario can run in one of two ways: straight through, printing out progress as it goes, or as an interactive question/answer script.

Getting started with Aurora Clusters

  1. Get available engine families for Aurora MySql. rds.DescribeDbEngineVersions(Engine='aurora-mysql') and build a set of the 'DBParameterGroupFamily' field values. I get {aurora-mysql8.0, aurora-mysql5.7}.
  2. Select an engine family and create a custom DB cluster parameter group. rds.CreateDbClusterParameterGroup(DBParameterGroupFamily='aurora-mysql8.0')
  3. Get the parameter group. rds.DescribeDbClusterParameterGroups
  4. Get parameters in the group. This is a long list so you will have to paginate. Find the auto_increment_offset and auto_increment_increment parameters (by ParameterName). rds.DescribeDbClusterParameters
  5. Parse the ParameterName, Description, and AllowedValues values and display them.
  6. Modify both the auto_increment_offset and auto_increment_increment parameters in one call in the custom parameter group. Set their ParameterValue fields to a new allowable value. rds.ModifyDbClusterParameterGroup.
  7. Get and display the updated parameters. Specify Source of 'user' to get just the modified parameters. rds.DescribeDbClusterParameters(Source='user')
  8. Get a list of allowed engine versions. rds.DescribeDbEngineVersions(Engine='aurora-mysql', DBParameterGroupFamily=<the family used to create your parameter group in step 2>)
  9. Create an Aurora DB cluster database cluster that contains a MySql database and uses the parameter group you created.
self.rds_client.create_db_cluster(
                DatabaseName=db_name,
                DBClusterIdentifier=cluster_name,
                DBClusterParameterGroupName=parameter_group_name,
                Engine=db_engine,
                EngineVersion=db_engine_version,
                MasterUsername=admin_name,
                MasterUserPassword=admin_password)
  1. Wait for DB cluster to be ready. Call rds.DescribeDBClusters and check for Status == 'available'.
  2. Get a list of instance classes available for the selected engine and engine version. rds.DescribeOrderableDbInstanceOptions(Engine='mysql', EngineVersion=).
  3. Create a database instance in the cluster.
self.rds_client.create_db_instance(
                DBInstanceIdentifier=instance_id, 
                DBClusterIdentifier=cluster_id,
                Engine=db_engine, 
                DBInstanceClass=instance_class)
  1. Wait for DB instance to be ready. Call rds.DescribeDbInstances and check for DBInstanceStatus == 'available'.
  2. Display the connection string that can be used to connect a 'mysql' shell to the cluster. In Python:
    print(f"\n\tmysql -h {cluster['Endpoint']} -P {cluster['Port']} -u {cluster['MasterUsername']} -p\n")
  1. Create a snapshot of the DB cluster. rds.CreateDbClusterSnapshot.
  2. Wait for the snapshot to create. rds.DescribeDbClusterSnapshots until Status == 'available'.
  3. Delete the instance. rds.DeleteDbInstance.
  4. Delete the DB cluster. rds.DeleteDbCluster.
  5. Wait for the instance and cluster to fully delete. rds.DescribeDbInstances and rds.DescribeDbClusters until both are not found.
  6. Delete the DB cluster parameter group. rds.DeleteDbClusterParameterGroup.

Metadata

In rds_metadata:

rds_DescribeDbClusterParameterGroups rds_CreateDbClusterParameterGroup rds_ModifyDbClusterParameterGroup rds_DeleteDbClusterParameterGroup rds_DescribeDbEngineVersions rds_DescribeDbClusterParameters rds_DescribeDbClusters rds_CreateDbCluster rds_DeleteDbCluster rds_DescribeOrderableDbInstanceOptions rds_DescribeDbInstances rds_CreateDbInstance rds_DeleteDbInstance rds_CreateDbClusterSnapshot rds_DescribeDbClusterSnapshots rds_Scenario_GetStartedAuroraClusters

SDKs

  • [ ] .NET Aurora MVP
  • [ ] C++ Aurora MVP
  • [ ] Go Aurora MVP
  • [ ] Java Aurora MVP
  • [ ] JavaScript Aurora MVP
  • [ ] Kotlin Aurora MVP
  • [ ] #3612
  • [ ] PHP Aurora MVP
  • [ ] Ruby Aurora MVP
  • [ ] Rust Aurora MVP
  • [ ] Swift Aurora MVP

Exit criteria:

Runnable scenario code. Service action code (may be same as scenario code). Integration or unit tests. Scenario and API examples tagged for SOS. README

Laren-AWS avatar Sep 08 '22 17:09 Laren-AWS