AWS Get Sts Identity
To run an aws get sts identity check, query the Security Token Service endpoint. This call returns the account ID, user ID, and resource name for your session. Teams use this check to confirm which cloud role is active before running changes. If a developer holds a broad role by mistake, commands can alter production resources. Checking the active caller identity helps prevent mistakes across multiple cloud accounts. How the aws get sts identity workflow operates Every cloud request uses a se
AWS IAM Policies + Identity and Access Management (IAM): the complete guide
Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.
To run an aws get sts identity check, query the Security Token Service endpoint. This call returns the account ID, user ID, and resource name for your session. Teams use this check to confirm which cloud role is active before running changes. If a developer holds a broad role by mistake, commands can alter production resources. Checking the active caller identity helps prevent mistakes across multiple cloud accounts.
How the aws get sts identity workflow operates
Every cloud request uses a secret key and a session token to sign messages. When you aren't sure which profile is active, you ask the token service. The aws get sts identity action reads your signed request and checks its math. It does not need special permissions to run this check. In fact, you cannot block this specific call with standard permission policies. Any valid user or assumed role can run it at any time.
The service replies with three basic pieces of data about your current session. First, it gives the unique user or session identifier. Second, it shows the twelve-digit account number that owns the identity. Third, it returns the full Amazon Resource Name for the active user or role. Engineers put this check at the start of deploy scripts to prevent account mix-ups. If the account number does not match the target, the script stops right away.
Where local credential profiles cause confusion
Developers often store several static keys and role profiles on their laptops. Shell variables, config files, and single sign-on tools all compete to set the identity. One terminal window might hold a test role while another holds a production role. When a script runs, the software library picks credentials based on a strict order. Shell variables override config files, which often surprises engineers during an urgent fix.
Running an identity check tells the engineer which credential won that local race. It confirms the starting point before any cloud resources change or delete. Teams also use this call to test if temporary tokens have expired. If the token is dead, the service rejects the call with an error message. If the token works, the engineer knows the network path and keys are valid.
AWS IAM Policies + Identity and Access Management (IAM): architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
What identity checks solve and what they miss
Checking the active cloud caller solves a basic problem during daily work. It proves who you are to the cloud API before you take action. It stops you from running a test script against the wrong account by accident. Cloud audit logs also record this check so security teams can trace token use.
Still, this check only tells you which role is logged in right now. It does not tell you what permissions that role actually has inside the account. More important, it does not inspect the commands or queries you run next. Once a developer assumes a strong role, every command inside that scope will run. Cloud roles decide who can log in, not what each individual command does. If a query reads customer emails or card numbers, the role allows it all. Masking rules that rewrite matched fields in results do not exist at this layer. Teams still need a way to check individual commands and protect sensitive data.
Add runtime guardrails and masking beside your databases and APIs
Login rules, role grants, and CI checks govern who connects to your stack. Yet any allowed script, engineer, or AI agent still runs commands with the full scope of its role. For workloads on Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes, SSH, or internal HTTP services, hoop.dev sits inline in the protocol beside the service as an open-source proxy, a sidecar for your database or API. On every production query an agent or human runs, hoop.dev decides whether to pass, mask, block, or escalate it for review.
Before a query runs, hoop.dev guardrails check the statement against your rules, an AI Analyzer you configure can score intent or hold risky calls for human approval, and hoop.dev data masking rewrites sensitive fields in responses in memory. Explore the MIT-licensed project on GitHub.
Frequently asked questions
Does the caller identity check require special IAM permissions?
No, this call works for any valid credential without needing extra policy rules. Even a user with zero attached permissions can still check their own active identity.
Can I block users from checking their caller identity?
No, cloud security rules cannot deny this specific action for valid keys or tokens. The cloud provider keeps this endpoint open so apps can always verify their session.
Does checking my identity tell me what permissions I have?
No, the response only returns your user ID, account number, and resource name. To see your allowed actions, you must inspect the policies attached to that role.
Related guides
In this post