2

When creating Java based Lambda Functions using the AWS Eclipse Plugin I see that the uploaded zip files include all the AWS dependencies as defined in the POM file.

Is this by design? Are the required dependencies not available from the "class path" of the executing Lambda Function at runtime?

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
Mark
  • 455
  • 1
  • 5
  • 11
  • You can see the related post: [how can i minimize the weight of my lambda functions](https://stackoverflow.com/questions/44782208/how-can-i-minimize-the-weight-of-my-lambda-functions) – Jnewbie Jul 09 '17 at 12:52
  • 1
    Thanks for the tip @Jnewbie, but this isn't what I was looking for. I want to know if one is required to 'manually' upload AWS dependancies to Java based Lambda Functions. There is no need to add the AWS SDK dependencies when creating Node.js Lambda Functions in the browser editor. – Mark Jul 09 '17 at 13:35

1 Answers1

1

Yes, it is by design, though I have been able to trim down the dependencies considerably over what the plugin adds just by adding only the dependencies I need in the POM file. You can create a POM file that packages dependencies by using either the apache shade plugin or the maven assembly plugin. From the AWS docs:

The build creates this resulting .jar, using information in the pom.xml to do the necessary transforms. This is a standalone .jar (.zip file) that includes all the dependencies. This is your deployment package that you can upload to AWS Lambda to create a Lambda function.

References:

Maven Deployment package and upload to AWS-Lambda

Creating a .jar Deployment Package Using Maven without any IDE (Java)

K.Nicholas
  • 10,956
  • 4
  • 46
  • 66
  • 1
    The more I think about this the more it makes sense, due to versioning and other potential classpath issues. I consider this a good answer to my question. – Mark Jul 09 '17 at 15:53
  • 1
    I assume that since it's a cloud server trying to keep everyone happy would be a nightmare, so it's BYOJ ... – K.Nicholas Jul 09 '17 at 15:56