Skip to content

S3 Data Source

Load data from Amazon S3

s3

from llama_cloud.types import CloudS3DataSource
ds = {
'name': '<your-name>',
'source_type': 'S3',
'component': CloudS3DataSource(
bucket='<test-bucket>',
prefix='<prefix>', # optional
aws_access_id='<aws_access_id>', # optional
aws_access_secret='<aws_access_secret>', # optional
s3_endpoint_url='<s3_endpoint_url>' # optional
)
}
data_source = client.data_sources.create_data_source(request=ds)

These are the required IAM permissions for the user associated with the AWS access key and secret access key you provide when setting up the S3 Data Source. These permissions allow LlamaCloud to access your specified S3 bucket:

{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "LLamaCloudPermissions",
"Effect": "Allow",
"Action": [
"s3:GetObject",
"s3:ListBucket"
],
"Resource": [
"arn:aws:s3:::your-bucket-name,
"arn:aws:s3:::your-bucket-name/*"
]
}
]
}