Skip to content

Instantly share code, notes, and snippets.

@hsuh
Created January 20, 2017 12:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hsuh/dc15110a2e5c75b239956c8e3a3538a9 to your computer and use it in GitHub Desktop.
Save hsuh/dc15110a2e5c75b239956c8e3a3538a9 to your computer and use it in GitHub Desktop.
url - https://forums.aws.amazon.com/message.jspa?messageID=671934
You could verify that they match a regular expression that describes every access key and every secret key (the AWS Security Blog has regexes you could use), but there's no way for the SDK to check if your credentials are valid without sending a request to a service. (Otherwise, the SDK would need to ship with everyone's access keys embedded in its source.)
If you do make a call to a service, though, the remote service will be able to validate your credentials and respond accordingly. If you call $s3Client->listBuckets() before calling $s3Client->registerStreamWrapper(), the client will call the service and convert the error to an exception if your credentials are invalid.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment