micronaut-projects / micronaut-aws

Projects specific to integrating Micronaut and Amazon Web Services (AWS)
Apache License 2.0
85 stars 79 forks source link

Environment deduction is unreliable in ECS Fargate #1183

Open lightbody opened 2 years ago

lightbody commented 2 years ago

Expected Behavior

The code in question is here, it seems:

    private static boolean isEC2Linux() {
        if (readFile(EC2_LINUX_HYPERVISOR_FILE).startsWith("ec2")) {
            return true;
        } else if (readFile(EC2_LINUX_BIOS_VENDOR_FILE).toLowerCase().startsWith("amazon ec2")) {
            return true;
        }

        return false;
    }

Basically, we are finding in the real world in the last week or so this will return true or false seemingly randomly. I suspect the underlying infrastructure is getting shifted around behind the scenes.

Regardless, I would expect that in all forms of ECS the auto-detection for AMAZON_EC2 works, or a new AMAZON_ECS option is introduced that can deal with the nuances there.

Actual Behaviour

No response

Steps To Reproduce

No response

Environment Information

No response

Example Application

No response

Version

2.5.11

sdelamo commented 2 years ago

@lightbody the workaround would be to disable environment deduction and configure the environments you require explicitely.