class AwsEC2Container extends AwsContainer {

    Runnable autoscalingSelfHealingWrapper (@NotNull Runnable baseMethod) {
        final AtomicBoolean asgSelfHealingRun = new AtomicBoolean(false);
        return isNativeAwsAutoscaling() ? () -> {
            if (asgSelfHealingRun.compareAndSet(false, true)) {
                log.debug("First self healing attempt will use Autoscaling to recreate");
                awsEC2Platform.triggerAutoscalingUnhealthy(instanceId);
                return;
            }
            baseMethod.run();
        } : baseMethod;
    }

    private  AwsEC2Container();

}