LoginSignup
0
0

More than 5 years have passed since last update.

AWS Security Token Service(Sts)のサンプル

Last updated at Posted at 2016-01-28

Aws Security Token Serviceを使ってみる。サイトにのってるのそのままだけど・・・

use Aws\Common\Aws;

        $aws = Aws::factory(array(
                'key'       => 'KEY'
            ,   'secret'    => 'SECRET'
            )
        );

        $client = $aws->get('Sts');
        $result = $client->getSessionToken();
        print_r($result);

結果は以下の通り。Credentialsあたりの情報でアクセスすればいいのだろう。
このあたりはAPI等(JavascriptでS3にアクセス)で使えるだろう。

しかし、簡単に取得できたけど有効期限変えることできるのかな・・?
まぁ実行した時の時間から考えると長めだったので変更できなくてもいいかなとは思ったけど。。。

   [structure:protected] => 
    [data:protected] => Array
        (
            [Credentials] => Array
                (
                    [SecretAccessKey] => XXXXXXXXXX
                    [AccessKeyId] => XXXXXXXXXXXXXXX
                    [SessionToken] => XXXXXXXXXXXXXXXXX
                    [Expiration] => 2016-01-28T19:53:25Z
                )

            [ResponseMetadata] => Array
                (
                    [RequestId] => XXXXXXXXXXXXXXXXXXXXXX
                )

        )
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0