Issue
I am very new to AWS and at the company I work for, I have been uploading Java Lambda functions to AWS using the AWS Toolkit for Eclipse. I simply right-click the project in Eclipse > click AWS Lambda
> click upload function to AWS Lambda
.
From there, my project is uploaded to Lambda. However, I received an email from AWS that mentioned they are rolling out changes that may have an impact certain workflows that attempt to invoke or modify a function shortly after a create or an update action
. According to the documentation they sent in the email, the changes won't take effect until December 6th but they are giving us the chance to prepare by opting in early.
So my question is, how come when I opt-in to these changes as mentioned how in the documentation, I get an error stating:
Failed to upload project to Lambda
The operation cannot be performed at this time. An update is in progress for resource arn:aws:lambda:us-east-1:xxxxxxxx:function:my-demo: xxxxxx
(Service: AWSLambda; Status Code 409; Error Code: ResourceConflictException; Request ID: xxxxxx)
If I DO NOT opt-in to the changes, my lambda function can still be uploaded as it has been for the last year, straight from Eclipse. When I choose to opt-in, the lambda function can no longer be updated.
To opt-in
, I simply add aws:states:opt-in
to the function's description (as stated in the documentation I linked)
Hopefully someone with more experience can shed some light on this. Will the lambda functions be okay when December 6th rolls around if I do nothing? Or when December 6th is here, will I have the same issue I have right now, which is that I cannot upload the function from Eclipse anymore?
EDIT: To be more specific, I would like to be able to upload the lambda function to AWS using the Toolkit in Eclipse. This works now, but not when I use aws:states:opt-in
to opt-in. Then it fails to upload. Why? What can I do to upload this function with the new AWS changes that will take effect December 6th?
EDIT #2 A more in-depth view of the error:
It is the same problem as this question that has no answers: SO question
Solution
I decided to not use the Eclispe Toolkit anymore. Instead, I put all of the external jar files inside src/main/resources
and wrote a batch script that will add those files to local maven repo like this. Example of two of the lines in my batch script. I do this for each file:
EHCO starting
CALL mvn install:install-file -Dfile="./src/main/resources/routines.jar" -DgroupId=talend-jars -DartifactId=test-eenav-routine -Dversion=1.0 -Dpackaging=jar
CALL mvn install:install-file -Dfile="./src/main/resources/currenttalendproject_0_1.jar" -DgroupId=talend-jars -DartifactId=test-eenav-main-talend-jar -Dversion=1.0 -Dpackaging=jar
CALL mvn package
At the end of the above of script I call CALL mvn package
which produces my shaded JAR which can be uploaded to AWS Lambda.
Here is the pom file that shows my configuration for shaded plugin as well as the two dependencies I added to the local maven repo:
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
<testSourceDirectory>src/test/java</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
<forceJavacCompilerUse>true</forceJavacCompilerUse>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.2</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<finalName>Demo-SHADED</finalName>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>talend-jars</groupId>
<artifactId>test-eenav-routine</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>talend-jars</groupId>
<artifactId>test-eenav-main-talend-jar</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
Answered By - mastercooler6
Answer Checked By - Dawn Plyler (JavaFixing Volunteer)