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

feat(rds): S3 import and export for DatabaseInstances #10370

Merged
merged 8 commits into from
Sep 18, 2020

Conversation

njlynch
Copy link
Contributor

@njlynch njlynch commented Sep 15, 2020

This change introduces S3 import/export for DatabaseInstances, the same as what
currently exists today for DatabaseClusters. This change was heavily influenced
by #10132 (the work to introduce feature
names for DatabaseCluster), and steals patterns and names heavily from it.

Implementation Notes:

  • Unlike for clsuters, for instances, the feature names are required; if the
    feature name doesn't exist, we shouldn't be creating the role.
  • For both Oracle and SQL Server, all current/active versions support the same
    feature names. This simplified the implementation quite a bit.
  • I opted not to support features for the deprecated Oracle versions.
  • I moved the setupS3ImportExport helper function into a utils class. One
    quirk of the SQL Server requirement is that you must create an OptionGroup
    with only one role (for both import & export). Oracle, likewise, has a single
    feature for both import and export. So I opted to default to creating a single
    role (if necessary) for both import and export. Open to challenges on this.
  • The OptionGroup class needed some rework to be able to make the list of
    configurations dynamic. I then had to do some light tweaking to ensure
    backwards compatibility with the connections property.

fixes #4419


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

This change introduces S3 import/export for DatabaseInstances, the same as what
currently exists today for DatabaseClusters. This change was heavily influenced
by #10132 (the work to introduce feature
names for DatabaseCluster), and steals patterns and names heavily from it.

**Implementation Notes:**
* Unlike for clsuters, for instances, the feature names are required; if the
  feature name doesn't exist, we shouldn't be creating the role.
* For both Oracle and SQL Server, all current/active versions support the same
  feature names. This simplified the implementation quite a bit.
* I opted **not** to support features for the deprecated Oracle versions.
* I moved the `setupS3ImportExport` helper function into a utils class. One
  quirk of the SQL Server requirement is that you must create an OptionGroup
  with only one role (for both import & export). Oracle, likewise, has a single
  feature for both import and export. So I opted to default to creating a single
  role (if necessary) for both import and export. Open to challenges on this.
* The `OptionGroup` class needed some rework to be able to make the list of
  configurations dynamic. I then had to do some light tweaking to ensure
  backwards compatibility with the connections property.

fixes #4419
@njlynch njlynch requested a review from a team September 15, 2020 17:47
@njlynch njlynch self-assigned this Sep 15, 2020
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Sep 15, 2020
Copy link
Contributor

@skinny85 skinny85 left a comment

Choose a reason for hiding this comment

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

Fantastic work! I have some comments, they're really in the details though, the general direction is awesome.

packages/@aws-cdk/aws-rds/README.md Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-rds/lib/instance-engine.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-rds/lib/instance-engine.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-rds/lib/instance-engine.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-rds/lib/instance-engine.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-rds/lib/instance.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-rds/lib/instance.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-rds/lib/instance.ts Outdated Show resolved Hide resolved
@skinny85 skinny85 added the pr/do-not-merge This PR should not be merged at this time. label Sep 18, 2020
Copy link
Contributor

@skinny85 skinny85 left a comment

Choose a reason for hiding this comment

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

I love (almost) everything about this. The only thing that I'm not a huge fan of is adding the description property to IInstanceEngine - I feel like a utility function might be better, especially that we use description only in a single spot (unless I missed something) in the entire codebase, and it can be considered backwards-incompatible.

I'll leave it to your judgement though 🙂.

packages/@aws-cdk/aws-rds/lib/private/util.ts Show resolved Hide resolved
packages/@aws-cdk/aws-rds/lib/private/util.ts Show resolved Hide resolved
packages/@aws-cdk/aws-rds/test/integ.instance-s3.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-rds/lib/instance-engine.ts Outdated Show resolved Hide resolved
@njlynch njlynch removed the pr/do-not-merge This PR should not be merged at this time. label Sep 18, 2020
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: d84b8af
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@njlynch njlynch merged commit 80a2ac9 into master Sep 18, 2020
@njlynch njlynch deleted the njlynch/rds-instance-roles branch September 18, 2020 09:25
mergify bot pushed a commit that referenced this pull request Aug 25, 2021
As mentioned in #14546, Postgres database instances did not support `s3export` when most of the `s3 import/export` features were added in #10370. This PR fills in that gap now that `s3export` is [available](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/postgresql-s3-export.html) for Postgres.

The supported versions are documented [here](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/postgresql-s3-export.html) and I manually verified via AWS CLI that Postgres 13+ supports `s3export` as well.

Looking into the test suite, I think it makes more sense to modify the existing test than to create an entirely new one, similar to how other database instances test s3 import/export at the same time. But I can also move it to its own test if necessary.

I also fixed a very minor doc typo in `cluster-instance.ts`.

Closes #14546. 

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
hollanddd pushed a commit to hollanddd/aws-cdk that referenced this pull request Aug 26, 2021
)

As mentioned in aws#14546, Postgres database instances did not support `s3export` when most of the `s3 import/export` features were added in aws#10370. This PR fills in that gap now that `s3export` is [available](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/postgresql-s3-export.html) for Postgres.

The supported versions are documented [here](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/postgresql-s3-export.html) and I manually verified via AWS CLI that Postgres 13+ supports `s3export` as well.

Looking into the test suite, I think it makes more sense to modify the existing test than to create an entirely new one, similar to how other database instances test s3 import/export at the same time. But I can also move it to its own test if necessary.

I also fixed a very minor doc typo in `cluster-instance.ts`.

Closes aws#14546. 

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
TikiTDO pushed a commit to TikiTDO/aws-cdk that referenced this pull request Sep 6, 2021
)

As mentioned in aws#14546, Postgres database instances did not support `s3export` when most of the `s3 import/export` features were added in aws#10370. This PR fills in that gap now that `s3export` is [available](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/postgresql-s3-export.html) for Postgres.

The supported versions are documented [here](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/postgresql-s3-export.html) and I manually verified via AWS CLI that Postgres 13+ supports `s3export` as well.

Looking into the test suite, I think it makes more sense to modify the existing test than to create an entirely new one, similar to how other database instances test s3 import/export at the same time. But I can also move it to its own test if necessary.

I also fixed a very minor doc typo in `cluster-instance.ts`.

Closes aws#14546. 

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
david-doyle-as24 pushed a commit to david-doyle-as24/aws-cdk that referenced this pull request Sep 7, 2021
)

As mentioned in aws#14546, Postgres database instances did not support `s3export` when most of the `s3 import/export` features were added in aws#10370. This PR fills in that gap now that `s3export` is [available](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/postgresql-s3-export.html) for Postgres.

The supported versions are documented [here](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/postgresql-s3-export.html) and I manually verified via AWS CLI that Postgres 13+ supports `s3export` as well.

Looking into the test suite, I think it makes more sense to modify the existing test than to create an entirely new one, similar to how other database instances test s3 import/export at the same time. But I can also move it to its own test if necessary.

I also fixed a very minor doc typo in `cluster-instance.ts`.

Closes aws#14546. 

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution/core This is a PR that came from AWS.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

aws-rds doesn't support AssociatedRoles attribute
3 participants