Skip to content

Commit

Permalink
[CustomDBEngineVersion] Add support for RAC rolling OS patching
Browse files Browse the repository at this point in the history
  • Loading branch information
dbbh committed Jan 3, 2024
1 parent 1929b35 commit 78e4b0f
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 7 deletions.
4 changes: 2 additions & 2 deletions aws-rds-cfn-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>utils</artifactId>
<version>2.21.17</version>
<version>2.22.7</version>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>rds</artifactId>
<version>2.21.17</version>
<version>2.22.7</version>
</dependency>
<dependency>
<groupId>software.amazon.cloudformation</groupId>
Expand Down
28 changes: 25 additions & 3 deletions aws-rds-customdbengineversion/aws-rds-customdbengineversion.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,18 @@
"type": "string",
"description": "The ARN of the custom engine version."
},
"SourceCustomDBEngineVersionIdentifier": {
"type": "string",
"description": "The identifier of the source custom engine version."
},
"UseAwsProvidedLatestImage": {
"type": "boolean",
"description": "A value that indicates whether AWS provided latest image is applied automatically to the Custom Engine Version. By default, AWS provided latest image is applied automatically."
},
"ImageId": {
"type": "string",
"description": "The identifier of Amazon Machine Image (AMI) used for CEV."
},
"Status": {
"type": "string",
"description": "The availability status to be assigned to the CEV.",
Expand Down Expand Up @@ -103,12 +115,13 @@
"/properties/KMSKeyId": "$join([\"arn:(aws)[-]{0,1}[a-z]{0,2}[-]{0,1}[a-z]{0,3}:kms:[a-z]{2}[-]{1}[a-z]{3,10}[-]{0,1}[a-z]{0,10}[-]{1}[1-3]{1}:[0-9]{12}[:]{1}key\\/\", KMSKeyId])"
},
"required": [
"DatabaseInstallationFilesS3BucketName",
"Engine",
"EngineVersion"
],
"writeOnlyProperties": [
"/properties/Manifest"
"/properties/Manifest",
"/properties/SourceCustomDbEngineVersionIdentifier",
"/properties/UseAwsProvidedLatestImage"
],
"readOnlyProperties": [
"/properties/DBEngineVersionArn"
Expand All @@ -122,14 +135,23 @@
"/properties/EngineVersion",
"/properties/DatabaseInstallationFilesS3BucketName",
"/properties/DatabaseInstallationFilesS3Prefix",
"/properties/ImageId",
"/properties/KMSKeyId",
"/properties/Manifest"
"/properties/Manifest",
"/properties/SourceCustomDbEngineVersionIdentifier",
"/properties/UseAwsProvidedLatestImage"
],
"handlers": {
"create": {
"permissions": [
"ec2:CopySnapshot",
"ec2:DeleteSnapshot",
"ec2:DescribeSnapshots",
"kms:CreateGrant",
"kms:Decrypt",
"kms:DescribeKey",
"kms:GenerateDataKey",
"kms:ReEncrypt",
"mediaimport:CreateDatabaseBinarySnapshot",
"rds:AddTagsToResource",
"rds:CreateCustomDBEngineVersion",
Expand Down
39 changes: 38 additions & 1 deletion aws-rds-customdbengineversion/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ To declare this entity in your AWS CloudFormation template, use the following sy
"<a href="#engineversion" title="EngineVersion">EngineVersion</a>" : <i>String</i>,
"<a href="#kmskeyid" title="KMSKeyId">KMSKeyId</a>" : <i>String</i>,
"<a href="#manifest" title="Manifest">Manifest</a>" : <i>String</i>,
"<a href="#sourcecustomdbengineversionidentifier" title="SourceCustomDBEngineVersionIdentifier">SourceCustomDBEngineVersionIdentifier</a>" : <i>String</i>,
"<a href="#useawsprovidedlatestimage" title="UseAwsProvidedLatestImage">UseAwsProvidedLatestImage</a>" : <i>Boolean</i>,
"<a href="#imageid" title="ImageId">ImageId</a>" : <i>String</i>,
"<a href="#status" title="Status">Status</a>" : <i>String</i>,
"<a href="#tags" title="Tags">Tags</a>" : <i>[ <a href="tag.md">Tag</a>, ... ]</i>
}
Expand All @@ -37,6 +40,9 @@ Properties:
<a href="#engineversion" title="EngineVersion">EngineVersion</a>: <i>String</i>
<a href="#kmskeyid" title="KMSKeyId">KMSKeyId</a>: <i>String</i>
<a href="#manifest" title="Manifest">Manifest</a>: <i>String</i>
<a href="#sourcecustomdbengineversionidentifier" title="SourceCustomDBEngineVersionIdentifier">SourceCustomDBEngineVersionIdentifier</a>: <i>String</i>
<a href="#useawsprovidedlatestimage" title="UseAwsProvidedLatestImage">UseAwsProvidedLatestImage</a>: <i>Boolean</i>
<a href="#imageid" title="ImageId">ImageId</a>: <i>String</i>
<a href="#status" title="Status">Status</a>: <i>String</i>
<a href="#tags" title="Tags">Tags</a>: <i>
- <a href="tag.md">Tag</a></i>
Expand All @@ -48,7 +54,7 @@ Properties:

The name of an Amazon S3 bucket that contains database installation files for your CEV. For example, a valid bucket name is `my-custom-installation-files`.

_Required_: Yes
_Required_: No

_Type_: String

Expand Down Expand Up @@ -142,6 +148,36 @@ _Maximum Length_: <code>51000</code>

_Update requires_: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

#### SourceCustomDBEngineVersionIdentifier

The identifier of the source custom engine version.

_Required_: No

_Type_: String

_Update requires_: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

#### UseAwsProvidedLatestImage

A value that indicates whether AWS provided latest image is applied automatically to the Custom Engine Version. By default, AWS provided latest image is applied automatically.

_Required_: No

_Type_: Boolean

_Update requires_: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

#### ImageId

The identifier of Amazon Machine Image (AMI) used for CEV.

_Required_: No

_Type_: String

_Update requires_: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

#### Status

The availability status to be assigned to the CEV.
Expand Down Expand Up @@ -175,3 +211,4 @@ For more information about using the `Fn::GetAtt` intrinsic function, see [Fn::G
#### DBEngineVersionArn

The ARN of the custom engine version.

2 changes: 1 addition & 1 deletion aws-rds-customdbengineversion/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>rds</artifactId>
<version>2.21.17</version>
<version>2.22.7</version>
</dependency>
<dependency>
<groupId>software.amazon.rds.common</groupId>
Expand Down
6 changes: 6 additions & 0 deletions aws-rds-customdbengineversion/resource-role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,14 @@ Resources:
Statement:
- Effect: Allow
Action:
- "ec2:CopySnapshot"
- "ec2:DeleteSnapshot"
- "ec2:DescribeSnapshots"
- "kms:CreateGrant"
- "kms:Decrypt"
- "kms:DescribeKey"
- "kms:GenerateDataKey"
- "kms:ReEncrypt"
- "mediaimport:CreateDatabaseBinarySnapshot"
- "rds:AddTagsToResource"
- "rds:CreateCustomDBEngineVersion"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,12 @@ public static CreateCustomDbEngineVersionRequest createCustomDbEngineVersionRequ
.description(model.getDescription())
.engine(model.getEngine())
.engineVersion(model.getEngineVersion())
.imageId(model.getImageId())
.kmsKeyId(model.getKMSKeyId())
.manifest(model.getManifest())
.sourceCustomDbEngineVersionIdentifier(model.getSourceCustomDBEngineVersionIdentifier())
.tags(Tagging.translateTagsToSdk(tags))
.useAwsProvidedLatestImage(model.getUseAwsProvidedLatestImage())
.build();
}

Expand Down Expand Up @@ -108,6 +111,7 @@ static ResourceModel translateFromSdk(
.description(engineVersion.dbEngineVersionDescription())
.engine(engineVersion.engine())
.engineVersion(engineVersion.engineVersion())
.imageId(engineVersion.image() != null ? engineVersion.image().imageId() : null)
.kMSKeyId(engineVersion.kmsKeyId())
.status(engineVersion.status())
.tags(translateTagsFromSdk(engineVersion.tagList()))
Expand Down
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<modules>
<module>aws-rds-cfn-test-common</module>
<module>aws-rds-cfn-common</module>
<module>aws-rds-customdbengineversion</module>
<module>aws-rds-dbcluster</module>
<module>aws-rds-dbclusterparametergroup</module>
<module>aws-rds-dbinstance</module>
Expand Down

0 comments on commit 78e4b0f

Please sign in to comment.