ホーム > Laravel > Resolving Errors with AWS SES in Laravel
Laravel

Resolving Errors with AWS SES in Laravel

Thank you for your continued support.
This article contains advertisements that help fund our operations.

⇨ Click here for the table of contents for Laravel articles

Error Details

local.ERROR: Error retrieving credentials from the instance profile metadata service. (cURL error 7:  (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for http://169.254.169.254/latest/meta-data/iam/security-credentials/)

This is the solution for when this error occurs.

Solution

The cause of the error was that in AWS IAM,

  1. The access key was incorrectly set
  2. The secret key was incorrectly set

Where to Fix

Modify /config/services.php

    'ses' => [
       'key' => env('AWS_ACCESS_KEY_ID'),
       'secret' => env('AWS_SECRET_ACCESS_KEY'),
       'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
    ],

Modify /.env

AWS_ACCESS_KEY_ID=Insert Access Key Here
AWS_SECRET_ACCESS_KEY=Insert Secret Key Here

Apply changes with command

php artisan config:clear

or,

php artisan config:cache

If these settings are correct, the error message should change to a different one.

This article is a solution article for bugs, so if you are unsure about the implementation to begin with, please refer to the documentation or other articles below.

Official Documentation

Article for those who are not familiar with config and env

Conclusion

That's all.

I hope this can be helpful to someone.

For feedback or complaints, please contact me via Twitter DM.

Thank you!

Popular Articles

Deploying PHP7.4 + Laravel6 Project to AWS EC2

Implementing Breadcrumbs in Laravel with laravel-breadcrumbs

Please Provide Feedback
We would appreciate your feedback on this article. Feel free to leave a comment on any relevant YouTube video or reach out through the contact form. Thank you!