public static AwsCredentialsProvider create(boolean isCloud,
                                                @Nullable String stsRegion,
                                                @Nullable String accessKey,
                                                @Nullable String secretKey,
                                                @Nullable String assumeRoleArn) {
        AwsCredentialsProvider awsCredentials = isCloud ? getCloudAwsCredentialsProvider(accessKey, secretKey) :
                getAwsCredentialsProvider(accessKey, secretKey);

        // Apply the Assume Role ARN Authorization if specified. All AWSCredentialsProviders support this.
        if (!isNullOrEmpty(assumeRoleArn) && !isNullOrEmpty(stsRegion)) {
            LOG.debug("Creating cross account assume role credentials");
            return buildStsCredentialsProvider(awsCredentials, stsRegion, assumeRoleArn, accessKey);
        }

        return awsCredentials;
    }
@Test
    public void testAutomaticAuthIsFailingInCloudWithInvalidAccessKey() {
        assertThatExceptionOfType(IllegalArgumentException.class).isThrownBy(() ->
                        AWSAuthFactory.create(true, null, null, "secret", null))
                .withMessageContaining("Access key");
    }