ingenieux / awseb-deployment-plugin

Jenkins Plugin for AWS Elastic Beanstalk
Apache License 2.0
29 stars 53 forks source link

South Africa Region : af-south-1 not supported or causes error #99

Open jadam opened 4 years ago

jadam commented 4 years ago

Hi Developers,

The South African region was added in April 2020 and i don't the plugin has support for this region or there might be an error with the "AWS Credentials and Region" validation section

For Example : On the form AWS Credentials and Region we added the "af-south-1" region and clicked validate, which outputs the following error :

Failure java.net.UnknownHostException: s3-af-south-1.amazonaws.com at java.net.InetAddress.getAllByName0(InetAddress.java:1281)

The endpoint mentioned above does not exists s3-af-south-1.amazonaws.com.

The correct endpoint would be s3.af-south-1.amazonaws.com

The generated dash is causing the issue.

Kindest Regards. --Jameel

jadam commented 4 years ago

Hi,

I've added a code block to cater for our South African region "af-south-1", but need to test it.

Will verify once i get maven installed and re-compile the plugin, then test in Jenkins.

Here's the code i added to the AWSClientFactory.java file

        if (region.startsWith("af-")) {
            if (endpointStr.matches("s3-af-\\p{Alpha}+-\\d.amazonaws.com")) {
                endpointStr = endpointStr.replaceFirst("s3-af-", "s3.af-");
            }
        }
aldrinleal commented 4 years ago

Hi,

I've added a code block to cater for our South African region "af-south-1", but need to test it.

Will verify once i get maven installed and re-compile the plugin, then test in Jenkins.

Here's the code i added to the AWSClientFactory.java file

        if (region.startsWith("af-")) {
            if (endpointStr.matches("s3-af-\\p{Alpha}+-\\d.amazonaws.com")) {
                endpointStr = endpointStr.replaceFirst("s3-af-", "s3.af-");
            }
        }

Make it a PR. Thanks