def create_credential_resolver(session):
 profile_name = (session.get_config_variable('profile') or 'default')
 credential_file = session.get_config_variable('credentials_file')
 config_file = session.get_config_variable('config_file')
 metadata_timeout = session.get_config_variable('metadata_service_timeout')
 num_attempts = session.get_config_variable('metadata_service_num_attempts')
 env_provider = EnvProvider()
 providers = [env_provider, AssumeRoleProvider(load_config=(lambda : session.full_config), client_creator=session.create_client, cache={}, profile_name=profile_name), SharedCredentialProvider(creds_filename=credential_file, profile_name=profile_name), ConfigProvider(config_filename=config_file, profile_name=profile_name), OriginalEC2Provider(), BotoProvider(), ContainerProvider(), InstanceMetadataProvider(iam_role_fetcher=InstanceMetadataFetcher(timeout=metadata_timeout, num_attempts=num_attempts))]
 explicit_profile = session.get_config_variable('profile', methods=('instance',))
 if (explicit_profile is not None):
  providers.remove(env_provider)
  logger.debug('Skipping environment variable credential check because profile name was explicitly set.')
 resolver = CredentialResolver(providers=providers)
 return resolver

def create_credential_resolver ( session ) : profile_name = ( session . get_config_variable ( 'profile' ) or 'default' ) credential_file = session . get_config_variable ( 'credentials_file' ) config_file = session . get_config_variable ( 'config_file' ) metadata_timeout = session . get_config_variable ( 'metadata_service_timeout' ) num_attempts = session . get_config_variable ( 'metadata_service_num_attempts' ) env_provider = EnvProvider ( ) providers = [ env_provider , AssumeRoleProvider ( load_config = ( lambda : session . full_config ) , client_creator = session . create_client , cache = { } , profile_name = profile_name ) , SharedCredentialProvider ( creds_filename = credential_file , profile_name = profile_name ) , ConfigProvider ( config_filename = config_file , profile_name = profile_name ) , OriginalEC2Provider ( ) , BotoProvider ( ) , ContainerProvider ( ) , InstanceMetadataProvider ( iam_role_fetcher = InstanceMetadataFetcher ( timeout = metadata_timeout , num_attempts = num_attempts ) ) ] explicit_profile = session . get_config_variable ( 'profile' , methods = ( 'instance' , ) ) if ( explicit_profile is not None ) : providers . remove ( env_provider ) logger . debug ( 'Skipping environment variable credential check because profile name was explicitly set.' ) resolver = CredentialResolver ( providers = providers ) return resolver
create a default credential resolver .