Credentials
The S3 resource needs an AWS access key pair with read (and optionally write) access to your bucket.1. Create an IAM User
- Go to https://console.aws.amazon.com/iam/
- Users -> Create user
- Attach the
AmazonS3ReadOnlyAccesspolicy (orAmazonS3FullAccessfor write) - Security credentials -> Create access key -> Application running outside AWS
- Copy the Access key ID and Secret access key
2. Set Environment Variables
Alternative: AWS Profile
If you have~/.aws/credentials configured, you can use a profile name instead of explicit access keys.
For the Python resource API, see the S3 resource doc.
Scoping a resource to a key prefix
Both runtimes support a key prefix option that transparently scopes every operation to a subpath of the bucket, so agents see clean paths while the underlying S3 keys carry the full prefix.None / undefined and empty strings both mean “no prefix.” For browser security considerations, see the TypeScript S3 setup doc.