Repository: getmoto/moto

Issue:
Aurora Postgres Does Not Support Mock ServerlessV2
From what I can tell, Aurora Postgres does not support ServerlessV2ScalingConfiguration like Neptune does. Support for this would be great!


Discussion:
Marking it as an enhancement. Welcome to Moto @chrisvbrown!

Resolving patch:
diff --git a/moto/rds/models.py b/moto/rds/models.py
--- a/moto/rds/models.py
+++ b/moto/rds/models.py
@@ -208,6 +208,9 @@ def __init__(self, **kwargs: Any):
                 "timeout_action": "RollbackCapacityChange",
                 "seconds_before_timeout": 300,
             }
+        self.serverless_v2_scaling_configuration = kwargs.get(
+            "serverless_v2_scaling_configuration"
+        )
         self.cluster_members: List[str] = list()
         self.replication_source_identifier = kwargs.get("replication_source_identifier")
         self.read_replica_identifiers: List[str] = list()
@@ -378,6 +381,12 @@ def to_xml(self) -> str:
                 {% if "seconds_before_timeout" in cluster.scaling_configuration %}<SecondsBeforeTimeout>{{ cluster.scaling_configuration["seconds_before_timeout"] }}</SecondsBeforeTimeout>{% endif %}
               </ScalingConfigurationInfo>
               {% endif %}
+              {% if cluster.serverless_v2_scaling_configuration %}
+              <ServerlessV2ScalingConfiguration>
+                {% if "MinCapacity" in cluster.serverless_v2_scaling_configuration %}<MinCapacity>{{ cluster.serverless_v2_scaling_configuration["MinCapacity"] }}</MinCapacity>{% endif %}
+                {% if "MaxCapacity" in cluster.serverless_v2_scaling_configuration %}<MaxCapacity>{{ cluster.serverless_v2_scaling_configuration["MaxCapacity"] }}</MaxCapacity>{% endif %}
+              </ServerlessV2ScalingConfiguration>
+              {% endif %}
               {%- if cluster.global_cluster_identifier -%}
               <GlobalClusterIdentifier>{{ cluster.global_cluster_identifier }}</GlobalClusterIdentifier>
               {%- endif -%}
diff --git a/moto/rds/responses.py b/moto/rds/responses.py
--- a/moto/rds/responses.py
+++ b/moto/rds/responses.py
@@ -178,13 +178,12 @@ def _get_db_parameter_group_kwargs(self) -> Dict[str, Any]:
         }
 
     def _get_db_cluster_kwargs(self) -> Dict[str, Any]:
+        params = self._get_params()
         return {
             "availability_zones": self._get_multi_param(
                 "AvailabilityZones.AvailabilityZone"
             ),
-            "enable_cloudwatch_logs_exports": self._get_params().get(
-                "EnableCloudwatchLogsExports"
-            ),
+            "enable_cloudwatch_logs_exports": params.get("EnableCloudwatchLogsExports"),
             "db_name": self._get_param("DatabaseName"),
             "db_cluster_identifier": self._get_param("DBClusterIdentifier"),
             "db_subnet_group_name": self._get_param("DBSubnetGroupName"),
@@ -208,6 +207,9 @@ def _get_db_cluster_kwargs(self) -> Dict[str, Any]:
             "copy_tags_to_snapshot": self._get_param("CopyTagsToSnapshot"),
             "tags": self.unpack_list_params("Tags", "Tag"),
             "scaling_configuration": self._get_dict_param("ScalingConfiguration."),
+            "serverless_v2_scaling_configuration": params.get(
+                "ServerlessV2ScalingConfiguration"
+            ),
             "replication_source_identifier": self._get_param(
                 "ReplicationSourceIdentifier"
             ),


Test patch:
diff --git a/tests/test_rds/test_rds_clusters.py b/tests/test_rds/test_rds_clusters.py
--- a/tests/test_rds/test_rds_clusters.py
+++ b/tests/test_rds/test_rds_clusters.py
@@ -219,6 +219,10 @@ def test_create_db_cluster_additional_parameters():
             "MinCapacity": 5,
             "AutoPause": True,
         },
+        ServerlessV2ScalingConfiguration={
+            "MinCapacity": 2,
+            "MaxCapacity": 4,
+        },
         VpcSecurityGroupIds=["sg1", "sg2"],
     )
 
@@ -236,6 +240,10 @@ def test_create_db_cluster_additional_parameters():
     assert cluster["NetworkType"] == "IPV4"
     assert cluster["DBSubnetGroup"] == "subnetgroupname"
     assert cluster["ScalingConfigurationInfo"] == {"MinCapacity": 5, "AutoPause": True}
+    assert cluster["ServerlessV2ScalingConfiguration"] == {
+        "MaxCapacity": 4.0,
+        "MinCapacity": 2.0,
+    }
 
     security_groups = cluster["VpcSecurityGroups"]
     assert len(security_groups) == 2