Extract the Access Key, Secret Key and Session Token for AWS
When you need to retrieve the AWS access and secret keys and the session token, some Python code can help. See the following code snippet:
import boto3
cred = boto3.Session().get_credentials()
print(
"Access key: " + cred.access_key
+ "\n" + "Secret key: " + cred.secret_key
+ "\n" + "Session token: " + cred.token
)
This is particularly useful if your organization uses Single Sign-On.