basil It took me a while, but I found the issue. Our controller node is in another region than the agents we are launching. There are places in the code where we pass the default EC2 endpoint (when no override is set). This does not work without a region in a cross-region context.
I fixed it so that we get the first of: the override endpoint (if provided), the endpoint with the region (if a region has been provided), or the default region-less endpoint.
I tested a local build with my changes on our former production instance and it works. I tested the "Test Connection" and "Check AMI" buttons, the population of the regions in the dropdown, launching instances in the same account/region (instance profile), and launching instances in a different account and region (instance profile + role).
My changes are here: https://github.com/coveord/ec2-plugin/tree/fix/JENKINS-73640. Like last time, I made them on top of your branch, so they should merge without issues. Bear in mind I'm more of a Python developer, so I might have made some changes that are not idiomatic. I also left a TODO in the code (I don't know how regions work in Eucalyptus).
Happy holidays!
dduportal That sounds great! When you're ready, you should be able to install the latest incremental build from https://github.com/jenkinsci/ec2-plugin/pull/1021. Please also ensure that the aws-credentials, aws-global-configuration, and AWS Java SDK 2 plugins are all upgraded to the latest versions (and aws-java-sdk2-sts is uninstalled). I can debug any issues related to the v2 upgrade, but I won't be able to help with issues that are also present in the v1 SDK.