Posted at

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

More than 3 years have 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'];

}