• Home
Name Date Size #Lines LOC

..--

src/04-Jul-2025-1,8961,417

README.mdD04-Jul-20253 KiB6550

pom.xmlD04-Jul-20257.4 KiB173146

README.md

1# Maven Archetype for lambda function using AWS SDK for Java 2.x
2
3## Description
4This is an Apache Maven Archetype to create a lambda function template using [AWS Java SDK 2.x][aws-java-sdk-v2]. The generated template
5has the optimized configurations and follows the best practices to reduce start up time.
6
7## Usage
8
9You can use `mvn archetype:generate` to generate a project using this archetype. See [maven archetype usage guidance][maven-archetype-usage] for more information.
10
11- Interactive mode
12
13```
14mvn archetype:generate \
15  -DarchetypeGroupId=software.amazon.awssdk \
16  -DarchetypeArtifactId=archetype-lambda \
17  -DarchetypeVersion=2.x
18```
19
20- Batch mode
21
22```
23mvn archetype:generate \
24    -DarchetypeGroupId=software.amazon.awssdk \
25    -DarchetypeArtifactId=archetype-lambda \
26    -DarchetypeVersion=2.x \
27    -DgroupId=com.test \
28    -DartifactId=sample-project \
29    -Dservice=s3  \
30    -DinteractiveMode=false
31```
32
33### Parameters
34
35Parameter Name | Default Value | Description
36---|---|---
37`service` (required) | n/a | Specifies the service client to be used in the lambda function, eg: s3, dynamodb. You can find available services [here][java-sdk-v2-services].
38`groupId`(required) | n/a | Specifies the group ID of the project
39`artifactId`(required) | n/a | Specifies the artifact ID of the project
40`region` | n/a | Specifies the region to be set for the SDK client in the application
41`httpClient` | url-connection-client | Specifies the http client to be used by the SDK client. Available options are `url-connection-client` (sync), `apache-client` (sync), `netty-nio-client` (async). See [http clients][sdk-http-clients]
42`handlerClassName` | `"App"`| Specifies the class name of the handler, which will be used as the lambda function name. It should be camel case.
43`javaSdkVersion` | Same version as the archetype version | Specifies the version of the AWS Java SDK 2.x to be used
44`version` | 1.0-SNAPSHOT | Specifies the version of the project
45`package` | ${groupId} | Specifies the package name for the classes
46
47### Deployment
48
49To deploy the lambda function, you can use [SAM CLI][sam-cli]. The generated project contains a default [SAM template][sam-template] file `template.yaml` where you can
50configure different properties of your lambda function such as memory size and timeout.
51
52```
53sam deploy --guided
54```
55
56Please refer to [deploying lambda apps][deploying-lambda-apps] for more info.
57
58[aws-java-sdk-v2]: https://github.com/aws/aws-sdk-java-v2
59[java-sdk-v2-services]: https://github.com/aws/aws-sdk-java-v2/tree/master/services
60[sdk-http-clients]: https://github.com/aws/aws-sdk-java-v2/tree/master/http-clients
61[deploying-lambda-apps]: https://docs.aws.amazon.com/lambda/latest/dg/deploying-lambda-apps.html
62[sam-cli]:https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-getting-started.html
63[maven-archetype-usage]: https://maven.apache.org/archetype/maven-archetype-plugin/usage.html
64[sam-template]: https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-function.html
65