Skip to content

Instantly share code, notes, and snippets.

@akloya
Created October 15, 2021 02:37
Show Gist options
  • Save akloya/6c95ee49bb0ea5cdfb866007791c71f0 to your computer and use it in GitHub Desktop.
Save akloya/6c95ee49bb0ea5cdfb866007791c71f0 to your computer and use it in GitHub Desktop.
loop through multiple aws profiles in python
import boto3
for profile in ['profile1', 'profile2']:
print("fetching from account => " + profile)
session = boto3.session.Session()
client = session.client(
service_name='secretsmanager',
region_name='us-west-2'
)
response = client.list_secrets()
print(response)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment