-
Notifications
You must be signed in to change notification settings - Fork 3
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
Spring Native Zip File Support for AWS Lambda #108
Comments
This is an interesting request and if there's something we can do to make deploying to AWS easier, I'd support it. Again, I would appreciate it if you could share some more details though. A few questions/thoughts...
So long as this only needs configuration in your Maven pom.xml file, you should be able to do this now. I suspect what will happen though is that you'll end up with is a container inside of which is the zip file. Is that what you're seeing at the moment?
Correct. This isn't specific to the Java Native Image buildpack. It is the primary goal of the buildpacks project, to take source code and transform that into container images. You could try to extract files from the generated container images, but that's outside the scope of buildpacks. You'd need to look at Docker and any other tools that would let you pull files out of a container image. I haven't used AWS Lambdas myself, is there a way you can deploy your code as a container image? If so and there are docs you could link me to, I'd be happy to take a look. |
This is not possible (I think) as this step has to happen at the end after the native image has been generated. Basically, we have to take the native image which is part of OCI image and zip it up or create a shaded jar
Yes, we will probably have to do some extra scripting to extract that image and zip it up. Tying to see if we can automate this step as well. So that it would be easier to deploy to AWS Lambda.
Yes, AWS Lambda does support Docker, but i was trying to see if i can deploy it without Docker. It would be great to have support for Functions. https://spring.io/projects/spring-cloud-function. So that we just upload jar/zip to AWS functions with handler. |
@dmikusa-pivotal just checking to see if you have any questions on this |
I don't want to say it'll never happen, but the goal of buildpacks is to produce an image so the extraction work, at least for the foreseeable future is something you'll need to handle. If it's helpful, I could see the buildpack zipping up the resulting native image, possibly an env variable flag you set to instruct it to zip up the resulting image. Is there a particular format for the zip? or is it just a zip with the single binary?
I would like to look at this more but haven't had the time. Apologizes. I suspect this is probably the preferred integration path for the two services, given that the stated goal of buildpacks is to produce an image. Plus really small images, like if you're building with the tiny builder do not add much in the way of overhead, maybe 10-15M. There are probably ways to strip that down as well, given some exploration and investigation. tl;dr - I can't promise anything soon on this, but I would like to keep this open as a potential improvement. |
FYI, a colleague of mine put together this simple extraction process in Maven, which is convenient. https://github.com/making/hello-native-world/blob/main/pom.xml#L104-L138 He's using it for Azure Functions, but I think AWS Lambda is probably going to be very similar. Hope that helps! |
This is great. I will test it out and share my findings |
It would be very very valuable to be able to generate a native image that's compatible to run on lambda (using aws's base image) |
@Richardmbs12 We can certainly explore doing this. Can you expand on this idea? What specifically would you like it to do that you can't do now? Do you have any docs you can reference for AWS regarding their base image? Thanks |
What happened?
Deploy Spring Native Zip to AWS Lambda in zip format.
https://github.com/spring-projects-experimental/spring-native/blob/main/samples/cloud-function-aws/pom.xml#L58-L81
What were you attempting to do?
Trying to deploy spring cloud functions to aws lambda in zip format.
What did you expect to happen?
Expecting a zip file in project target which can be deployed to aws lambda.
What was the actual behavior? Please provide log output, if possible.
Currently it is only possible to generate native image in docker.
Checklist
The text was updated successfully, but these errors were encountered: