private AuthConfig readAwsCredentials(CloseableHttpClient client, HttpGet request) throws IOException {
        try (CloseableHttpResponse response = client.execute(request)) {
            if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) {
                log.debug("No security credential found, return code was %d",
                        response.getStatusLine().getStatusCode());
                // no instance role found
                return null;
            }

            // read instance role
            try (Reader r = new InputStreamReader(response.getEntity().getContent(), StandardCharsets.UTF_8)) {
                JsonObject securityCredentials = new Gson().fromJson(r, JsonObject.class);

                String user = securityCredentials.getAsJsonPrimitive("AccessKeyId").getAsString();
                String password = securityCredentials.getAsJsonPrimitive("SecretAccessKey").getAsString();
                String token = securityCredentials.getAsJsonPrimitive("Token").getAsString();

                log.debug("Received temporary access key %s...", user.substring(0, 8));
                return new AuthConfig(user, password, "none", token);
            }
        }
    }
Try using the AWS credentials provided via ENV variables.
See https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html
src/main/java/io/fabric8/maven/docker/util/AuthConfigFactory.java