AWS account id を取得 (PHP SDKから)

  • 1
    Like
  • 0
    Comment
More than 1 year has passed since last update.

    $client     = new Aws\Sts\StsClient(
        [
            'version' => 'latest',
            'region'  => 'us-east-1',
            'profile' => $profile_name,
        ]
    );
    $result     = $client->getCallerIdentity([]);
    $account_id = $result['Account'];

}