I have an existing code that queries AWS for resources one after another, filtering based on the resource name. The current implementation is linear and moves from one function for each resource to the next, creating the respective clients and querying aws using the clients. This of course consumes a lot of time. Is it possible to run each of these functions in an asynchronous fashion? Code flow looks like the snippet below with lot more resource queries. Any inputs/suggestions would be helpful.
def query_acm():
client = boto3.client('acm', region_name=region)
client.get_paginator('list_certificates')
# filter and write to file
def query_asg():
client = boto3.client('autoscaling', region_name=region)
paginator = client.get_paginator('describe_auto_scaling_groups')
# paginate filter and write to file
def main():
query_acm()
query_asg()