Skip to content

fix(s3): allow import S3 bucket with a legacy name#30679

Merged
mergify[bot] merged 5 commits intoaws:mainfrom
moelasmar:main_s3_legacy
Jun 27, 2024
Merged

fix(s3): allow import S3 bucket with a legacy name#30679
mergify[bot] merged 5 commits intoaws:mainfrom
moelasmar:main_s3_legacy

Conversation

@moelasmar
Copy link
Copy Markdown
Contributor

Issue # (if applicable)

Closes #22640.

Reason for this change

Customers could not imported S3 bucket that has a legacy name (contains underscore in the name) and use it in CDK Apps.

Description of changes

This change allowed customer to use S3 buckets legacy names for only the imported S3 buckets, but not for the new ones.

Description of how you validated changes

Added unit test cases, and integration test cases.

Checklist


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

@moelasmar moelasmar requested a review from GavinZZ June 26, 2024 14:01
@aws-cdk-automation aws-cdk-automation requested a review from a team June 26, 2024 14:01
@github-actions github-actions bot added bug This issue is a bug. effort/small Small work item – less than a day of effort p1 labels Jun 26, 2024
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Jun 26, 2024
Copy link
Copy Markdown
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.

@moelasmar moelasmar changed the title fix(aws-s3): allow import S3 bucket with a legacy name fix(s3): allow import S3 bucket with a legacy name Jun 26, 2024
@aws-cdk-automation aws-cdk-automation dismissed their stale review June 26, 2024 14:12

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

@aws-cdk-automation aws-cdk-automation added the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Jun 26, 2024
Comment on lines +10 to +16
const legacyBucketFromName = s3.Bucket.fromBucketName(stack, 'LegacyBucketFromName', 'my_legacy_bucket1');

const legacyBucketFromArn = s3.Bucket.fromBucketArn(stack, 'LegacyBucketFromArn', 'arn:aws:s3:::my_legacy_bucket2');

const legacyBucketFromAttributes = s3.Bucket.fromBucketAttributes(stack, 'LegacyBucketFromAttributes', {
bucketName: 'my_legacy_bucket3',
});
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Was this integ test successfully ran? I'm worried that if we need to update the test and re-deploy, it would fail to deploy due to bucket not found.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It got deployed, but did not really check if it can work or not. Any way let me double check it.

Copy link
Copy Markdown
Member

@GavinZZ GavinZZ left a comment

Choose a reason for hiding this comment

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

LGTM, feel free to remove the do-not-merge label once you verified the integ test is working and deployable.

@GavinZZ GavinZZ added the pr/do-not-merge This PR should not be merged at this time. label Jun 27, 2024
@aws-cdk-automation aws-cdk-automation removed the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Jun 27, 2024
@moelasmar moelasmar removed the pr/do-not-merge This PR should not be merged at this time. label Jun 27, 2024
@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Jun 27, 2024

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Copy Markdown
Collaborator

AWS CodeBuild CI Report

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

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

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Jun 27, 2024

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit e09126f into aws:main Jun 27, 2024
This was referenced Jul 1, 2024
@aws-cdk-automation
Copy link
Copy Markdown
Collaborator

Comments on closed issues and PRs are hard for our team to see. If you need help, please open a new issue that references this one.

@aws aws locked as resolved and limited conversation to collaborators Jul 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bug This issue is a bug. contribution/core This is a PR that came from AWS. effort/small Small work item – less than a day of effort p1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

aws-s3: Unable to use Bucket.fromBucketName on legacy s3 bucket with underscore in the name

3 participants