class Aws::CredentialProviderChain

def assume_role_with_profile(options, profile_name)

def assume_role_with_profile(options, profile_name)
  assume_opts = {
    profile: profile_name,
    chain_config: @config
  }
  if options[:config] && options[:config].region
    assume_opts[:region] = options[:config].region
  end
  Aws.shared_config.assume_role_credentials_from_config(assume_opts)
end