Skip to content

IPv6 doesn't work in AWS Lambda in Native mode #49688

@denis-dzenskevich

Description

@denis-dzenskevich

Describe the bug

Hello,

In AmazonLambdaCommonProcessor (quarkus-amazon-lambda extension), "java.net.preferIPv4Stack" is fixed to true, and while in JVM mode it can be set back to "false" later, in native mode, it removes IPv6 support from native executable completely:

    /**
     * Lambda custom runtime does not like ipv6.
     */
    @BuildStep(onlyIf = NativeBuild.class)
    void ipv4Only(BuildProducer<SystemPropertyBuildItem> systemProperty) {
        // lambda custom runtime does not like IPv6
        systemProperty.produce(new SystemPropertyBuildItem("java.net.preferIPv4Stack", "true"));
    }

AWS Lambda didn't support IPv6 in the past, probably that's why this configuration was added, but now IPv6 is supported (you need to enable it for a function and for VPC, if a function is within a VPC). And there are use cases when you'd like to use it (e. g. if your lambda is linked to VPC and you need to access the internet, you may want to use IPv6 "Egress-only Internet Gateway" instead of NAT Gateway to save costs).

I tried to override the value of this property by adding my own extension that would set this property to "false", and the resultant native executable was able to use IPv6 networking correctly.

Would it be possible to make this assignment optional? Maybe introduce some configuration property that will allow to override it? I can prepare a pull request for that

Expected behavior

No response

Actual behavior

No response

How to Reproduce?

No response

Output of uname -a or ver

Linux DESKTOP-6O5TNI8 6.6.84.1-microsoft-standard-WSL2 #1 SMP PREEMPT_DYNAMIC Tue Apr 1 19:37:06 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux

Output of java -version

OpenJDK 64-Bit Server VM GraalVM CE 24.0.1+9.1 (build 24.0.1+9-jvmci-b01, mixed mode, sharing

Mandrel or GraalVM version (if different from Java)

No response

Quarkus version or git rev

5aa5604

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions