Skip to content

Instantly share code, notes, and snippets.

@paulmwatson
Created March 11, 2024 09:57
Show Gist options
  • Save paulmwatson/fc7adb67b5da2b5bb64ceeb98810dae7 to your computer and use it in GitHub Desktop.
Save paulmwatson/fc7adb67b5da2b5bb64ceeb98810dae7 to your computer and use it in GitHub Desktop.
# Python to return the IAM details of an access key
import boto3
client = boto3.client('sts', aws_access_key_id="ACCESS_KEY_ID", aws_secret_access_key="SECRET")
client.get_caller_identity()
=> {'UserId': '...', 'Account': '...', 'Arn': 'arn:aws:iam::...:user/...', 'ResponseMetadata': {'RequestId': '...', 'HTTPStatusCode': 200, 'HTTPHeaders': {'x-amzn-requestid': '...', 'content-type': 'text/xml', 'content-length': '409', 'date': '...'}, 'RetryAttempts': 0}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment