def region_from_sts_endpoint(sts_endpoint)
      valid_sts_endpoint = %r{https:\/\/sts\.?(.*).amazonaws.com}.match(sts_endpoint)
      raise "Unable to parse STS endpoint #{sts_endpoint}" unless valid_sts_endpoint
      valid_sts_endpoint[1].empty? ? 'us-east-1' : valid_sts_endpoint[1]
    end
def region_from_sts_endpoint(sts_endpoint)
      valid_sts_endpoint = %r{https:\/\/sts\.?(.*).amazonaws.com}.match(sts_endpoint)
      raise "Unable to parse STS endpoint #{sts_endpoint}" unless valid_sts_endpoint
      valid_sts_endpoint[1].empty? ? 'us-east-1' : valid_sts_endpoint[1]
    end
Parse an AWS region from a STS endpoint
 STS in the China (Beijing) region (cn-north-1) is sts.cn-north-1.amazonaws.com.cn
 Take care changing below regex with that edge case in mind

 @param [String] sts_endpoint
   https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html

 @return [String] aws region