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

One way or another you must tell boto3 in which region you wish the kms client to be created. This could be done explicitly using the region_name parameter as in: kms = boto3.client(‘kms’, region_name=”us-west-2″) or you can have a default region associated with your profile in your ~/.aws/config file as in: [default] region=us-west-2 or you … Read more

check if a key exists in a bucket in s3 using boto3

Boto 2’s boto.s3.key.Key object used to have an exists method that checked if the key existed on S3 by doing a HEAD request and looking at the the result, but it seems that that no longer exists. You have to do it yourself: import boto3 import botocore s3 = boto3.resource(‘s3’) try: s3.Object(‘my-bucket’, ‘dootdoot.jpg’).load() except botocore.exceptions.ClientError … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)