Skip to content
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

docs(rds): clarify how to enable S3Import/S3Export in Readme.md #30459

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

duranbe
Copy link

@duranbe duranbe commented Jun 5, 2024

Reason for this change

Documentation does not state clearly that feature needs to be manually enabled when using Postgres

Example :
The following code will fail with the error message

const cluster = new rds.DatabaseCluster(this, 'Database', {
      engine: rds.DatabaseClusterEngine.auroraPostgres({version: AuroraPostgresEngineVersion.of('12.7','12')}),
      writer: rds.ClusterInstance.provisioned('writer', {
        instanceType: ec2.InstanceType.of(ec2.InstanceClass.R6G, ec2.InstanceSize.XLARGE4),
      }),
      serverlessV2MinCapacity: 6.5,
      serverlessV2MaxCapacity: 64,
      s3ImportRole: sampleRole
});

Will fail with this error message :Error: s3Import is not supported for Postgres version: 12.7. Use a version that supports the s3Import feature

But the thing is that 12.7 does support it ! The real problem here is that the feature needs to be enabled as such

const cluster = new rds.DatabaseCluster(this, 'Database', {
      engine: rds.DatabaseClusterEngine.auroraPostgres({version: AuroraPostgresEngineVersion.of('12.7','12', {s3Export: true, s3Import:true})}),
      writer: rds.ClusterInstance.provisioned('writer', {
        instanceType: ec2.InstanceType.of(ec2.InstanceClass.R6G, ec2.InstanceSize.XLARGE4),
      }),
      serverlessV2MinCapacity: 6.5,
      serverlessV2MaxCapacity: 64,
      s3ImportRole: sampleRole
});

Description of changes

Small update to Readme.md and inline TSdoc

Description of how you validated changes

None

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@github-actions github-actions bot added p2 beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK labels Jun 5, 2024
@aws-cdk-automation aws-cdk-automation requested a review from a team June 5, 2024 18:53
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.

A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed add Clarification Request to a comment.

@duranbe duranbe changed the title Update README.md of aws-cdk-lib/aws-rds with details to enable S3Impo… docs(rds): Clarify how to enable S3Import/S3Export in Readme.md Jun 5, 2024
@duranbe duranbe changed the title docs(rds): Clarify how to enable S3Import/S3Export in Readme.md docs(rds): clarify how to enable S3Import/S3Export in Readme.md Jun 5, 2024
@aws-cdk-automation aws-cdk-automation dismissed their stale review June 5, 2024 19:13

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Jun 5, 2024
Copy link
Contributor

@aaythapa aaythapa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, thanks for making this change! Is there any documentation that supports this claim? Just want to make sure before approving

@duranbe
Copy link
Author

duranbe commented Jun 10, 2024

Hello !
Sure I can, here is the AWS Doc for S3Import, that mentions this feature to choose from.

As well, here is the relevant code that checks if the S3Import/S3Export feature has been enabled, which by default is false

https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/aws-rds/lib/cluster-engine.ts#L1061

Actually now that I think of it, the error message s3Import is not supported for Postgres version: ${this.engineVersion.fullVersion}. Use a version that supports the s3Import feature. is a bit misleading as the issue could also be not having enabled the feature when declaring the DatabaseClusterEngine

Copy link
Contributor

@scanlonp scanlonp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @duranbe, quick note. Our doc generation has some odd behavior with respect to tags (@see, @default, etc.). Any text after a tag will be omitted. Only the last @see link will be used.

Take a look at s3ExportRole in our docs (link). You'll see that 'For PostgreSQL:' does not show up. Also the link is the PostgreSQL link (the last one).

While this problem is widespread in the file, you should be good only fixing the formatting for these two props. That should help your changes to actually show up!

@duranbe
Copy link
Author

duranbe commented Jun 15, 2024

Hey @scanlonp - thanks for the advice, indeed this is a odd behavior, I modified as I expect to render. Is there a way to build locally the doc ? I might have missed it in the contributing guide

@@ -938,6 +938,7 @@ Data in S3 buckets can be imported to and exported from certain database engines
functionality, set the `s3ImportBuckets` and `s3ExportBuckets` properties for import and export respectively. When
configured, the CDK automatically creates and configures IAM roles as required.
Additionally, the `s3ImportRole` and `s3ExportRole` properties can be used to set this role directly.
Note that when using `s3ImportRole` and/or `s3ExportRole` with AuroraPostgres, you need to enable the respectives feature when declaring the DatabaseClusterEngine.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the 'respectives' feature? Having trouble finding out more information about it.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It refer to the s3Import and s3Export features

this._features = {
      s3Import: auroraPostgresFeatures?.s3Import ? 's3Import' : undefined,
      s3Export: auroraPostgresFeatures?.s3Export ? 's3Export' : undefined,
    };

https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/postgresql-s3-export.html#:~:text=Under%20Feature%2C%20choose%20s3Export.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to rephrase - good to have an external view

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it accurate to say this?

To use s3ImportRole and s3ExportRole with Aurora PostgreSQL, you must also configure the S3 import and export features when creating the DatabaseClusterEngine.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think enable would be more appropriate - as it is turning a boolean flag to true

@duranbe duranbe requested a review from evzzk July 3, 2024 08:25
@duranbe
Copy link
Author

duranbe commented Jul 8, 2024

I updated the PR with an example - it might also make sense to update the error message

@duranbe
Copy link
Author

duranbe commented Jul 10, 2024

Updated after comments 🙌

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 179375b
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@duranbe
Copy link
Author

duranbe commented Jul 11, 2024

Good on my side 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK p2 pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants