GitHub - aws-powertools/powertools-lambda-java: Powertools is a developer toolkit to implement Serverless best practices and increase developer velocity. (original) (raw)
Powertools for AWS Lambda (Java)
Powertools for AWS Lambda (Java) is a developer toolkit to implement Serverless best practices and increase developer velocity.
Also available in Python, TypeScript, and .NET.
📜Documentation | Feature request | 🐛Bug Report | Detailed blog post
Installation
Powertools for AWS Lambda (Java) is available in Maven Central. You can use your favourite dependency management tool to install it
Maven:
... software.amazon.lambda powertools-tracing 2.9.0 software.amazon.lambda powertools-logging-log4j 2.9.0 software.amazon.lambda powertools-metrics 2.9.0 ...Next, configure the aspectj-maven-plugin to compile-time weave (CTW) the aws-lambda-powertools-java aspects into your project.
Maven
... dev.aspectj aspectj-maven-plugin 1.14 11 11 11 software.amazon.lambda powertools-logging software.amazon.lambda powertools-tracing software.amazon.lambda powertools-metrics org.aspectj aspectjtools 1.9.22 compile ...Gradle
plugins {
id 'java'
id 'io.freefair.aspectj.post-compile-weaving' version '8.2.2'
}
// the freefair aspect plugins targets gradle 8.2.1
// https://docs.freefair.io/gradle-plugins/8.2.2/reference/
wrapper {
gradleVersion = "8.2.1"
}
repositories {
mavenCentral()
}
dependencies {
aspect 'software.amazon.lambda:powertools-logging:{{ powertools.version }}'
aspect 'software.amazon.lambda:powertools-tracing:{{ powertools.version }}'
aspect 'software.amazon.lambda:powertools-metrics:{{ powertools.version }}'
implementation 'software.amazon.lambda:powertools-logging-log4j:{{ powertools.version }}'
implementation "org.aspectj:aspectjrt:1.9.22"
}
sourceCompatibility = 11
targetCompatibility = 11Java Compatibility
Powertools for AWS Lambda (Java) supports all Java versions from 11 to 25 in line with the corresponding Lambda runtimes.
For the modules that provide annotations, Powertools for AWS Lambda (Java) leverages the aspectj library. You may need to add the appropriate version of aspectjrt to your dependencies based on the JDK used for building your function:
JDK - aspectj dependency matrix
Use the following dependency matrix to understand which AspectJ version to use based on your JDK version:
| JDK version | aspectj version |
|---|---|
| 11-17 | 1.9.20.1 (or higher) |
| 21 | 1.9.21 (or higher) |
| 25 | 1.9.25 (or higher) |
Examples
See the latest release of the examples for example projects showcasing usage of different utilities.
Have a demo project to contribute which showcase usage of different utilities from powertools? We are happy to accept it here.
How to support Powertools for AWS Lambda (Java)?
Becoming a reference customer
Knowing which companies are using this library is important to help prioritize the project internally. If your company is using Powertools for AWS Lambda (Java), you can request to have your name and logo added to the README file by raising a Support Powertools for AWS Lambda (Java) (become a reference) issue.
The following companies, among others, use Powertools:
Connect
- Powertools for AWS Lambda on Discord:
#java- Invite link - Email: aws-powertools-maintainers@amazon.com
Security disclosures
If you think you’ve found a potential security issue, please do not post it in the Issues. Instead, please follow the instructions here or email AWS security directly.
License
This library is licensed under the MIT-0 License. See the LICENSE file.