- Newest
- Most votes
- Most comments
Hello,
Invalid Access Key ID error message indicates that the AWS Access Key ID provided is not found in AWS records. Here are a few things to check:
Ensure you’re using the correct AWS Access Key and Secret Key. You can find your Access Key and Secret Key in the AWS Management Console under IAM (Identity and Access Management). You can check this documentation for creating and managing Access keys for IAM users: Managing access keys for IAM users
Initialize s3 client
use Aws\S3\S3Client;
$s3Client = new S3Client([
'version' => 'latest',
'region' => 'eu-west-2',
'credentials' => [
'key' => 'your_access_key',
'secret' => 'your_secret_key',
],
]);
Here is an example from the documentation:
- https://docs.aws.amazon.com/sdk-for-php/v3/developer-guide/guide_credentials.html
- https://docs.aws.amazon.com/sdk-for-php/v3/developer-guide/s3-presigned-url.html
Permissions:
Verify that the Access Key has the necessary permissions to perform the “GetObject” operation on the specified S3 bucket. Make sure the policy associated with the IAM user which has the Access Key allows the required actions (e.g., s3:GetObject).
Region:
Confirm that the region specified ('eu-west-2' in your code) matches the actual region where your S3 bucket is located. If your bucket is in a different region, update the region accordingly.
Relevant content
- Accepted Answerasked 7 months ago
- Accepted Answerasked 8 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 3 years ago