Executing AWS CLI command from php results in Unable to locate credentials

后端 未结 6 1356
太阳男子
太阳男子 2020-12-11 15:56

I am trying to run aws s3 cp command from within php code using shell exec. Following is the php code.

echo shell_exec(\"sudo aws s3 cp s3:///s         


        
6条回答
  •  既然无缘
    2020-12-11 16:23

    To extend off of user1464317:

    I found this problem exists with Yosemite vs Mavericks. The AWS CLI for Mavericks looks for permissions in "~/.aws/config", where Yosemite looks in "~/.aws/credentials".

    If using cron, you can set the environment variable in crontab -e like so:

    # Mavericks
    AWS_CONFIG_FILE="/Users/YOUR_USER/.aws/config"
    
    # Yosemite
    AWS_CONFIG_FILE="/Users/YOUR_USER/.aws/credentials"
    

    Or you do as user1464317 implied, move the file over:

    mv config credentials
    

提交回复
热议问题