botocore

Boto intermittent “unable to load credentials” with EC2 IAM roles

£可爱£侵袭症+ 提交于 2021-01-27 14:18:26
问题 I use an Elastic Beanstalk environment for deploying a web application, and I've set up an IAM role for the instances the application will run on. Everything works flawlessy 99.99% of the time, however intermittently I will see errors in our logs with request failures showing botocore errors like the following: File "/opt/python/run/venv/local/lib/python3.6/site-packages/boto3/resources/factory.py", line 339, in property_loader self.load() File "/opt/python/run/venv/local/lib/python3.6/site

Example of update_item in dynamodb boto3

百般思念 提交于 2020-12-24 05:01:45
问题 Following the documentation, I'm trying to create an update statement that will update or add if not exists only one attribute in a dynamodb table. I'm trying this response = table.update_item( Key={'ReleaseNumber': '1.0.179'}, UpdateExpression='SET', ConditionExpression='Attr(\'ReleaseNumber\').eq(\'1.0.179\')', ExpressionAttributeNames={'attr1': 'val1'}, ExpressionAttributeValues={'val1': 'false'} ) The error I'm getting is: botocore.exceptions.ClientError: An error occurred

Example of update_item in dynamodb boto3

孤者浪人 提交于 2020-12-24 05:01:03
问题 Following the documentation, I'm trying to create an update statement that will update or add if not exists only one attribute in a dynamodb table. I'm trying this response = table.update_item( Key={'ReleaseNumber': '1.0.179'}, UpdateExpression='SET', ConditionExpression='Attr(\'ReleaseNumber\').eq(\'1.0.179\')', ExpressionAttributeNames={'attr1': 'val1'}, ExpressionAttributeValues={'val1': 'false'} ) The error I'm getting is: botocore.exceptions.ClientError: An error occurred

changes using boto3 for connections to aws services

╄→尐↘猪︶ㄣ 提交于 2020-01-11 14:10:11
问题 What all changes has to be done while using a function which was using boto2 earlier and how has to be changes to boto3 below is one such function example which is on boto2 and it needs to be changed to boto3 def aws(serviceName, module=boto): conn = connections.get(serviceName) if conn is None: service = getattr(module, serviceName) conn = service.connect_to_region(region) connections[serviceName] = conn return conn 回答1: That code doesn't seem to be doing much. It is simply connecting to an

How to capture botocore's NoSuchKey exception?

核能气质少年 提交于 2019-12-31 10:57:15
问题 I'm trying to write "good" python and capture a S3 no such key error with this: session = botocore.session.get_session() client = session.create_client('s3') try: client.get_object(Bucket=BUCKET, Key=FILE) except NoSuchKey as e: print >> sys.stderr, "no such key in bucket" But NoSuchKey isn't defined and I can't trace it to the import I need to have it defined. e.__class__ is botocore.errorfactory.NoSuchKey but from botocore.errorfactory import NoSuchKey gives an error and from botocore

How to capture botocore's NoSuchKey exception?

强颜欢笑 提交于 2019-12-31 10:57:13
问题 I'm trying to write "good" python and capture a S3 no such key error with this: session = botocore.session.get_session() client = session.create_client('s3') try: client.get_object(Bucket=BUCKET, Key=FILE) except NoSuchKey as e: print >> sys.stderr, "no such key in bucket" But NoSuchKey isn't defined and I can't trace it to the import I need to have it defined. e.__class__ is botocore.errorfactory.NoSuchKey but from botocore.errorfactory import NoSuchKey gives an error and from botocore

Downloading files from AWS S3 Bucket with boto3 results in ClientError: An error occurred (403): Forbidden

孤者浪人 提交于 2019-12-24 05:16:10
问题 I am trying to download files from a s3 bucket by using the Access Key ID and Secret Access Key provided by https://db.humanconnectome.org. However, even though I am able to navigate the database and find the files (as I have configured my credentials via aws cli), attempting to download them results in the following error: "botocore.exceptions.ClientError: An error occurred (403) when calling the HeadObject operation: Forbidden" With the same credentials, I can browse the same database and

Null values passed to cloudformation module - ansible

徘徊边缘 提交于 2019-12-20 02:54:15
问题 Ansible cloudformation module uses these environment variables of shell: $ export AWS_PROFILE=djangoapp $ export AWS_DEFAULT_REGION=ca-central-1 $ aws configure list Name Value Type Location ---- ----- ---- -------- profile djangoapp manual --profile access_key ****************WKWG shared-credentials-file secret_key ****************/I4Z shared-credentials-file region ca-central-1 env AWS_DEFAULT_REGION ./site.yml --- - name: Todobackend deployment playbook hosts: localhost connection: local

aws chalice ignoring proxy config

别说谁变了你拦得住时间么 提交于 2019-12-11 18:34:14
问题 I am trying to deploy the helloworld example using chalice behind a corporate proxy. On my machine I use cntlm to proxy the requests with my credentials to the corp proxy. I am monitoring cntlm logs but when I run chalice deploy the request never hits my local proxy. $ echo $http_proxy $https_proxy http://localhost:3128/ http://localhost:3128/ $ chalice --version chalice 1.6.0, python 3.6.5, linux 4.15.0-24-generic $ chalice --debug deploy Creating deployment package. 2018-07-29 13:46:52,813

flask installed, but ModuleNotFoundError: No module named 'Flask'

时间秒杀一切 提交于 2019-12-11 03:13:16
问题 i have flask installed in my Mac, pip list | grep Flask Flask 1.0.2 but when i execute a python file, it shows error like from Flask import Flask, render_template ModuleNotFoundError: No module named 'Flask' the directories used for python and flask are which python /usr/bin/python which flask /Library/Frameworks/Python.framework/Versions/3.5/bin/flask so I thought of running virtualenv, but l cant even install it with error messages s3transfer 0.1.8 requires botocore<2.0.0,>=1.3.0, which is