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

custom-resource-handlers: buffered asset download #29898

Open
1 of 2 tasks
nmussy opened this issue Apr 19, 2024 · 0 comments
Open
1 of 2 tasks

custom-resource-handlers: buffered asset download #29898

nmussy opened this issue Apr 19, 2024 · 0 comments
Labels
@aws-cdk/aws-s3 Related to Amazon S3 effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2

Comments

@nmussy
Copy link
Contributor

nmussy commented Apr 19, 2024

Describe the feature

This issue is part feature request, part bug report.

S3 custom resource should be able to handle arbitrarily large asset files efficiently

Use Case

Deploying large asset files with an S3 custom resource causes the deployment Lambda to run out of memory The function's memory can be increased to compensate for bigger file sizes, but only up to a point and at additional costs.

Proposed Solution

It doesn't seem like the AWS CLI s3 commands support buffered download. As proposed in #29862 (comment), using boto3's multipart_threshold should allow the file to be downloaded and written to disk in multiple parts.

There might be other places where this change would be necessary, but this is the one that caused the initial issue:

if extract:
archive=os.path.join(workdir, str(uuid4()))
logger.info("archive: %s" % archive)
aws_command("s3", "cp", s3_source_zip, archive)
logger.info("| extracting archive to: %s\n" % contents_dir)
logger.info("| markers: %s" % markers)
extract_and_replace_markers(archive, contents_dir, markers)
else:
logger.info("| copying archive to: %s\n" % contents_dir)
aws_command("s3", "cp", s3_source_zip, contents_dir)

Other Information

See #29862 for the original issue

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CDK version used

2.134.0

Environment details (OS name and version, etc.)

N/A

@nmussy nmussy added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Apr 19, 2024
@github-actions github-actions bot added the @aws-cdk/aws-s3 Related to Amazon S3 label Apr 19, 2024
@khushail khushail added investigating This issue is being investigated and/or work is in progress to resolve the issue. p2 effort/small Small work item – less than a day of effort and removed needs-triage This issue or PR still needs to be triaged. investigating This issue is being investigated and/or work is in progress to resolve the issue. labels Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-s3 Related to Amazon S3 effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2
Projects
None yet
Development

No branches or pull requests

2 participants