Map<String, String> describeInstances(AwsCredentials credentials) {
        Map<String, String> attributes = createAttributesDescribeInstances();
        Map<String, String> headers = createHeaders(attributes, credentials);
        String response = callAwsService(attributes, headers);
        return parseDescribeInstances(response);
    }
@Test
    public void describeInstances() {
        // given
        String requestUrl = "/?Action=DescribeInstances"
            + "&Filter.1.Name=tag%3Aaws-test-cluster"
            + "&Filter.1.Value.1=cluster1"
            + "&Filter.2.Name=tag-key"
            + "&Filter.2.Value.1=another-tag-key"
            + "&Filter.3.Name=instance.group-name"
            + "&Filter.3.Value.1=hazelcast"
            + "&Filter.4.Name=instance-state-name&Filter.4.Value.1=running"
            + "&Version=2016-11-15";

        //language=XML
        String response = """
                <?xml version="1.0" encoding="UTF-8"?>
                <DescribeInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2016-11-15/">
                    <reservationSet>
                        <item>
                            <instancesSet>
                                <item>
                                    <privateIpAddress>10.0.1.25</privateIpAddress>
                                    <ipAddress>54.93.121.213</ipAddress>
                                    <tagSet>
                                        <item>
                                            <key>kubernetes.io/cluster/openshift-cluster</key>
                                            <value>openshift-cluster-eu-central-1</value>
                                        </item>
                                        <item>
                                            <key>Name</key>
                                            <value>* OpenShift Node 1</value>
                                        </item>
                                    </tagSet>
                                </item>
                            </instancesSet>
                        </item>
                        <item>
                            <instancesSet>
                                <item>
                                    <privateIpAddress>172.31.14.42</privateIpAddress>
                                    <ipAddress>18.196.228.248</ipAddress>
                                    <tagSet>
                                        <item>
                                            <key>Name</key>
                                            <value>rafal-ubuntu-2</value>
                                        </item>
                                    </tagSet>
                                </item>
                            </instancesSet>
                        </item>
                    </reservationSet>
                </DescribeInstancesResponse>""";

        stubFor(get(urlEqualTo(requestUrl))
            .withHeader("X-Amz-Date", equalTo("20200403T102518Z"))
            .withHeader("Authorization", equalTo(AUTHORIZATION_HEADER))
            .withHeader("X-Amz-Security-Token", equalTo(TOKEN))
            .willReturn(aResponse().withStatus(HttpURLConnection.HTTP_OK).withBody(response)));

        // when
        Map<String, String> result = awsEc2Api.describeInstances(CREDENTIALS);

        // then
        assertEquals(2, result.size());
        assertEquals("54.93.121.213", result.get("10.0.1.25"));
        assertEquals("18.196.228.248", result.get("172.31.14.42"));
    }