-
Notifications
You must be signed in to change notification settings - Fork 4k
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
(aws_s3_deployment): Specify destinationKey for S3 asset in BucketDeployment #30846
Comments
BucketDeployment construct also supports optional destinationKeyPrefix property. So it needs to be decided whether to use it as prefix or ignore it, if we happen to support |
@ashishdhingra That's a great point, I would personally lean toward validating that only one of After some more thought, |
I've discovered I can achieve this by specifying the asset path to be the directory containing the For anyone attempting to upload a zip file using Works:
Does not work:
|
|
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. |
Describe the feature
I am proposing that an optional prop
destinationKey
is added to the BucketDeployment construct, mirroring thedestinationKey
prop that exists on the DeployTimeSubstitutedFile construct. This will allow users to upload file assets to S3 to a predefined S3 path.Use Case
I am trying to use the CDK to create and invoke an AWS CodePipeline that uses S3 as a source. CodePipeline requires that files exist as a
.zip
file in the source S3 bucket. While I know I could reference the auto-generated object key of the file in the CodePipeline definition, this would then require users to reuse a lengthy and meaningless file name when working with files locally, rather than a friendly expected name.I attempted to use DeployTimeSubstitutedFile to achieve this behavior with a locally zipped file (with no substitutions), but this resulted in a corrupted zip file in S3.
Proposed Solution
Add an optional
destinationKey
similar to what was done for theDeployTimeSubstitutedFile
class here: #29029Other Information
I understand this feature represents a general anti-pattern in CDK of using static names, in this use case the idea is to generate an easy-to-use CodePipeline for users who likely do not have significant development experience. I'm open to other ideas of how to work around this that result in local files zipped and uploaded to S3 with a specific object key that don't require implementing a custom resource.
Acknowledgements
CDK version used
2.147.3
Environment details (OS name and version, etc.)
macOS Sonoma 14.5
The text was updated successfully, but these errors were encountered: