Reputation: 189
I have a boto3 script ready to use. It is working fine when I specify a profile name from my .aws credentials file. But, I want to run the script in all the profiles which are present in my .aws credentials file. And, I have like more than 20 profiles. How do I automatically configure boto3 to keep fetching the profiles one by one and return the output ?
#Listing the validity of SSL certs in RDS
import boto3
from pprint import pprint
rds = boto3.client('rds')
sslcert = rds.describe_certificates()
for cert in sslcert['Certificates']:
print('Valid till', cert['ValidTill'])
Upvotes: 0
Views: 911
Reputation: 189
Looks like there is a function to list out all the profiles in your local .aws/credentials file.
for profile in boto3.session.Session().available_profiles:
print(profile)
Upvotes: 2