s5cmd uses the official AWS SDK for authentication. You can provide credentials using several methods:
Command Line Flags
--profile <name>: Use a specific named profile.--credentials-file <path>: Use a specific credentials file.
Environment Variables
Set the following variables to configure access:
AWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEYAWS_PROFILEAWS_REGIONS3_ENDPOINT_URL (for non-AWS S3 compatible services)
IAM Roles
If running on AWS infrastructure, s5cmd automatically supports:
- EC2 IAM roles
- EKS Kube IAM roles
Anonymous Access
Use the --no-sign-request flag to access public buckets without credentials.
# Use a specific profile from the default AWS credentials file
s5cmd --profile my-work-profile ls s3://my-company-bucket/
# Use a custom credentials file and profile
s5cmd --credentials-file ~/.your-credentials-file --profile my-work-profile ls s3://my-company-bucket/
# Use environment variables
export AWS_ACCESS_KEY_ID='<your-access-key-id>'
export AWS_SECRET_ACCESS_KEY='<your-secret-access-key>'
export AWS_PROFILE='<your-profile-name>'
export AWS_REGION='<your-bucket-region>'
# Anonymous access for public buckets
s5cmd --no-sign-request ls s3://public-bucket/