Powertools for AWS Lambda (Java) 2.0.0 π
We are super happy to announce our new major version β v2.0.0 ππ!
We've made Java ecosystem integration the focus of this release, with a complete redesign of the Logging utility to support popular Java logging paradigms and improved modularity across all utilities to reduce deployment package size.
π We couldn't have done this without you π
Thanks to everyone in the community for their patience and assistance as we've been working on this release. Your feedback has been invaluable in shaping this major update.
A special thanks to @jeromevdl and @scottgerring for their amazing contributions to this milestone.
We care deeply about minimizing breaking changes
Over the past few months, we carefully selected each breaking change to make, and crafted an extensive upgrade guide to ease your transition to v2. Please let us know whether we can make your upgrade process easier.
What's New in v2 β¨
Java Version Support π
- Minimum required Java version is now Java 11 (Java 8 support has been removed)
Redesigned Logging Utility π
- Complete redesign to support popular Java logging paradigms
- Now supports
slf4j
as logging interface with choice oflog4j2
orlogback
implementations - Replaced
LambdaJsonLayout
with standardJsonTemplateLayout
- Uses native
slf4j
primitives for better integration with Java ecosystem
The new logging utility introduces advanced structured argument serialization features, allowing for more expressive and detailed logging. You can now easily add structured context to your log messages:
// Before v2
private static final Logger LOGGER = LogManager.getLogger(PaymentFunction.class);
LoggingUtils.appendKey("cardNumber", card.getId());
// After v2
private static final Logger LOGGER = LoggerFactory.getLogger(PaymentFunction.class);
MDC.put("cardNumber", card.getId());
// Add structured data directly in log messages
LOGGER.info("Collecting payment", StructuredArguments.entry("orderId", order.getId()));
// { "message": "Collecting payment", ..., "orderId": 123}
// Add multiple structured fields at once
Map<String, String> customKeys = new HashMap<>();
customKeys.put("paymentId", payment.getId());
customKeys.put("amount", payment.getAmount());
LOGGER.info("Payment successful", StructuredArguments.entries(customKeys));
// { "message": "Payment successful", ..., "paymentId": 123, "amount": 12.99}
Updated Metrics Utility π
- Redesigned to be more modular and support multiple metrics providers
@Metrics
annotation renamed to@FlushMetrics
MetricsLogger.metricsLogger()
renamed toMetricsFactory.getMetricsInstance()
put
methods replaced withadd
methods (e.g.,putMetric()
βaddMetric()
)
This update also brings feature parity with other Powertools for AWS Lambda runtimes, ensuring a consistent experience across Python, TypeScript, .NET, and Java implementations.
// Before v2
@Metrics(namespace = "ExampleApplication", service = "booking")
metricsLogger.putMetric("SuccessfulBooking", 1, Unit.COUNT);
// After v2
@FlushMetrics(namespace = "ExampleApplication", service = "booking")
metrics.addMetric("SuccessfulBooking", 1, MetricUnit.COUNT);
Tracing Updates π
- Removed deprecated
captureResponse
andcaptureError
parameters from@Tracing
annotation - Replaced with new
captureMode
parameter
// Before v2
@Tracing(captureError = false, captureResponse = false)
// After v2
@Tracing(captureMode = CaptureMode.DISABLED)
Parallel Batch Processing β‘
- New support for processing batch items in parallel using
processBatchInParallel()
- Available for SQS, Kinesis, and DynamoDB Streams (not supported for SQS FIFO queues)
- Automatically propagates logging context to each worker thread
- Improves throughput for IO-bound workloads
// Before v2 - Sequential processing
return handler.processBatch(sqsEvent, context);
// After v2 - Parallel processing
return handler.processBatchInParallel(sqsEvent, context);
The batch processing utility now intelligently handles logging context propagation across worker threads, ensuring that your structured logging context is maintained in parallel execution environments. This makes it easier to trace and debug parallel batch operations while maintaining the same logging experience as sequential processing.
Modularized Utilities π¦
- Idempotency: Split into sub-modules by provider to improve modularity
- Parameters: Split into sub-modules by provider to reduce deployment package size
- SQS: Removed
powertools-sqs
module in favor of the more genericpowertools-batch
utility
Custom Resources Updates π
- Removed deprecated
Response.failed()
andResponse.success()
methods - Now require physical resource ID parameter
// Before v2
return Response.success();
return Response.failed();
// After v2
return Response.success(physicalResourceId);
return Response.failed(physicalResourceId);
Validation Improvements β
The Validation utility now better integrates with other utilities from the library, providing a more cohesive experience when combining multiple Powertools features in your applications.
- Returns
4xx
error codes instead of5xx
when used with API Gateway, aligning with HTTP standards - Validating batch event sources now adds failed events as partial batch failures instead of failing the whole batch, improving resilience
Dependencies π
- AspectJ runtime no longer included by default β must be added as a dependency
- Renamed
powertools-core
topowertools-common
Backwards incompatible changes
Area | Change | Code Change Required |
---|---|---|
Logging | The logging module was re-designed from scratch to support popular Java logging paradigms | Yes |
Metrics | Changed public interface to remove direct coupling with aws-embedded-metrics-java |
Yes |
Tracing | Removed deprecated captureResponse and captureError options on @Tracing annotation |
Yes |
Idempotency | The powertools-idempotency module was split by provider |
Yes |
Parameters | The powertools-parameters module was split by provider |
Yes |
Batch Processing | Removed deprecated powertools-sqs module in favor of the more generic Batch Processing utility |
Yes |
Custom Resources | Removed deprecated Response.failed() and Response.success() methods |
Yes |
Dependencies | AspectJ runtime not included by default anymore | Yes |
Language support | Removed support for Java 8. The minimum required Java version is Java 11 | N/A |
Migration Guide
For detailed migration instructions, please refer to our upgrade guide.
We've made minimal breaking changes to make your transition to v2 as smooth as possible. The upgrade guide provides step-by-step instructions for each utility.
Thank you for using Powertools for AWS Lambda (Java)! We're committed to helping you build better serverless applications with less code. β€οΈ
Changes
- chore: Start V2 branch by @scottgerring in #1346
- chore: v2 - fix version by @scottgerring in #1348
- chore: V2 update from main by @scottgerring in #1365
- chore: [V2] rename 'core' module to 'common' by @scottgerring in #1364
- chore: update v2 by @jeromevdl in #1409
- chore: remove aspectj-rt from the library by @jeromevdl in #1408
- fix: add aspectj-rt to batch e2e by @jeromevdl in #1410
- chore: Merge main into v2 by @scottgerring in #1477
- chore(v2): Merge main by @scottgerring in #1492
- chore: merge main into v2 by @jeromevdl in #1494
- chore(v2): clean examples by @jeromevdl in #1495
- chore: removing dynamodb local from examples by @jdoherty in #1507
- chore: Periodic merge of main into v2 by @scottgerring in #1525
- chore: remove Java 8 from v2 examples by @jdoherty in #1531
- feat(v2): Validation failures return 400s by @skal111 in #1489
- chore: fix end 2 end build by @jeromevdl in #1534
- chore(v2): Split parameters module up by parameter provider by @scottgerring in #1403
- feat(v2): new logging module by @jeromevdl in #1435
- chore: cleanup poms and reduce warning noise by @jdoherty in #1535
- chore: Support spotbugs running anywhere by @scottgerring in #1537
- fix(v2): Removing LambdaJsonLayout from logging config in examples by @ritigupt in #1545
- fix(v2): Fix params builder to provide default transformation manager by @ritigupt in #1549
- build(deps): bump com.fasterxml.jackson from 2.15.3 to 2.16.0 and com.amazonaws.xray from 2.14.0 to 2.15.0 by @subhash686 in #1556
- chore(v2): Split powertools idempotency module (without redis impl) by @scottgerring in #1559
- docs(v2): Update README.md by @scottgerring in #1560
- chore(v2): Merge down from main by @scottgerring in #1574
- chore(v2): Fix build by @scottgerring in #1575
- chore(v2): Fix IaC lint by @scottgerring in #1576
- build(deps): bump org.apache.maven.plugins:maven-artifact-plugin from 3.4.1 to 3.5.0 by @dependabot in #1567
- build(deps): bump aws.sdk.version from 2.21.0 to 2.24.5 by @dependabot in #1566
- build(deps): bump org.assertj:assertj-core from 3.24.2 to 3.25.3 by @dependabot in #1565
- build(deps): bump org.apache.maven.plugins:maven-javadoc-plugin from 3.6.0 to 3.6.3 by @dependabot in #1564
- build(deps): bump aws.xray.recorder.version from 2.15.0 to 2.15.1 by @dependabot in #1577
- build(deps): bump aws.sdk.version from 2.21.1 to 2.24.10 by @dependabot in #1580
- chore(v2): e2e tests by @scottgerring in #1571
- feat: advanced logging by @jeromevdl in #1539
- build(deps): bump commons-io:commons-io from 2.13.0 to 2.15.1 by @dependabot in #1590
- build(deps): bump aws.sdk.version from 2.24.5 to 2.25.1 by @dependabot in #1595
- build(deps): bump aws.sdk.version from 2.25.1 to 2.25.6 by @dependabot in #1600
- chore(v2): merge main down by @scottgerring in #1608
- build(deps): bump org.junit.jupiter:junit-jupiter-api from 5.9.3 to 5.10.2 by @dependabot in #1611
- chore(v2): document use of aws-crt-client (#1092) by @jreijn in #1605
- build(deps): bump jackson.version from 2.16.0 to 2.17.0 by @dependabot in #1615
- build(deps): bump co.elastic.logging:logback-ecs-encoder from 1.5.0 to 1.6.0 by @dependabot in #1617
- build(deps): bump aws.sdk.version from 2.25.6 to 2.25.21 by @dependabot in #1618
- build(deps): bump aws.sdk.version from 2.24.10 to 2.25.26 by @dependabot in #1623
- build(deps): bump ch.qos.logback:logback-classic from 1.3.4 to 1.5.5 by @dependabot in #1626
- build(deps): bump com.github.spotbugs:spotbugs-maven-plugin from 4.7.3.6 to 4.8.4.0 by @dependabot in #1627
- build(deps): bump org.junit:junit-bom from 5.10.0 to 5.10.2 by @dependabot in #1628
- build(deps): bump log4j.version from 2.20.0 to 2.23.1 by @dependabot in #1630
- build(deps): bump aws.sdk.version from 2.25.21 to 2.25.35 by @dependabot in #1631
- build(deps): bump dev.aspectj:aspectj-maven-plugin from 1.13.1 to 1.14 by @dependabot in #1632
- build(deps): bump org.codehaus.mojo:exec-maven-plugin from 3.2.0 to 3.3.0 by @dependabot in #1645
- build(deps): bump org.apache.maven.plugins:maven-deploy-plugin from 3.1.1 to 3.1.2 by @dependabot in #1647
- build(deps): bump org.apache.maven.plugins:maven-shade-plugin from 3.5.0 to 3.6.0 by @dependabot in #1648
- build(deps): bump org.apache.maven.plugins:maven-jar-plugin from 3.3.0 to 3.4.1 by @dependabot in #1649
- build(deps): bump org.apache.maven.plugins:maven-compiler-plugin from 3.11.0 to 3.13.0 by @dependabot in #1651
- build(deps): bump org.jacoco:jacoco-maven-plugin from 0.8.10 to 0.8.12 by @dependabot in #1656
- feat(v2): publish snapshots by @scottgerring in #1655
- build(deps): bump org.apache.maven.plugins:maven-gpg-plugin from 3.1.0 to 3.2.4 by @dependabot in #1634
- build(deps): bump com.amazonaws:aws-lambda-java-serialization from 1.1.2 to 1.1.5 by @dependabot in #1636
- build(deps): bump commons-io:commons-io from 2.15.1 to 2.16.1 by @dependabot in #1635
- build(deps-dev): bump com.amazonaws:amazon-sqs-java-extended-client-lib from 2.0.4 to 2.1.0 by @dependabot in #1650
- build(deps): bump aws.sdk.version from 2.25.26 to 2.26.7 by @dependabot in #1660
- build(deps): bump software.amazon.payloadoffloading:payloadoffloading-common from 2.1.3 to 2.2.0 by @dependabot in #1661
- build(deps): bump jackson.version from 2.17.0 to 2.17.1 by @dependabot in #1664
- feat: upgraded embedded metrics library for high resolution metrics by @jdoherty in #1550
- build(deps): bump aws.xray.recorder.version from 2.15.1 to 2.16.0 by @dependabot in #1662
- chore(v2): remove java 1.8 relics from the code by @jeromevdl in #1659
- build(deps): bump aws.sdk.version from 2.25.35 to 2.26.12 by @dependabot in #1681
- build(deps): bump org.apache.maven.plugins:maven-javadoc-plugin from 3.6.3 to 3.7.0 by @dependabot in #1683
- build(deps): bump org.sonatype.plugins:nexus-staging-maven-plugin from 1.6.13 to 1.7.0 by @dependabot in #1682
- build(deps): bump com.networknt:json-schema-validator from 1.0.87 to 1.4.3 by @justin-tay in #1674
- chore(v2): remove deprecated code by @jeromevdl in #1624
- feat(v2): parallel batch processing by @jeromevdl in #1620
- build(deps): bump org.assertj:assertj-core from 3.25.3 to 3.26.3 by @dependabot in #1695
- build(deps): bump com.networknt:json-schema-validator from 1.4.3 to 1.5.1 by @dependabot in #1705
- build(deps): bump jackson.version from 2.17.1 to 2.17.2 by @dependabot in #1688
- build(deps): bump org.apache.commons:commons-lang3 from 3.13.0 to 3.15.0 by @dependabot in #1699
- build(deps): bump aws.sdk.version from 2.25.35 to 2.26.28 by @dependabot in #1707
- build(deps): bump ch.qos.logback:logback-classic from 1.5.5 to 1.5.7 by @dependabot in #1718
- build(deps-dev): bump software.amazon.awscdk:aws-cdk-lib from 2.130.0 to 2.154.1 by @dependabot in #1723
- build(deps): bump aws.xray.recorder.version from 2.16.0 to 2.18.1 by @dependabot in #1727
- build(deps): bump com.puppycrawl.tools:checkstyle from 10.12.3 to 10.18.1 by @dependabot in #1728
- build(deps): bump aws.sdk.version from 2.26.28 to 2.27.17 by @dependabot in #1729
- build(deps): bump aws.sdk.version from 2.27.17 to 2.27.21 by @dependabot in #1733
- build(deps): bump aws.sdk.version from 2.27.21 to 2.28.1 by @dependabot in #1736
- build(deps-dev): bump software.amazon.awscdk:aws-cdk-lib from 2.154.1 to 2.158.0 by @dependabot in #1737
- build(deps): bump org.junit.jupiter:junit-jupiter-api from 5.10.2 to 5.11.1 by @dependabot in #1743
- build(deps-dev): bump org.junit.jupiter:junit-jupiter from 5.10.0 to 5.11.1 by @dependabot in #1744
- build(deps-dev): bump software.amazon.awscdk:aws-cdk-lib from 2.158.0 to 2.162.1 by @dependabot in #1749
- build(deps): bump log4j.version from 2.23.1 to 2.24.3 by @dependabot in #1783
- build(deps): bump aws.sdk.version from 2.26.12 to 2.30.31 by @dependabot in #1782
- feat(v2): Add GraalVM reachability metadata for core utilities by @rr-on-gh in #1753
- feat(cfn-custom-resource): Add optional 'reason' field for detailed failure reporting by @phipag in #1810
- feat(idempotency): Add response hook feature by @phipag in #1814
- ci: Fix infrastructure deployment and assertions in end-to-end tests. by @phipag in #1816
- docs: v2 documentation maintenance fixing formatting and dependency issues as well as adding roadmap and llms.txt by @phipag in #1819
- feat(idempotency): Add support for ReturnValuesOnConditionCheckFailure in Idempotency. by @phipag in #1821
- fix(logging): Prevent accidental overwriting of reserved keys via structured arguments by @phipag in #1822
- build(deps-dev): bump org.yaml:snakeyaml from 2.2 to 2.4 by @dependabot in #1798
- build(deps): bump com.amazonaws:aws-lambda-java-events from 3.11.2 to 3.15.0 by @dependabot in #1799
- build(deps): bump org.apache.maven.plugins:maven-checkstyle-plugin from 3.3.0 to 3.6.0 by @dependabot in #1751
- chore(automation): Update automation workflows (#1779) by @sthulb in #1830
- fix(ci): Update control flow to allow for better skipping of things by @sthulb in #1831
- fix(ci): Set user/pass for publishing to maven central by @sthulb in #1832
- build(deps): bump com.github.tomakehurst:wiremock-jre8 from 2.35.1 to 2.35.2 by @dependabot in #1741
- build(deps): bump org.skyscreamer:jsonassert from 1.5.1 to 1.5.3 by @dependabot in #1750
- build(deps): bump org.apache.maven.plugins:maven-javadoc-plugin from 3.7.0 to 3.11.2 by @dependabot in #1827
- build(deps): bump org.mockito:mockito-subclass from 5.6.0 to 5.17.0 by @dependabot in #1825
- build(deps): bump aws.sdk.version from 2.28.1 to 2.31.40 by @dependabot in #1840
- build(deps): bump org.apache.maven.plugins:maven-gpg-plugin from 3.2.4 to 3.2.7 by @dependabot in #1841
- build(deps): bump org.apache.maven.plugins:maven-jar-plugin from 3.4.1 to 3.4.2 by @dependabot in #1842
- build(deps): bump org.apache.maven.plugins:maven-artifact-plugin from 3.5.0 to 3.6.0 by @dependabot in #1843
- build(deps): bump org.apache.maven.plugins:maven-failsafe-plugin from 3.1.2 to 3.5.3 by @dependabot in #1844
- feat(v2): batch validation with partial failure by @jeromevdl in #1621
- fix(logging): Escape double-quotes when serializing strings into JSON. by @phipag in #1845
- feat(v2): GraalVM support for parameters module by @jreijn in #1824
- docs(v2): Create upgrade guide and versioning policy by @phipag in #1856
- chore(ci): Publish to Maven Central instead of OSSRH instance by @phipag in #1858
- fix(ci): Fix failing E2E tests and temporarily exclude TracingE2E by @phipag in #1847
- chore(ci): Set snapshot repository to "central" server ID by @phipag in #1859
- feat(metrics): New metrics module implementation with support for Metrics providers and usage without annotations by @phipag in #1863
- docs(metrics): Add upgrade guide for re-designed Metrics utility by @phipag in #1868
- chore(v2): Remove rule preventing production release of 2.0.0 by @phipag in #1867
- fix(ci): Checkout repo on doc release by @sthulb in #1869
- fix: Add maven central required information to pom.xml by @phipag in #1871
- fix: Add required maven central properties by @phipag in #1872
- chore(ci): bump version to 2.0.0-RC1 by @github-actions in #1875
New Contributors
- @ritigupt made their first contribution in #1545
- @subhash686 made their first contribution in #1556
- @justin-tay made their first contribution in #1674
- @rr-on-gh made their first contribution in #1753
Full Changelog: v1.20.2...v2.0.0