Using PowerShell DSC, I'm trying to read an object from within an AWS S3 bucket but I get the following error:
Unable to load stored credentials for profile = [default]
I have tried using the -ProfileLocation parameter however that then throw the error "A parameter cannot be found that matches parameter name 'ProfileLocation'". My code is as follows:
Read-S3Object -ProfileName default BucketName $bucket -Key $key -File $file
Make sure you have read this documentation "Using AWS Credentials" and followed the instructions it provided.
Troubleshooting
ProfileName
is not supported in the AWS Powershell Tools prior to version v1.1. You can check your version through the Get-AWSPowerShellVersion
cmdlet. If you are using an earlier version, try using the StoredCredentials
parameter instead. Alternatively, you can update.
Make sure that the profile name "default" actually exists. You can check this by running Get-AWSCredentials -ListStoredCredentials
, which will return a list of stored AWS credentials.
If your desired profile name does not exist, you will need to create it.
The documentation provides the following example for creating a new profile:
Set-AWSCredentials -AccessKey AKIAIOSFODNN7EXAMPLE `
-SecretKey wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY `
-StoreAs MyProfileName
Note: Concerning terminology, Stored Credential and Profile seem to be used interchangeably by the documentation.