Interview Prep/Python for DevOps/Best practices & rapid-fire commands

Rapid fire: boto3 snippets you should be able to write from memory.

IntermediateConceptBest practices & rapid-fire commands
Answer
boto3.client("sts").get_caller_identity()["Arn"]                      # who am I
boto3.Session(profile_name="prod").client("s3", region_name="eu-west-1")
ec2.get_paginator("describe_instances").paginate(Filters=[...])
ec2.get_waiter("instance_stopped").wait(InstanceIds=[iid])
e.response["Error"]["Code"]                                            # in except ClientError as e
Config(retries={"mode": "adaptive", "max_attempts": 10})
s3.generate_presigned_url("get_object", Params={...}, ExpiresIn=900)
All Python for DevOps questions Roadmap: Python for automation

More on Best practices & rapid-fire commands