question

yellowfellow100 avatar image
yellowfellow100 asked

Complete zip of helloworld

Hi I just started using AWS lambda and am building in Java. Currently, I have a solid speechlet, sample utterances, miscellaneous back end code, and intents. Do you happen to have an example of a complete .zip or structured project that one would actually upload to the AWS lambda server? I don't know what other files and information I need to include. I couldn't find an answer on the other official pages, as they basically just say to put stuff in a zip and upload it. It would be nice if a uploaded .zip of hello world is provided as a download so I can see the structure rather than an explanation in words. Thank You!
alexa skills kitsubmission testing certification
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

yellowfellow100 avatar image
yellowfellow100 answered
also it doesn't have to be hello world just any program thats ready to be packaged into a .zip to be uploaded or the final .zip thats submitted
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

jjaquinta avatar image
jjaquinta answered
There's a sample project in the EchoProofOfConcepts project here: https://github.com/jjaquinta/EchoProofOfConcepts called jo.echo.lambda. The directory structure used for the project should directly correspond to the structure needed in the ZIP. I.e. if you zipped the contents of the project folder, you should get a ZIP suitable for uploading.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

yellowfellow100 avatar image
yellowfellow100 answered
Thanks for the tip, I saw that too just wasn't quite sure if it was right. I thought it looked like reasonable structure. Is there a strict requirement for the structure or is it pretty lax?
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

jjaquinta avatar image
jjaquinta answered
It's pretty strict. You class files must be in directories named after the package they are in. (Just like a jar file.) If you have dependent jar files, they must be in a directory named "lib" in the root of the zip.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

jjaquinta avatar image
jjaquinta answered
Here's a trascript of me zipping my current project: [code] C:\temp\jo.starlanes.lambda>"c:\Program Files\7-Zip\7z.exe" a -r -tZIP ..\jo_starlanes.zip . 7-Zip [64] 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18 Scanning Updating archive ..\jo_starlanes.zip Compressing jo\echo\lambda\utils\SpeechletLambda.class Compressing jo\echo\util\BaseLambda$SpeechletWrapper.class Compressing jo\echo\util\BaseLambda.class Compressing jo\echo\util\EnumerationUtils.class Compressing jo\echo\util\ResponseUtils.class Compressing jo\echo\util\SessionUtils.class Compressing jo\starlanes\lambda\data\StarlanesState.class Compressing jo\starlanes\lambda\logic\ComposeLogic.class Compressing jo\starlanes\lambda\logic\DroneLogic.class Compressing jo\starlanes\lambda\logic\HelpLogic.class Compressing jo\starlanes\lambda\logic\QueryLogic.class Compressing jo\starlanes\lambda\logic\StarlanesAppLogic.class Compressing jo\starlanes\lambda\logic\TravelLogic.class Compressing jo\starlanes\lambda\logic\UserLogic.class Compressing jo\starlanes\lambda\PassThruHander$1.class Compressing jo\starlanes\lambda\PassThruHander.class Compressing jo\starlanes\lambda\slu\ help.txt Compressing jo\starlanes\lambda\slu\Starlanes.baf Compressing jo\starlanes\lambda\slu\Starlanes.baf.xml Compressing jo\starlanes\lambda\slu\Starlanes.json Compressing jo\starlanes\lambda\slu\StarlanesTest.baf Compressing jo\starlanes\lambda\slu\StarlanesTest.json Compressing jo\starlanes\lambda\slu\StarlanesTest.model Compressing jo\starlanes\lambda\StarlanesHander.class Compressing jo\starlanes\lambda\StarlanesSpeechlet.class Compressing lib\alexa-appkit-1.0.81.2.jar Compressing lib\aspectjrt.jar Compressing lib\aspectjweaver.jar Compressing lib\aws-java-sdk-1.10.3.jar Compressing lib\commons-codec-1.6.jar Compressing lib\commons-lang3-3.x.jar Compressing lib\commons-logging-1.1.3.jar Compressing lib\freemarker-2.3.18.jar Compressing lib\httpclient-4.3.6.jar Compressing lib\httpcore-4.3.3.jar Compressing lib\jackson-annotations-2.3.2.jar Compressing lib\jackson-annotations-2.5.3.jar Compressing lib\jackson-core-2.3.2.jar Compressing lib\jackson-core-2.5.3.jar Compressing lib\jackson-databind-2.3.2.jar Compressing lib\jackson-databind-2.5.3.jar Compressing lib\JakartaCommons-IO-2.4.jar Compressing lib\javax.mail-api-1.4.6.jar Compressing lib\joda-time-2.3.jar Compressing lib\joda-time-2.8.1.jar Compressing lib\log4j-1.2.17.jar Compressing lib\servlet-api-3.0.jar Compressing lib\slf4j-api-1.7.10.jar Compressing lib\slf4j-log4j12-1.7.10.jar Compressing lib\spring-beans-3.0.7.jar Compressing lib\spring-context-3.0.7.jar Compressing lib\spring-core-3.0.7.jar Compressing lib\starlanes_core.jar Everything is Ok C:\temp\jo.starlanes.lambda> [/code]
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

yellowfellow100 avatar image
yellowfellow100 answered
Thanks again for the helpful info :) Another question: do we have to package every used import/.jar to that .zip file or are there some libraries they might provide (such as the amazon sdk)? If we don't have to package certain things, then do we have to structure the import statements differently?
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

yellowfellow100 avatar image
yellowfellow100 answered
Also do I have to use gradle to build the .zip? Does gradle do anything special during its compression? Or can I just organize the folders by myself and then compress?
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

jjaquinta avatar image
jjaquinta answered
I think the Lambda jar file is in the environment, but that's it. Given the plethora of dependent jars, I just bundle the whole thing. It's a pain, but there you go. If you want to experiment, print the classpath while running to the lot file. See if there is anything other than your jars on it. As for gradle... I'm allergic to it. Never use it. (If you note, in my dump above, I use 7z from the command line!) So, no, there's nothing special about how it ZIPs things. Anything that produces a zip formatted file will do.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

yellowfellow100 avatar image
yellowfellow100 answered
Thanks again for the help :)
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.