S3 base path: s3: // folder1 / folder2 / *
Use IAM user account:
ARN: AWS: IAM ::
I tried the following but no luck.
< p>
import boto3
client = boto3.client(
's3',
aws_access_key_id='****',
aws_secret_access_key='* ***'
)
obj1 = client.get_object("folder1/folder2/*") #TypeError
obj2 = boto3.resource("folder1/folder2/*") # DataNotFoundError< /pre>Any help in this regard would be greatly appreciated. Thank you!
s3:///
You can use the following expression to split "s3_key" into buckets and keys:
< p>
bucket, key = s3_key.split('/',2)[-1].split('/',1)
Therefore, from the path s3: // folder1/ folder2 access object, you will do the following:
import boto3
client = boto3.client('s3')
client. get_object(Bucket='folder1', Key='folder2')
I am granted access to the S3 bucket:
S3 Basic path: s3: // folder1 / folder2 / *
Use IAM user account:
ARN: AWS: IAM ::
p>
I tried the following but no luck.
import boto3
client = boto3.client(
's3',
aws_access_key_id='****',
aws_secret_access_key='****'
)
obj1 = client.get_object("folder1/folder2/*") #TypeError
obj2 = boto3.resource("folder1/folder2/*") # DataNotFoundError
Any help on this will be greatly appreciated. Thank you!
The s3 path consists of buckets and objects of the following form:
s3:///
You can use the following expression to split "s3_key" into buckets and keys:
bucket, key = s3_key.split('/',2)[-1].split('/',1)
So, to access the object from the path s3: // folder1/ folder2, you would execute the following Operation:
import boto3
client = boto3.client('s3')
client.get_object(Bucket='folder1', Key='folder2 ')