Get AWS Account ID using awscli
Need to get an AWS Account ID from the aws cli tool? Here you go:
aws sts get-caller-identity --output text --query 'Account'
The following command returns the account number:
aws sts get-caller-identity --query 'Account' --output text
Command details can be found here
(reformat the command as code session)