in iopath/common/s3.py [0:0]
def _get_client(self, bucket: str):
logger = logging.getLogger(__name__)
if not hasattr(self, "client"):
try:
session = boto3.Session(profile_name=self.profile)
self.client = session.client("s3")
except botocore.exceptions.NoCredentialsError as e:
logger.error(
" See https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html "
" for method of using environment variable to point to aws credentials, and the "
" order in which boto will search for said credentials. "
)
logger.error(
"Boto3 searches via the order below. If on FAIR Cluster, method 4 may be most convenient."
""
"The order in which Boto3 searches for credentials is:"
"1) [UNUSED] Passing credentials as parameters in the boto.client() method"
"2) [UNUSED] Passing credentials as parameters when creating a Session object"
"3) Environment variables"
" AWS_ACCESS_KEY_ID - The access key for your AWS account."
" AWS_SECRET_ACCESS_KEY - The secret key for your AWS account."
" AWS_SESSION_TOKEN - The session key for your AWS account."
" This is only needed when you are using temporary credentials. "
"4) Shared credential file (~/.aws/credentials)"
" default: ~/.aws/credentials"
" changed via: AWS_SHARED_CREDENTIALS_FILE"
" *for FAIR cluster usage: `export AWS_SHARED_CREDENTIALS_FILE=~/.fairusers_aws/credentials`"
"5) AWS config file (~/.aws/config)"
" default: ~/.aws/config"
" changed via: AWS_CONFIG_FILE"
"6) Assume Role provider"
"7) Boto2 config file (/etc/boto.cfg and ~/.boto)"
"8) Instance metadata service on an Amazon EC2 instance that has an IAM role configured."
)
raise OSError(
f"Error in making s3 client for bucket {bucket}"
f"{type(e).__name__}: {e}"
) from e
return self.client