Skip to content
This repository was archived by the owner on Oct 23, 2025. It is now read-only.

Commit c983ff2

Browse files
authored
Add EngineLifecycleSupport integration for instances and clusters (#538)
* Update RDS SDK version to 2.25.56 Version 2.25.56 adds SDK support for EngineLifecycleSupport. CFN requires this new field as a dependency. * Add EngineLifecycleSupport integration for instances and clusters DB instances and clusters can be created and restored with the EngineLifecycleSupport field via CloudFormation. All subsequent updates to this field on the resource will be blocked to prevent unintended customer resource replacement. EngineLifecycleSupport is marked as "Some Interruption" causing to preserve future compatibility for when a formal modify option is available for this field.
1 parent b3b6fdf commit c983ff2

File tree

24 files changed

+124
-18
lines changed

24 files changed

+124
-18
lines changed

aws-rds-cfn-common/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
<dependency>
3434
<groupId>software.amazon.awssdk</groupId>
3535
<artifactId>rds</artifactId>
36-
<version>2.25.12</version>
36+
<version>2.25.56</version>
3737
</dependency>
3838
<dependency>
3939
<groupId>software.amazon.cloudformation</groupId>

aws-rds-customdbengineversion/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<dependency>
2424
<groupId>software.amazon.awssdk</groupId>
2525
<artifactId>rds</artifactId>
26-
<version>2.25.12</version>
26+
<version>2.25.56</version>
2727
</dependency>
2828
<dependency>
2929
<groupId>software.amazon.rds.common</groupId>

aws-rds-dbcluster/aws-rds-dbcluster.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,10 @@
132132
"description": "The name of the database engine to be used for this DB cluster. Valid Values: aurora (for MySQL 5.6-compatible Aurora), aurora-mysql (for MySQL 5.7-compatible Aurora), and aurora-postgresql",
133133
"type": "string"
134134
},
135+
"EngineLifecycleSupport": {
136+
"description": "The life cycle type of the DB cluster. You can use this setting to enroll your DB cluster into Amazon RDS Extended Support.",
137+
"type": "string"
138+
},
135139
"EngineMode": {
136140
"description": "The DB engine mode of the DB cluster, either provisioned, serverless, parallelquery, global, or multimaster.",
137141
"type": "string"

aws-rds-dbcluster/docs/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ To declare this entity in your AWS CloudFormation template, use the following sy
3636
"<a href="#enablehttpendpoint" title="EnableHttpEndpoint">EnableHttpEndpoint</a>" : <i>Boolean</i>,
3737
"<a href="#enableiamdatabaseauthentication" title="EnableIAMDatabaseAuthentication">EnableIAMDatabaseAuthentication</a>" : <i>Boolean</i>,
3838
"<a href="#engine" title="Engine">Engine</a>" : <i>String</i>,
39+
"<a href="#enginelifecyclesupport" title="EngineLifecycleSupport">EngineLifecycleSupport</a>" : <i>String</i>,
3940
"<a href="#enginemode" title="EngineMode">EngineMode</a>" : <i>String</i>,
4041
"<a href="#engineversion" title="EngineVersion">EngineVersion</a>" : <i>String</i>,
4142
"<a href="#managemasteruserpassword" title="ManageMasterUserPassword">ManageMasterUserPassword</a>" : <i>Boolean</i>,
@@ -103,6 +104,7 @@ Properties:
103104
<a href="#enablehttpendpoint" title="EnableHttpEndpoint">EnableHttpEndpoint</a>: <i>Boolean</i>
104105
<a href="#enableiamdatabaseauthentication" title="EnableIAMDatabaseAuthentication">EnableIAMDatabaseAuthentication</a>: <i>Boolean</i>
105106
<a href="#engine" title="Engine">Engine</a>: <i>String</i>
107+
<a href="#enginelifecyclesupport" title="EngineLifecycleSupport">EngineLifecycleSupport</a>: <i>String</i>
106108
<a href="#enginemode" title="EngineMode">EngineMode</a>: <i>String</i>
107109
<a href="#engineversion" title="EngineVersion">EngineVersion</a>: <i>String</i>
108110
<a href="#managemasteruserpassword" title="ManageMasterUserPassword">ManageMasterUserPassword</a>: <i>Boolean</i>
@@ -390,6 +392,16 @@ _Type_: String
390392

391393
_Update requires_: [Some interruptions](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-some-interrupt)
392394

395+
#### EngineLifecycleSupport
396+
397+
The life cycle type of the DB cluster. You can use this setting to enroll your DB cluster into Amazon RDS Extended Support.
398+
399+
_Required_: No
400+
401+
_Type_: String
402+
403+
_Update requires_: [Some interruptions](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-some-interrupt)
404+
393405
#### EngineMode
394406

395407
The DB engine mode of the DB cluster, either provisioned, serverless, parallelquery, global, or multimaster.

aws-rds-dbcluster/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<dependency>
3131
<groupId>software.amazon.awssdk</groupId>
3232
<artifactId>rds</artifactId>
33-
<version>2.25.12</version>
33+
<version>2.25.56</version>
3434
</dependency>
3535
<dependency>
3636
<groupId>software.amazon.awssdk</groupId>

aws-rds-dbcluster/src/main/java/software/amazon/rds/dbcluster/BaseHandlerStd.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
import software.amazon.awssdk.services.rds.model.Tag;
6464
import software.amazon.awssdk.services.rds.model.WriteForwardingStatus;
6565
import software.amazon.awssdk.utils.StringUtils;
66+
import software.amazon.cloudformation.exceptions.CfnInvalidRequestException;
6667
import software.amazon.cloudformation.exceptions.CfnNotStabilizedException;
6768
import software.amazon.cloudformation.exceptions.ResourceNotFoundException;
6869
import software.amazon.cloudformation.proxy.AmazonWebServicesClientProxy;
@@ -158,7 +159,8 @@ public abstract class BaseHandlerStd extends BaseHandler<CallbackContext> {
158159
KmsKeyNotAccessibleException.class,
159160
StorageTypeNotAvailableException.class,
160161
StorageTypeNotSupportedException.class,
161-
NetworkTypeNotSupportedException.class)
162+
NetworkTypeNotSupportedException.class,
163+
CfnInvalidRequestException.class)
162164
.build();
163165

164166
protected static final ErrorRuleSet ADD_ASSOC_ROLES_SOFTFAIL_ERROR_RULE_SET = ErrorRuleSet

aws-rds-dbcluster/src/main/java/software/amazon/rds/dbcluster/Translator.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ static CreateDbClusterRequest createDbClusterRequest(
9696
.storageType(model.getStorageType())
9797
.tags(Tagging.translateTagsToSdk(tagSet))
9898
.vpcSecurityGroupIds(model.getVpcSecurityGroupIds())
99+
.engineLifecycleSupport(model.getEngineLifecycleSupport())
99100
.build();
100101
}
101102

@@ -123,7 +124,8 @@ static RestoreDbClusterToPointInTimeRequest restoreDbClusterToPointInTimeRequest
123124
.restoreType(model.getRestoreType())
124125
.tags(Tagging.translateTagsToSdk(tagSet))
125126
.useLatestRestorableTime(model.getUseLatestRestorableTime())
126-
.vpcSecurityGroupIds(model.getVpcSecurityGroupIds());
127+
.vpcSecurityGroupIds(model.getVpcSecurityGroupIds())
128+
.engineLifecycleSupport(model.getEngineLifecycleSupport());
127129

128130
if (StringUtils.hasValue(model.getRestoreToTime())
129131
&& BooleanUtils.isNotTrue(model.getUseLatestRestorableTime())) {
@@ -165,6 +167,7 @@ static RestoreDbClusterFromSnapshotRequest restoreDbClusterFromSnapshotRequest(
165167
.storageType(model.getStorageType())
166168
.tags(Tagging.translateTagsToSdk(tagSet))
167169
.vpcSecurityGroupIds(model.getVpcSecurityGroupIds())
170+
.engineLifecycleSupport(model.getEngineLifecycleSupport())
168171
.build();
169172
}
170173

@@ -546,6 +549,7 @@ public static ResourceModel translateDbClusterFromSdk(
546549
.build()
547550
)
548551
.engine(dbCluster.engine())
552+
.engineLifecycleSupport(dbCluster.engineLifecycleSupport())
549553
.engineMode(dbCluster.engineMode())
550554
.engineVersion(dbCluster.engineVersion())
551555
.manageMasterUserPassword(dbCluster.masterUserSecret() != null)

aws-rds-dbcluster/src/main/java/software/amazon/rds/dbcluster/UpdateHandler.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@
44

55
import java.time.Instant;
66
import java.util.HashSet;
7+
import java.util.Objects;
78

89
import org.apache.commons.lang3.BooleanUtils;
910

1011
import com.amazonaws.util.StringUtils;
1112
import software.amazon.awssdk.services.ec2.Ec2Client;
1213
import software.amazon.awssdk.services.rds.RdsClient;
1314
import software.amazon.awssdk.services.rds.model.SourceType;
15+
import software.amazon.cloudformation.exceptions.CfnInvalidRequestException;
1416
import software.amazon.cloudformation.proxy.AmazonWebServicesClientProxy;
1517
import software.amazon.cloudformation.proxy.HandlerErrorCode;
1618
import software.amazon.cloudformation.proxy.ProgressEvent;
@@ -65,6 +67,18 @@ protected ProgressEvent<ResourceModel, CallbackContext> handleRequest(
6567
);
6668
}
6769
return ProgressEvent.progress(desiredResourceState, callbackContext)
70+
.then(progress -> {
71+
try {
72+
if(!Objects.equals(request.getDesiredResourceState().getEngineLifecycleSupport(),
73+
request.getPreviousResourceState().getEngineLifecycleSupport()) &&
74+
!request.getRollback()) {
75+
throw new CfnInvalidRequestException("EngineLifecycleSupport cannot be modified.");
76+
}
77+
} catch (CfnInvalidRequestException e) {
78+
return Commons.handleException(progress, e, DEFAULT_DB_CLUSTER_ERROR_RULE_SET, requestLogger);
79+
}
80+
return progress;
81+
})
6882
.then(progress -> {
6983
if (shouldRemoveFromGlobalCluster(request.getPreviousResourceState(), request.getDesiredResourceState())) {
7084
progress.getCallbackContext().timestampOnce(RESOURCE_UPDATED_AT, Instant.now());

aws-rds-dbcluster/src/test/java/software/amazon/rds/dbcluster/UpdateHandlerTest.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -995,4 +995,17 @@ void handleRequest_ModifyDBCluster_HandleException(
995995
expectResponseCode
996996
);
997997
}
998+
999+
@Test
1000+
public void handleRequest_EngineLifecycleSupportShouldFail() {
1001+
expectServiceInvocation = false;
1002+
test_handleRequest_base(
1003+
new CallbackContext(),
1004+
ResourceHandlerRequest.<ResourceModel>builder().rollback(false),
1005+
null,
1006+
() -> RESOURCE_MODEL.toBuilder().engineLifecycleSupport("open-source-rds-extended-support").build(),
1007+
() -> RESOURCE_MODEL.toBuilder().engineLifecycleSupport("open-source-rds-extended-support-disabled").build(),
1008+
expectFailed(HandlerErrorCode.InvalidRequest)
1009+
);
1010+
}
9981011
}

aws-rds-dbclusterendpoint/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<dependency>
3131
<groupId>software.amazon.awssdk</groupId>
3232
<artifactId>rds</artifactId>
33-
<version>2.25.12</version>
33+
<version>2.25.56</version>
3434
</dependency>
3535
<!-- https://mvnrepository.com/artifact/software.amazon.cloudformation/aws-cloudformation-rpdk-java-plugin -->
3636
<dependency>

0 commit comments

Comments
 (0)