How to choose an AWS profile when using boto3 to connect to CloudFront

I am using the Boto 3 python library, and want to connect to AWS CloudFront. I need to specify the correct AWS Profile (AWS Credentials), but looking at the official documentation, I see no way to specify it. I am initializing the client using the code: client = boto3.client(‘cloudfront’) However, this results in it using … Read more

boto3 client NoRegionError: You must specify a region error only sometimes

I have a boto3 client : boto3.client(‘kms’) But it happens on new machines, They open and close dynamically. if endpoint is None: if region_name is None: # Raise a more specific error message that will give # better guidance to the user what needs to happen. raise NoRegionError() Why is this happening? and why only … Read more

How to handle errors with boto3?

I am trying to figure how to do proper error handling with boto3. I am trying to create an IAM user: def create_user(username, iam_conn): try: user = iam_conn.create_user(UserName=username) return user except Exception as e: return e When the call to create_user succeeds, I get a neat object that contains the http status code of the … Read more