figaro figaro - 3 months ago 20
PHP Question

how to add S3 authentication keys AWS SDK PHP

I do not understand where I am supposed to add my key and secret key credentials. I am using AWS SDK for php with composer. The documentation says to create a credentials file at ~/.aws/credentials.

I do not understand the filepath. Where exactly to I make this file? Do I make it at the root of the folder I am in?


This is a Unix filepath and means "in the homefolder, in .aws/credentials".

I assume you use Windows. In this case, use that path:


"credentials" is a text file, which you could edit with Notepad. ".aws" is just the name of folder which you can create with Explorer. USERNAME is your Windows-Username.

You can read about it in the docs.

If you are on a Mac, like indicated in the comment, you can do the following:

  • Open the and type: mkdir ~/.aws. This will create a new folder in your home folder
  • Then type: open ~/.aws. This will open a Finder inside the .aws Folder. Then you can work usign the finder to create a file called "credentials"
  • OR: If you have Sublime Text installed, type: subl ~/.aws
  • OR: If you are familiar with VI, type: vi ~/.aws/credentials