My C++ program must access both public and private AWS buckets. The public buckets don’t belong to me so when the program tries to access them and my credentials are visible I get the following type errors:
Aws::S3::S3Errors::INVALID_ACCESS_KEY_ID
"InvalidAccessKeyId"
"The AWS Access Key Id you provided does not exist in our records."
If I manually hide my credentials like this
mv ~/.aws/credentials ~/.aws/credentials-hidden
before running the program I can successfully list and get the public objects. But then, the program can't access my private buckets.
I’ve searched S3Client
and ClientConfiguration
for some option to disable and re-enable credentials checks but haven’t found it.
Please tell me how this is done.
I found a solution. To access public buckets without hiding my ~/.aws/credentials
file I can create an S3Client with empty credentials.
Aws::Auth::AWSCredentials empty_credentials { };
Aws::S3::S3Client s3_client { empty_credentials, config };