0

I'm trying to use boto3's pagination function to return all AWS IAM Policies. It seems like it'll return a number of them and then move on. If I run the script again it'll return the next batch etc

paginator = self.client_iam.get_paginator("list_policies")
response_iterator = paginator.paginate(Scope="Local")

for page in response_iterator:
    for resource in page.get("Policies"):
      pass

As far as I was aware, this is all you need to do to paginate through all Policies, or am I missing something?

mlevit
  • 2,676
  • 10
  • 42
  • 50

1 Answers1

0

You just need to put a while loop for each pagination, Check this out: How to use Boto3 pagination