Search code examples
phpamazon-web-servicesamazon-ec2aws-php-sdk

How to get user-id or AWS account id via AWS PHP SDK


Is there anyway to get UserId or a.k.a. AWS Account ID?

I have checked the documentation but could not locate (...or probably it doesn't exists...) a method call which returns the UserId.


Solution

  • Sort of. There's no way to get it without creating a resource. Many resources have an ARN associated with it. You can extract the Account ID from the ARN, but you'd have to create a resource first.