Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
0 votes
2 answers
1k views

retrieveAndGenerate Syntax Error: Unknown parameter generationConfiguration or retrievalConfiguration (Claude-v3, Amazon Bedrock)

I am trying to retrieve and generate response from knowledge base use claude-v3 model. To do so I followed the boto3 documentation and Blog Post on Amazon and wrote this method: def ...
Shanazar's user avatar
0 votes
1 answer
725 views

AttributeError: 'dict' object has no attribute 'Instance' python

i am trying to start the EC2 Instance with PrivateIP where i provide as argument "PrivateIP" and below code will describe the ec2 and get InstanceId. Once InstanceId received, it starts the ...
shailysharma's user avatar
2 votes
1 answer
2k views

Using python Download the latest file from s3 bucket inside folder not from inside folder --folder

I want to download the latest file from s3-bucket inside folder only. Actually inside folder there are multiple folders along with files. But i need to download only file of latest date and upload it ...
user 98's user avatar
  • 177
0 votes
2 answers
5k views

catch errors if s3 file is not downloaded

I download a file from S3 like this: s3 = boto3.client('s3') s3.download_file('testunzipping','DataPump_10000838.zip','/tmp/DataPump_10000838.zip') For now it always works. However, I wanted to add ...
x89's user avatar
  • 3,390
1 vote
1 answer
99 views

boto3 print rules from bucket encryption

Im writing a python script to retrieve information of AWS and im trying to get only the SSEAlgorith but i get TypeError: list indices must be integers or slices, not str Is there any way to do this? I ...
Jean Lugo's user avatar
0 votes
0 answers
103 views

Get Count of Spot Instances

we can use get_cost_and_usage to know the cost spent of spot instance for a particular period of time. data = self.ce_client.get_cost_and_usage( TimePeriod={'Start': start, ...
Arun Kumar's user avatar
1 vote
1 answer
1k views

Boto3 wait_until_exists for available image (object has not attribute)

I'm creating an AMI and I want to wait until the AMI is 'available'. I'm using the following code: import json import boto3 import os import logging ec2 = boto3.client('ec2') images = ec2....
dahwild's user avatar
  • 35
0 votes
1 answer
892 views

how to create an encrypted s3 bucket while creating new s3 bucket with boto3

how to create encrypted s3 bucket while creating new s3 bucket with boto3 I know how to encrypt an existing bucket. But, is there any way to encrypt while creating it via boto3?
vikas's user avatar
  • 1
2 votes
4 answers
10k views

Programmatically establish boto3 sessions with AWS SSO

I'm trying to establish a boto3 session with boto3.session.Session(profile_name='foo') but getting an UnauthorizedSSOTokenError error: botocore.exceptions.UnauthorizedSSOTokenError: The SSO session ...
alex's user avatar
  • 7,383
0 votes
1 answer
178 views

boto.exception.EC2ResponseError: EC2ResponseError: 403 Forbidden (rights issue or something else)

I am trying to fetch Elastic IPs for in my AWS system, i am not sure whether i am using incorrect code or its the permission issue. Fetching regions is working fine. However, when i try to fetch ip ...
user890234's user avatar
0 votes
1 answer
1k views

ANSIBLE: boto - "TypeError: a bytes-like object is required, not 'str'"

Using ansible=2.10.0 and boto=2.49.0, When trying to execute ec2_vol playbook for manage disk to AWS instance with Proxy environment. Getting this error - connection.py",line 796, in proxy_ssl, ...
rahul mehra's user avatar
0 votes
1 answer
706 views

Using Python Variable in HTML / .format() for aws SES boto3

I am trying to add a variable inside html body but its not working. import boto3 SENDER = "[email protected]" RECIPIENT = "[email protected]" AWS_REGION = "yyy" SUBJECT = "...
Luff li's user avatar
  • 133
0 votes
1 answer
847 views

Boto3 InvalidParameterException while executing the lambda function

I'm getting a Boto3 InvalidParameterException while running the lambda function. I'm trying to find out a way to handle this exception. I came across the below solution: from boto.exception import ...
Bharath Bharath's user avatar
1 vote
1 answer
3k views

How to read Txt file from S3 Bucket using Python And Boto3

How to read Txt file from S3 Bucket using Python And Boto3 I am using the below script which is working very well I am able to see instance name which is in the S3 bucket import boto3 import codecs ...
thedataengineer's user avatar
1 vote
1 answer
996 views

How to iterate through nested Dictionary in python boto3

Hi want to find only stopped instance and their ids below is the below-nested JSON { "Reservations": [ { "Groups": [], "Instances": [ { "...
thedataengineer's user avatar
2 votes
1 answer
2k views

How to Display EC2 Instance name using Boto 3

I am using the below code for displaying instance_id,instance_type but I am unable to display the Instance name which I want print (instance.id, instance.instance_type, region) this is working but ...
thedataengineer's user avatar
0 votes
1 answer
921 views

Is there a way in python to RDP into a windows ec2 instance?

Like we have python library BOTO3 which we can use to ssh into a linux based ec2 instance, but it looks like the same script does not work for a windows based ec2 instance. I used the python script ...
Kashyap Sharma's user avatar
0 votes
2 answers
555 views

Boto run_instances() - unexpected keyword argument 'tag_specifications'

I am trying to start an aws instance in via a python3 script. It works fine, but am now trying to add some tags to the instance with no luck. I am trying the following, but get a "unexpected ...
Phil's user avatar
  • 179
0 votes
3 answers
998 views

AWS Lambda put_object function not sending file to destination s3 bucket

I'm invoking a Lambda function to send a .csv file from an email to a destination s3 bucket which I specify in said function. The invocation is triggered by Event type: ObjectCreatedByPut when the ...
jimiclapton's user avatar
2 votes
2 answers
2k views

'NoneType' object has no attribute 'boto_region_name'

I've been wrapped around this problem for a while and can't seem to understand where this issue is coming from. I'm deploying a model on Sagemaker and I get the error on this line of code: sm_model....
J. Patwary's user avatar
1 vote
0 answers
389 views

Execute SSM documents using boto3 aws multi account support

I was implementing centralized multi-account patching with AWS Systems Manager Automation. When operating in the console and using the "Automations" section of the SSM, you can indeed point to ...
cloudbud's user avatar
  • 3,258
2 votes
1 answer
1k views

Boto3: Get autoscaling group name based on multiple tags

I have a requirement to get the name of the autoscaling group based on its tags. I have tried following code: kwargsAsgTags = { 'Filters': [ { 'Name': 'key', '...
Chamara Keragala's user avatar
0 votes
2 answers
1k views

snapshot id with filter boto3 within a For Loop

I am trying to pass each snapshot id into for loop and print but to no avail, each time I can get to pass it only describes on the first snapshot and describes prints the tag for all. for snapshot ...
DeclanG's user avatar
  • 328
0 votes
0 answers
1k views

How to iterate over s3 bucket to collect all keys from a given date of a subfolder-boto3

I am trying to iterate over the files in my s3 bucket and send all the files(or keys) that run time were in 2019, 2018, or 2017 to a csv file. The structure of my s3 path goes like this: file/...
Coder123's user avatar
  • 344
0 votes
1 answer
2k views

How to get all the events between start and end times using cloudtrail's lookup_events in boto3 without specifying MaxResults?

I'm trying to fetch AWS cloudtrail events for a particular user using boto3. CloudTrail client I'm using cloudtrail client and lookup_events() function. I can specify the StartTime and EndTime ...
Underoos's user avatar
  • 5,170
1 vote
1 answer
776 views

Duplicity is giving a TypeError when uploading to Google Cloud Storage

I have a backup script that has been working fine. I recently updated my OS (to Ubuntu 19.10) and tried to install all of the dependencies but I'm getting an error. My script is something like: ...
Jeremy's user avatar
  • 2,000
3 votes
4 answers
2k views

Not null gcs bucket returned "can only concatenate str (not "bytes") to str"

I am very new to google clould storage. I am using tutorial https://cloud.google.com/storage/docs/boto-plugin to create a bucket to google cloud storage using boto. Please find code below: import ...
theone1one's user avatar
  • 1,520
0 votes
1 answer
2k views

Import error: No module named 'boto', but i have it installed

I'm setting up a new functionality in mi gcloud buckets that allows me to upload or download files using a python library called "boto", but appears this error I am using linux, visual studio code, ...
Cristian Rincon's user avatar
0 votes
1 answer
188 views

How to download last update files from s3 using boto

How to download last uploaded files from s3 This code will get the last updated files in my s3. i just need to download them all at once. code : import os import boto3 aws_access_key_id='***' ...
user avatar
0 votes
2 answers
777 views

Error importing aws credentials while using sudo python3 but not with python3

I'm a beginner to aws cli, boto and am working on an IoT project. Recently encountered this error that if I use sudo python3 and try to connect to s3, my connection is authenticated. But if I just use ...
utsav22g's user avatar
3 votes
2 answers
6k views

ModuleNotFound error while executing a package created by PyInstaller On Windows

I am packaging my ML solution which includes keras and tensorflow using PyInstaller. The exe builts just fine but when I execute the exe it gives an ModuleNotFoundError for boto. The solution works ...
Mohit Saxena's user avatar
0 votes
1 answer
256 views

Use Boto to Read File in Pandas (where File Name is partially known)

I need to read a csv file from S3(using boto) in order to create pandas data-frame. Problem is file name is partial known to me. I can read a file (where partial name of file is known to me) from my ...
Aditya Bhargava's user avatar
1 vote
1 answer
4k views

How to query a (Postgres) RDS DB through an AWS Jupyter Notebook?

I'm trying to query an RDS (Postgres) database through Python, more specifically a Jupyter Notebook. Overall, what I've been trying for now is: import boto3 client = boto3.client('rds-data') ...
psygo's user avatar
  • 7,401
2 votes
0 answers
263 views

Why am I getting a SQSError: 404 when trying to connect using Boto to an ElasticMQ service that is behind Ambassador?

I have an elasticmq docker container which is deployed as a service using Kubernetes. Furthermore, this service is exposed to external users by way of Ambassador. Here is the yaml file for the ...
fanoffan's user avatar
1 vote
1 answer
315 views

How to find class definition knowing an object in Python in PyCharm?

boto libraries have a lot of classes with similar names and different functionalities and vice versa (different names but same functionalities). I would like to track, which one is used in some ...
Dims's user avatar
  • 50.8k
6 votes
3 answers
10k views

Could not load Boto3's S3 bindings

I'm deploying to Heroku a Django==2.1.2 and Python==3.6.5 app and i would to manage media and static files with Amazon S3. Here's my settings.py: INSTALLED_APPS = ( ... 'storages', ) ...
Alberto Sanmartin Martinez's user avatar
3 votes
1 answer
5k views

Uploading files to Amazon s3 bucket using ARN iam in Python

I have been given a bucket name with ARN Number as below: arn:aws:iam::<>:user/user-name I was also given an access key. I know that this can be done using boto. Connect to s3 bucket using ...
Roshni Johnson's user avatar
1 vote
1 answer
634 views

App crashes on launch when compiled with py2app and boto3 is included

I created a complex app that uses boto3. It works fine when run from the command line. But when I try to compile it with py2app the application file is created, but it crashes on launch. I ...
David Degner's user avatar
2 votes
1 answer
65 views

Is it possible to create EC2 instance from describe_instances() output?

Using python and BOTO3 service there is an option to use describe_instances() to get all the information about the running instances in specific region. If I use that and save the output in JSON, ...
rivar_'s user avatar
  • 375
0 votes
1 answer
36 views

Cannot use boto2 to assign qualification to Mechanical Turkers

I am trying to assign a qualification I created to Turkers who completed an experiment of mine, using boto2. I have three batches of the same experiment (each has a different HIT ID). I easily ...
NicPes's user avatar
  • 3
0 votes
2 answers
272 views

Error When Parsing MWS Boto Response

With boto one is able to very easily parse data retrieved using boto.mws.connection and list_orders and isolate a specific piece of data such as an order number: from boto.mws.connection import ...
Alex B's user avatar
  • 1,182
0 votes
1 answer
10k views

How to check give directory or folder exist in given s3 bucket and if exist how to delete the folder from s3?

I want to check whether folder or directory exist in give s3 bucket, if exist i want delete folder from s3 bucket using python code. example for : s3:/bucket124/test Here "bucket124" is bucket and "...
Sai's user avatar
  • 1,117
3 votes
1 answer
2k views

Unable to query on Partition key in DyanmoDB by boto3

I have one table TestTable and partition Key TestColumn. Inputs Dates: from_date= "2017-04-20T16:31:54.451071+00:00" to_date = "2018-04-20T16:31:54.451071+00:00" when I use equal query the date ...
Vivek Sable's user avatar
  • 10.2k
3 votes
1 answer
3k views

boto.exception.S3ResponseError: S3ResponseError: 400 Bad Request

I am getting this error to access S3 bucket. My region is mumbai. boto.exception.S3ResponseError: S3ResponseError: 400 Bad Request InvalidRequestThe authorization mechanism you have provided ...
Rahul Verma's user avatar
1 vote
0 answers
86 views

boto 2.41 - set_contents_from_filename() fails when I use it to print upload progress

I tried to upload a file into AWS using the following snippet of code. filePath = os.path.join(output_dir, fileToUpload) k = bucket.new_key(os.path.join(bucket_dir,fileToUpload)) k....
Praveen Kumar Nandagopal's user avatar
0 votes
1 answer
264 views

'HTTPSConnection' object has no attribute 'provider'

So I am trying to create a new key as a string file in a particular s3 bucket, but am getting this peculiar error. I need to be able to use the k.set_contents_from_string approach, as later on I ...
Arnold's user avatar
  • 191
0 votes
1 answer
229 views

Python3 + Boto3. Virtual device MFA. Can't generate QRcode.png

I have a script with boto3, that creates new virtual MFA divice and enables it. The problem is that I can not create a QR code file. In the boto3 doc page they indicate that response syntax is: { ...
Andrey's user avatar
  • 63
2 votes
1 answer
4k views

Using boto to delete all buckets

I've been tasked with creating a script to delete all the current S3 buckets and create some new ones. This is something that they want to do on an ongoing basis. So far I have all the preliminaries: ...
lengthy_preamble's user avatar
1 vote
2 answers
10k views

How to start all the ec2 instances using python by configuring boto3 libraries in windows?

I have installed python 3.6.4 version on my windows 8.1 64-bit machine. what all steps required to install and configure boto3 and boto libraries. I was trying to fetch all the AWS EC2 instances of ...
zlogic's user avatar
  • 70
1 vote
1 answer
8k views

Transfer files from one folder to another in amazon s3 using python boto

I am trying to transfer files from one folder to another in the same s3 bucket but I am getting error. I have written code below to transfer files to one folder to another. import boto from boto.s3....
rnvs1116's user avatar