Find your AWS Account ID in 2 simple ways


In this article, you’ll learn how you can find your AWS account ID quickly using two simple methods. One way is to get the account id via the AWS Console.

The other way is to get it via the AWS CLI.

Your AWS account ID is a unique 12-digit identification number that is assigned to your AWS account. This number is important for you to track your account information with AWS.

To find your AWS account id with the AWS CLI, run the command sts get-caller-identity and it will return the 12-digit identification number of your AWS account.

To find your AWS account id in the AWS Console, click on your role name in the top right corner to view the account ID.

Here are the detailed steps to find your AWS account ID in the AWS Console and AWS CLI.

Find your AWS Account ID with the AWS CLI

Before you can get your AWS account ID using the AWS CLI, make sure to log in to the specified AWS CLI profile. Otherwise, you can’t run any AWS CLI commands on your AWS account.

To get your AWS account id with the AWS CLI you run the following command:

aws sts get-caller-identity --query "Account" --output text

This will return your 12-digit identification number in plain text.

~ on  tst-account-sso (eu-central-1) [59m25s]
➜ aws sts get-caller-identity --query "Account" --output text

123456789012

Find your AWS Account ID in the AWS Console

To get your AWS account ID via the AWS Console, follow these 3 steps:

  1. Sign in to the AWS Console with your credentials.
  2. Click on your IAM user/role on the top right corner of the AWS Console
  3. You’ll see a dropdown menu containing the AWS Account ID
Get the AWS account id from the AWS Console
Get the AWS account id from the AWS Console

Conclusion

There are two methods available that allow you to find your AWS Account ID in a quick way. Via the AWS CLI, you can run the aws sts get-caller-identity command to immediately get the AWS Account ID.

But if you’d rather use the AWS Console you can easily find the AWS Account ID in the top right corner of the navigation header.


Want to join us? Join for tips, strategies, and resources that I use in my solo cloud agency to build well-architected, resilient, and cost-optimized AWS solutions on AWS.

Join 1k+ AWS Cloud enthusiasts
Loved by engineers worldwide


Danny Steenman

A Senior AWS Cloud Engineer with over 9 years of experience migrating workloads from on-premises to AWS Cloud.

I have helped companies of all sizes shape their cloud adoption strategies, optimizing operational efficiency, reducing costs, and improving organizational agility.

Connect with me today to discuss your cloud aspirations, and let’s work together to transform your business by leveraging the power of AWS Cloud.

I need help with..
stacked cubes
Improving or managing my CDK App.Maximize the potential of your AWS CDK app by leveraging the expertise of a seasoned CDK professional.
Reducing AWS Costs.We can start by doing a thorough assessment of your current AWS infrastructure, identifying areas with potential for cost reduction and efficiency improvement.
Verifying if my infrastructure is reliable and efficient.We’ve created a comprehensive AWS Operations Checklist that you can utilize to quickly verify if your AWS Resources are set up reliably and efficiently.