Created
March 2, 2015 05:44
-
-
Save maimai-swap/67cd81744343958b872d to your computer and use it in GitHub Desktop.
Elastic BeanstalkでAWS_SECRET_ACCESS_KEYとAWS_ACCESS_KEY_IDを環境変数に入れた時のウェブアプリ内でのS3Client::factoryの仕方
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require __DIR__.'/../vendor/autoload.php'; | |
use Aws\S3\S3Client; | |
use Aws\Common\Enum\Region; | |
use Aws\Common\Enum\ClientOptions; | |
use Aws\Common\Credentials\Credentials; | |
$credentials = Credentials::fromIni('your-profile-name'); | |
$s3_client = S3Client::factory(array( | |
ClientOptions::CREDENTIALS => $credentials, | |
)); | |
var_dump($s3_client); | |
/* | |
目的通りのものが出るはず | |
object(Aws\S3\S3Client)#17 (17) { | |
["directory":protected]=> | |
string(50) "/var/app/current/vendor/aws/aws-sdk-php/src/Aws/S3" | |
["credentials":protected]=> | |
object(Aws\Common\Credentials\Credentials)#2 (4) { | |
["key":protected]=> | |
string(20) "XXXXXXXXXXXXXXXXXX" | |
["secret":protected]=> | |
string(40) "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" | |
["token":protected]=> | |
NULL | |
["ttd":protected]=> | |
NULL | |
} | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment