These are frequently used during AWS penetration testing labs (e.g., on platforms like TryHackMe) to discover resources, permissions, and misconfigurations. Always specify --region if needed, and use --profile for multiple credential sets.
aws sts get-caller-identity → Identifies the current user/role, account ID, and ARN (essential "whoami" in AWS).aws iam get-user → Gets details about the current user.aws iam list-users → Lists all IAM users in the account.aws iam list-roles → Lists all IAM roles.aws iam list-groups → Lists IAM groups.aws iam get-account-authorization-details → Comprehensive snapshot of users, groups, roles, and policies.aws iam list-attached-user-policies --user-name <username> → Lists managed policies attached to a user.aws iam list-user-policies --user-name <username> → Lists inline policies for a user.aws iam get-policy --policy-arn <arn> → Gets policy details.aws iam get-policy-version --policy-arn <arn> --version-id <id> → Views a specific policy version (useful for spotting old permissive versions).aws s3 ls → Lists all accessible S3 buckets.aws s3 ls s3://<bucket-name> → Lists objects in a bucket (checks read access).aws s3 cp s3://<bucket-name>/<file> . → Downloads a file (exploits read misconfigs).aws s3api get-bucket-acl --bucket <bucket-name> → Checks bucket permissions.