botocore

AWS Cli sync with non DNS compatible bucket

荒凉一梦 提交于 2019-12-10 21:46:43
问题 Is there any way to use AWS command line to sync a local folder with a bucket that contains periods '.'? If I do this: aws s3 sync local_folder/ s3://files.domain.com/backup I get this error: fatal error: Bucket named files.domain.com is not DNS compatible. Virtual hosted-style addressing cannot be used. The addressing style can be configured by removing the addressing_style value or setting that value to 'path' or 'auto' in the AWS Config file or in the botocore.client.Config object. I

How to set tags for AWS EC2 instance in boto3

Deadly 提交于 2019-12-08 05:57:30
问题 I am new to Boto3 , and wanted to create a VPC, subnets, and some ec2 instances. The basic architecture is having a VPC, 2 subnets within 2 different availability zones (us-east-1a and b), and applying a security group which allows SSH and ping . My problem is how to specify additional options for each resources. The Python SDK (unlike how Javadoc works) doesn't show the required arguments and example options, so I'm confused. How can I specify tags for resources? (e.g. ec2 instance). I need

How can I import the boto3 ssm ParameterNotFound exception?

北城以北 提交于 2019-12-05 12:28:23
问题 I would like to import the exception that occurs when a boto3 ssm parameter is not found with get_parameter . I'm trying to add some extra ssm functionality to the moto library, but I am stumped at this point. >>> import boto3 >>> ssm = boto3.client('ssm') >>> try: ssm.get_parameter(Name='not_found') except Exception as e: print(type(e)) <class 'botocore.errorfactory.ParameterNotFound'> >>> from botocore.errorfactory import ParameterNotFound ImportError: cannot import name 'ParameterNotFound'

How can I import the boto3 ssm ParameterNotFound exception?

百般思念 提交于 2019-12-03 23:36:09
I would like to import the exception that occurs when a boto3 ssm parameter is not found with get_parameter . I'm trying to add some extra ssm functionality to the moto library, but I am stumped at this point. >>> import boto3 >>> ssm = boto3.client('ssm') >>> try: ssm.get_parameter(Name='not_found') except Exception as e: print(type(e)) <class 'botocore.errorfactory.ParameterNotFound'> >>> from botocore.errorfactory import ParameterNotFound ImportError: cannot import name 'ParameterNotFound' >>> import botocore.errorfactory.ParameterNotFound ModuleNotFoundError: No module named 'botocore

Overwrite S3 endpoint using Boto3 configuration file

隐身守侯 提交于 2019-12-03 02:42:41
问题 OVERVIEW: I'm trying to overwrite certain variables in boto3 using configuration file ( ~/aws/confg ). In my usecase I want to use fakes3 service and send S3 requests to the localhost. EXAMPLE: In boto (not boto3 ), I can create a config in ~/.boto similar to this one: [s3] host = localhost calling_format = boto.s3.connection.OrdinaryCallingFormat [Boto] is_secure = False And client can successfully pick up desired changes and instead of sending traffic to real S3 service, it will send it to

How to capture botocore's NoSuchKey exception?

懵懂的女人 提交于 2019-12-02 21:33: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.errorfactory import * doesn't work either and I don't want to capture a generic error. Jose Alban from

Overwrite S3 endpoint using Boto3 configuration file

北战南征 提交于 2019-12-02 16:18:09
OVERVIEW: I'm trying to overwrite certain variables in boto3 using configuration file ( ~/aws/confg ). In my usecase I want to use fakes3 service and send S3 requests to the localhost. EXAMPLE: In boto (not boto3 ), I can create a config in ~/.boto similar to this one: [s3] host = localhost calling_format = boto.s3.connection.OrdinaryCallingFormat [Boto] is_secure = False And client can successfully pick up desired changes and instead of sending traffic to real S3 service, it will send it to the localhost. >>> import boto >>> boto.connect_s3() S3Connection:localhost >>> WHAT I TRIED: Im trying

Unknown service error botocore

对着背影说爱祢 提交于 2019-12-02 00:04:18
问题 I'm trying to use the recent Amazon transcribe service with: transcribe = boto3.client('transcribe') and I get the following error: botocore.exceptions.UnknownServiceError: Unknown service: 'transcribe'. Valid service names are: ... I've tried upgrading boto3 and botocore using: pip install botocore --upgrade pip install boto3 --upgrade 回答1: The feature has not landed in botocore yet. It's unfortunate that usage examples appeared in the AWS docs already, when those service definitions are not

Unknown service error botocore

帅比萌擦擦* 提交于 2019-12-01 20:33:15
I'm trying to use the recent Amazon transcribe service with: transcribe = boto3.client('transcribe') and I get the following error: botocore.exceptions.UnknownServiceError: Unknown service: 'transcribe'. Valid service names are: ... I've tried upgrading boto3 and botocore using: pip install botocore --upgrade pip install boto3 --upgrade The feature has not landed in botocore yet. It's unfortunate that usage examples appeared in the AWS docs already, when those service definitions are not released to PyPI yet. Watch PR 1356 for merging. 来源: https://stackoverflow.com/questions/48307919/unknown

python boto3 connection error with no apparent cause

若如初见. 提交于 2019-11-30 09:35:29
问题 I'm hitting an error with code that connects to AWS using boto3. The error just started yesterday afternoon, and between the last time I didn't get the error and the first time I got the error I don't see anything that changed. The error is: botocore.exceptions.EndpointConnectionError: Could not connect to the endpoint URL: In .aws/config I have: $ cat ~/.aws/config [default] region=us-east-1 Here's what I know: Using the same AWS credentials and config on another machine, I don't see the