Use AWS STS Get Caller Identity To Find Your AWS Account Number

0
284
aws sts get caller identity

The “aws sts get caller identity” command is a great way to find your AWS account number when you’ve lost it. This handy little command will return your AWS account number, as well as the user ID and ARN associated with the account. Let’s take a look at how to use aws sts get caller identity command and what benefits it can offer.

How Does STS Work? 

  • You can ask for temporary, limited-privilege credentials for AWS Identity and Access Management (IAM) users or for federated users who represent them using the AWS Security Token Service (STS), a web service.
  • Using these temporary security credentials, you can make AWS API calls, which are actions that your IAM users are authorized to perform in your account. If you’re new to IAM or don’t know about federated users, see IAM User Guide. 

The Benefits of Using STS? 

AWS STS Get Caller Identity is a security token service that provides temporary, limited-privilege credentials to IAM users. When you make a request to assume an IAM role, AWS Security Token Service (STS) validates the request to ensure that it comes from a trusted source. If the request is valid, STS provides temporary security credentials for assuming the IAM role.

There are several benefits of using Security Token Service: 

  • You can use IAM roles to delegate access to users, applications, or services that need access to your AWS resources without having to share your main AWS credentials (such as your AWS access keys).
  • This delegation of authority is an important security best practice because it allows you to grant only the permissions that are required for a user or application function while still maintaining full control over your account settings and security posture. 
  • Because temporary security credentials have short lifetimes (usually one hour), they can be rotated frequently so that if they are compromised, they can quickly be revoked before any damage can be done using them. 

How to Use the Command

The usage for this command is simple.

  • First, open up a terminal window and log into your AWS account via the CLI.
  • Then, simply type in the following command: aws sts get-caller-identity 
  • This will return your account number, as well as the user ID and ARN associated with that account. 

Benefits of Using This Command 

There are several benefits of using this command.

  • First, it’s a quick and easy way to find your AWS account number if you’ve lost it.
  • Second, it can be used to verify that you are logged in to the correct AWS account.
  • And third, it can be used to troubleshoot issues with permissions or policies. 

Be sure to bookmark this page so you can reference it next time you need to use this command!

Conclusion: 

In conclusion, aws sts get caller identity is a great way to keep track of what’s going on in your account and delegate access without having to worry about sharing important information. The benefits far outweigh any negatives when it comes to this service, so if you’re not already using it, we highly recommend doing so!