I do not want to hardcode region id and pass region name as String from command line. Is there a way to do that? Hardcoding:
Region s3Region = Region.getRegion(Regions.US_EAST_1);
Non Hardcoded but not working:
Region s3Region = Region.getRegion(Regions.fromName(awsRegion));
Answering the question that I think you mean to ask:
If you have an Amazon region name like, for example, "us-east-1" then you can easily convert it to a RegionEndpoint:
RegionEndpoint endpoint = Amazon.RegionEndpoint.GetBySystemName("us-east-1");
May its very late to reply but Regions.valueOf(awsRegion) should help! So full code should be :
Region s3Region = Region.getRegion(Regions.valueOf(awsRegion.toUpperCase()));
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With