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

cdk deploy: do not use docker for dependency resolution & installation #25442

Open
1 of 2 tasks
CoreOxide opened this issue May 4, 2023 · 10 comments
Open
1 of 2 tasks
Labels
@aws-cdk/aws-lambda Related to AWS Lambda effort/large Large work item – several weeks of effort feature-request A feature should be added or improved. p2

Comments

@CoreOxide
Copy link

CoreOxide commented May 4, 2023

Describe the feature

Today, CDK deploy uses docker as it's backend to collect and install dependencies. I'm proposing a way to to that without using Docker. It will also allow building for different OS targets and Lambda runtimes.

Use Case

Not needing to run (and pay for) Docker anymore when building deploying.

Proposed Solution

This method basically implements pip's dependency resolution. It creates a flat dependency list that can be fed to pip. It's required to have an already resolved dependency list to utilize pip's --platform flag, such that dependencies can be downloaded for any target OS (given they exist for that OS).

See this blog post for more information:
https://medium.com/cyberark-engineering/dont-use-docker-to-package-python-lambdas-on-your-mac-fe64b8f98144

See this repo for working code solution:
https://github.com/CoreOxide/pip_requirements_flattener

Other Information

This code is used in production-grade deployment pipelines for some time now and has a proved record.

Acknowledgements

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

CDK version used

2.69.0

Environment details (OS name and version, etc.)

MacOS 13.3.1

@CoreOxide CoreOxide added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels May 4, 2023
@github-actions github-actions bot added the @aws-cdk/aws-lambda Related to AWS Lambda label May 4, 2023
@peterwoodworth
Copy link
Contributor

Is this specifically regarding the lambda python module?

@peterwoodworth peterwoodworth added p2 effort/large Large work item – several weeks of effort and removed needs-triage This issue or PR still needs to be triaged. labels May 4, 2023
@CoreOxide
Copy link
Author

Is this specifically regarding the lambda python module?

Yup. I'm not sure if containers are used for any other languages, though, an if this solution can be expanded to cover them as well.

@CoreOxide
Copy link
Author

@peterwoodworth So do you think it will be fine to introduce this new dependency resolution & installation system to support only Python Lambdas for the first iteration?
If so, I can create a PR in CDK.

@peterwoodworth
Copy link
Contributor

I think we should do an RFC for this first, as this seems to be a significant overhaul of the existing implementation

@CoreOxide
Copy link
Author

CoreOxide commented May 11, 2023

Thanks Peter. I'll try to get to it in the coming weeks.
Should this issue be closed, then?

@kevinhq
Copy link

kevinhq commented Oct 11, 2023

Any update on this? It would be great if it's implemented. Docker didn't run very well on macOS (at least from my experience, it's slower... than Linux)

@CoreOxide
Copy link
Author

@kevinhq I want to try another approach, using AWS ClodShell instead. I hope I can get ot it soon.
If it will indeed prove the better method - I will propose it in the RFC instead.

@CoreOxide
Copy link
Author

@kevinhq , @peterwoodworth
So I finally gov some time to work on this. Created RFC -> aws/aws-cdk-rfcs#579
Should this issue be closed now?

@mrpackethead
Copy link

mrpackethead commented Nov 5, 2023

@peterwoodworth

I think we should do an RFC for this first, as this seems to be a significant overhaul of the existing implementation

Except the RFC process is closed, so hows that going to work?

@evgenyka
Copy link
Contributor

evgenyka commented Nov 5, 2023

@CoreOxide - Thank you for submitting your RFC! Please be aware that the RFC process is currently on hold (as we announced in August 2023), and we won't be able to review it immediately. I recommend staying updated with our (near) future announcements regarding the RFC process. We will use this as a tracking issue for your RFC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-lambda Related to AWS Lambda effort/large Large work item – several weeks of effort feature-request A feature should be added or improved. p2
Projects
None yet
Development

No branches or pull requests

5 participants