AwsCredentials credentialsEc2(String iamRole) {
        String uri = ec2MetadataEndpoint.concat(SECURITY_CREDENTIALS_URI).concat(iamRole);
        String response = metadataClient(uri, awsConfig).get().getBody();
        return parseCredentials(response);
    }
@Test
    public void credentialsEc2() {
        // given
        String iamRole = "some-iam-role";
        String response = """
                {
                  "Code": "Success",
                  "AccessKeyId": "Access1234",
                  "SecretAccessKey": "Secret1234",
                  "Token": "Token1234",
                  "Expiration": "2020-03-27T21:01:33Z"
                }""";
        stubFor(get(urlEqualTo(String.format("/iam/security-credentials/%s", iamRole)))
            .willReturn(aResponse().withStatus(HttpURLConnection.HTTP_OK).withBody(response)));

        // when
        AwsCredentials result = awsMetadataApi.credentialsEc2(iamRole);

        // then
        assertEquals("Access1234", result.getAccessKey());
        assertEquals("Secret1234", result.getSecretKey());
        assertEquals("Token1234", result.getToken());
    }