Skip to content

Commit

Permalink
docs(rds): clarify how to enable S3Import/S3Export in Readme.md (#30459)
Browse files Browse the repository at this point in the history
### 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 
```ts
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

```ts
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
- [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
duranbe authored Jul 24, 2024
1 parent 7131539 commit e7af8f8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/aws-cdk-lib/aws-rds/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: To use `s3ImportRole` and `s3ExportRole` with Aurora PostgreSQL, you must also enable the S3 import and export features when you create the DatabaseClusterEngine.

You can read more about loading data to (or from) S3 here:

Expand Down
4 changes: 2 additions & 2 deletions packages/aws-cdk-lib/aws-rds/lib/cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ interface DatabaseClusterBaseProps {
* This feature is only supported by the Aurora database engine.
*
* This property must not be used if `s3ImportBuckets` is used.
*
* To use this property with Aurora PostgreSQL, it must be configured with the S3 import feature enabled when creating the DatabaseClusterEngine
* For MySQL:
* @see https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraMySQL.Integrating.LoadFromS3.html
*
Expand Down Expand Up @@ -284,7 +284,7 @@ interface DatabaseClusterBaseProps {
* This feature is only supported by the Aurora database engine.
*
* This property must not be used if `s3ExportBuckets` is used.
*
* To use this property with Aurora PostgreSQL, it must be configured with the S3 export feature enabled when creating the DatabaseClusterEngine
* For MySQL:
* @see https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraMySQL.Integrating.SaveIntoS3.html
*
Expand Down

0 comments on commit e7af8f8

Please sign in to comment.