-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(rds): Aurora Serverless V2 instances are re-created when switching from a common workaround to an official solution #25942
Comments
Have you tried setting |
instance_identifier worked for me; the switch from a workaround to the official solution indeed re-created the instances but no troubles during that, works fine |
If I set that prop, I simply get an additional prop, but it does not affect the ID: writer: ClusterInstance.serverlessV2('Instance', {
instanceIdentifier: 'Instance', // ⬅️ Added
publiclyAccessible: databaseEngine?.public,
parameterGroup: this.parameterGroup,
}), - "ClusterInstance1448F06E4": Object {
+ "ClusterInstanceAAE2C8BD": Object {
"DeletionPolicy": "Delete",
"Properties": Object {
"DBClusterIdentifier": Object {
"Ref": "ClusterEB0386A7",
},
"DBInstanceClass": "db.serverless",
+ "DBInstanceIdentifier": "Instance",
"DBParameterGroupName": Object { |
So you were able to re-create the instance, in a B/G deployment-way, without any downtime or data loss? Which engine did you use? |
here how I define the writer and the reader instances writer_instance = rds.ClusterInstance.serverless_v2(
f"{config.ID}-writer-instance",
instance_identifier=f"{config.ID}-writer-instance",
)
reader_instance = rds.ClusterInstance.serverless_v2(
f"{config.ID}-reader-instance",
instance_identifier=f"{config.ID}-reader-instance",
scale_with_writer=True,
) and here I define the cluster, it is an Aurora Postgre Engine, but B/G deployment is not supported by this kind of engine, so I simply deployed the new/official solution on top of the workaround, w/o data loss. db_cluster = rds.DatabaseCluster(
...
engine=rds.DatabaseClusterEngine.aurora_postgres(
version=rds.AuroraPostgresEngineVersion.VER_13_9
),
...
security_groups=[sg_db_cluster_import],
serverless_v2_max_capacity=1,
serverless_v2_min_capacity=0.5,
readers=[reader_instance],
storage_type=rds.DBClusterStorageType.AURORA,
subnet_group=subnet_group,
...
writer=writer_instance,
) |
after testing on dev stage, have just migrated our prod stage from workaround to official solution. no problems so far |
I just tried following this with the .NET version of the CDK and it wanted to create a new reader/writer and complained that the InstanceId already exists. I tried to follow the documentation for migrating from instance props but the property it suggests setting of |
I was able to successfully migrate from the custom resource workaround to the new Serverless V2 constructs without downtime using a combination of There was a bit of a stumbling block using CDK with Typescript, which is that Here's what I ended up doing: const instanceProps: rds.ServerlessV2ClusterInstanceProps & {
isFromLegacyInstanceProps: boolean;
} = {
publiclyAccessible: false,
// ...
isFromLegacyInstanceProps: true,
};
const dbCluster = new rds.DatabaseCluster(this, "cluster", {
vpc,
vpcSubnets,
securityGroups,
// ...
writer: rds.ClusterInstance.serverlessV2("Instance1", {
...instanceProps,
instanceIdentifier: "<current instance 1 identifier>",
}),
readers: [
rds.ClusterInstance.serverlessV2("Instance2", {
...instanceProps,
instanceIdentifier: "<current instance 2 identifier>",
scaleWithWriter: true,
}),
],
serverlessV2MinCapacity: 1,
serverlessV2MaxCapacity: 12,
// ...
} |
…stance.serverlessV2` (#26472) **Context** A recent feature release #25437 has added support for Aurora Serverless V2 cluster instances. This change also introduced a new approach for defining cluster instances, deprecating `instanceProps` in the process. The new approach uses `ClusterInstance.provisioned()` and `ClusterInstance.serverlessV2()` to define instances and their parameters on a per-instance basis. A migration flag `isFromLegacyInstanceProps` has also been added to the `ClusterInstance.provisioned()` constructor props to allow for migration to this new approach without destructive changes to the generated CFN template. **Bug** Because the `DatabaseCluster` construct has not previously had official support for Serverless V2 instances, the same migration flag has not been made available for `ClusterInstance.serverlessV2()`. This ignores the fact that many people have already provisioned serverless v2 instances using a common workaround described here #20197 (comment). People who have used this method previously have no clean migration path. This has been previously raised in #25942. **Fix** This fix simply exposes the `isFromLegacyInstanceProps` flag on **both** `ProvisionedClusterInstanceProps` and `ServerlessV2ClusterInstanceProps`. The behaviour for this flag is already implemented and applied across both instance types, so this is a type-only change. I have however added a test to capture this upgrade path for Serverless V2 instances from the common workaround. Closes #25942. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
|
…stance.serverlessV2` (aws#26472) **Context** A recent feature release aws#25437 has added support for Aurora Serverless V2 cluster instances. This change also introduced a new approach for defining cluster instances, deprecating `instanceProps` in the process. The new approach uses `ClusterInstance.provisioned()` and `ClusterInstance.serverlessV2()` to define instances and their parameters on a per-instance basis. A migration flag `isFromLegacyInstanceProps` has also been added to the `ClusterInstance.provisioned()` constructor props to allow for migration to this new approach without destructive changes to the generated CFN template. **Bug** Because the `DatabaseCluster` construct has not previously had official support for Serverless V2 instances, the same migration flag has not been made available for `ClusterInstance.serverlessV2()`. This ignores the fact that many people have already provisioned serverless v2 instances using a common workaround described here aws#20197 (comment). People who have used this method previously have no clean migration path. This has been previously raised in aws#25942. **Fix** This fix simply exposes the `isFromLegacyInstanceProps` flag on **both** `ProvisionedClusterInstanceProps` and `ServerlessV2ClusterInstanceProps`. The behaviour for this flag is already implemented and applied across both instance types, so this is a type-only change. I have however added a test to capture this upgrade path for Serverless V2 instances from the common workaround. Closes aws#25942. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Describe the bug
A feature release via #25437 (Serverless V2 support) breaks a common workaround for V2.
Workaround explained here: #20197 (comment)
Note that it has 21 likes, so likely there are many instances of this workaround in the wild.
However, when switching to the official solution from #25437, the instances change the ID and need to be recreated.
A question I raised in the PR is whether or not it is possible to retain the original IDs somehow. I don't see the need for them to change.
Example: #25437 (comment)
Expected Behavior
The instances not to be re-created.
Current Behavior
ID changes and the instance gets re-created.
Reproduction Steps
#25437 (comment)
Possible Solution
N/A
Additional Information/Context
#25437 (comment)
CDK CLI Version
latest
Framework Version
2
Node.js Version
16
OS
macOS
Language
Typescript
Language Version
TS 5
Other information
No response
The text was updated successfully, but these errors were encountered: