Skip to content

Java Lambda Archetype Broken (and out of date) #6115

Open
@luketn

Description

@luketn

Describe the bug

When I tried to create the archetype for a Java lambda this morning, I got the error:

The desired archetype does not exist (software.amazon.awssdk:archetype-lambda:2.x)

In addition, the archetype hasn't been updated for several years.

It would be really useful to see an up to date version using Java 21 and your latest recommendations and best practices for a high-performing low latency cold start Java lambda.

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

The archetype should generate a working lambda demonstrating the latest best practice for using the AWS SDK within a Java lambda.

I got to this page BTW after creating my own Java lambda using the default AWS SDK imports as documented and seeing absolutely abysmal performance. (4s to upload a 5 byte object to a bucket in the same region)

After profiling the lambda locally I saw that much of the time was initialising Apache Http client and TLS.

After switching to use the aws-crt implementation for http clients, this was radically improved:

S3Client.builder()
                        .region(Region.of(System.getenv(SdkSystemSetting.AWS_REGION.environmentVariable())))
                        .credentialsProvider(EnvironmentVariableCredentialsProvider.create())
                        .httpClient(AwsCrtHttpClient.builder().build())
                        .build();

Performance Improvement (Cold Start S3 Uploads):
Before (Apache client): Average 3,984 ms
After (CRT client): Average 2,806.5 ms
Improvement:
Absolute decrease: 1177.5 ms
Percentage improvement: ≈ 29.6% faster
Warm Starts: No significant change (remained around 22–25 ms).

I'm not sure if CRT is faster than Netty NIO with the special version mentioned here or not - I'd appreciate your advice.

Current Behavior

The archetype fails to create a project

Reproduction Steps

mvn archetype:generate \
    -DarchetypeGroupId=software.amazon.awssdk \
    -DarchetypeArtifactId=archetype-lambda \
    -DarchetypeVersion=2.x \
    -DgroupId=com.test \
    -DartifactId=sample-project \
    -Dservice=s3  \
    -DinteractiveMode=false

or

mvn archetype:generate \
  -DarchetypeGroupId=software.amazon.awssdk \
  -DarchetypeArtifactId=archetype-lambda \
  -DarchetypeVersion=2.x

Possible Solution

No response

Additional Information/Context

No response

AWS Java SDK version used

na

JDK version used

na

Operating System and version

Mac OS Sequoia 15.4.1

Metadata

Metadata

Assignees

Labels

documentationThis is a problem with documentation.p3This is a minor priority issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions