Closed ank8690 closed 2 months ago
Are you making sure to setup the sdk correctly with:
Aws::SDKOptions options;
Aws::InitAPI(options);
{
//your code here
}
Aws::ShutdownAPI(options);
I am trying to use my own code for reading the credentials (instead of a credential provider written in AWS SDK) from the file and then it works. Can you successfully use the credential provider written in AWS SDK? Is there a specific reason that you are trying to avoid using the build in credentials provider?
Yes, I have setup the sdk correctly with InitAPI
and ShutdownAPI
. If I use the credentials provider for named profiles, it is trying to override the credentials somewhere in SDK as per my understanding while I debugged inside. Can you let me know by seeing the above code if I missed something in using credentials anywhere?
I can successfully use a non default profile when using the code that you have above. I would check to make sure you are using the correct endpoint, that the region you have set is correct, and any other possible settings. Please let me know if you still have any questions about setting up credentials with this sdk
Greetings! It looks like this issue hasn’t been active in longer than a week. We encourage you to check if this is still an issue in the latest release. Because it has been longer than a week since the last update on this, and in the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment or add an upvote to prevent automatic closure, or if the issue is already closed, please feel free to open a new one.
I am working on a desktop application which uses AWS-SDK-CPP on windows and encountered an awkward behavior because I am not getting the correct result for the named profile. The interesting fact is that it was sometimes giving network error, sometimes Access Denied. I have this profile defined in .aws/credentials:
My config file looks like:
My Actual code is:
Expected Behavior
Connection to AWS is successful. Files will be uploaded to bucket
Current Behavior
Verification failed, ExceptionName = AccessDenied, Message = Access Denied
Reproduction Steps
If you use the above code with required header files, then you will be able to reproduce it.
Possible Solution
I am trying to use my own code for reading the credentials (instead of a credential provider written in AWS SDK) from the file and then it works. Here is the code sample:
auto credentials = readCredentialsFromAwsCredFile(m_ProfileName);
Additional Information/Context
If one used this constructor for S3 Client:
m_s3Client = new Aws::S3::S3Client(config)
where config is defined as:Aws::S3::S3ClientConfiguration config(m_ProfileName.c_str());
then only it will be calling default credentials provider, but I don't think that is correct behavior. Once I have defined specific named profile, then it should use that everywhere and should never override that.Otherwise, if you use the constructor like this:
m_s3Client = new Aws::S3::S3Client( credentials, endPoint, config);
then it will use SimpleCredentialProvider and works fine.AWS CPP SDK version used
1.11.8
Compiler and Version used
Microsoft Visual C++ Compiler 17.4.33213.308 (x86_amd64)
Operating System and version
Windows 10