Questions tagged [boto3]

Boto 3 - The Amazon Web Services (AWS) SDK for Python

About

Boto is the Amazon Web Services (AWS) software development kit (SDK) for Python, which allows Python developers to write software that makes use of services like Amazon S3 and Amazon EC2. Boto provides an easy to use, object-oriented API as well as low-level direct service access.

Links

7627 questions
2
votes
0 answers

Python boto3 how to completely move file from one folder to another and check if file successfully moved in s3?

I am trying to completely move file from one folder to another folder completly(similar action we do 'cut and past to another folder') using boto3 method s3_client = boto3.resource('s3') bucket='mybucket' source = { 'Bucket':…
adhi hari
  • 41
  • 1
  • 9
2
votes
1 answer

Copy file from FTP to S3 bucket using boto3 and ftplib is failing with "500 Syntax error, command unrecognized"

I need to send data from an FTP server into an S3 bucket without saving the file to my local drive. On the internet, I found that we can use io.BytesIO() as buffer. But my code fails with: error_perm: 500 Syntax error, command unrecognized. The…
Dimas Aps
  • 71
  • 8
2
votes
1 answer

Reading zip files from Amazon S3 using pre-signed url without knowing object key and bucket name

I have a password protected zip file stored in Amazon S3 which I need to read from a python program, extract the csv file from it and read to a dataframe. Initially, I was doing it using the object key and bucket name. import zipfile import…
elliot
  • 89
  • 8
2
votes
2 answers

aws cli can list but boto3 cannot

I can successfully perform this command so I'm pretty sure that s3:ListBucket role is provided: aws s3 ls s3://bucket_name/folder1/folder2/ 2021-09-01 21:09:36 51432 filename_2021-09-01.csv.gz 2021-09-02 21:09:32 684445…
chowpay
  • 1,515
  • 6
  • 22
  • 44
2
votes
4 answers

Write to a specific folder in an S3 bucket using boto3 python

The question I have a file that I would like to write to a specific folder within my S3 bucket lets call the bucket bucket and the folder folderInBucket I am using the boto3 library to achieve and have the following function: What I have done def…
2
votes
1 answer

boto3: Is aws_session_token necessary when trying to list objects in a bucket?

I'm writing a function currently to fetch objects from a bucket using boto3. While connecting, I have to connect like this: session = boto3.session.Session( aws_access_key_id="XXXXXXXXXX", aws_secret_access_key="YYYYYYYYYYYYYY") or like…
Eric Garcia
  • 77
  • 1
  • 12
2
votes
0 answers

I want to understand how to use aws start_session output to execute commands

I am using python and AWS boto3 to automate a few manual works. My Scenario is once I open a session with the session manager I will be able to execute commands like connecting to my DB. Now I used boto3 start_session where I got the response with…
vinstart
  • 21
  • 3
2
votes
2 answers

Running queries against Amazon S3 using Boto3

Because of Glacier Deep's expensive support for small objects, I am writing an archiver. It would be most helpful to me to be able to ask boto3 to give me a list of objects in the bucket which are not already in the desired storage class. Thanks…
Frank
  • 459
  • 2
  • 9
2
votes
1 answer

Unable to modify target capacity of spot fleet in AWS

I was using a python lambda function to terminate spot fleet instances using the below code, import boto3 def lambda_handler(event, context): client = boto3.client('ec2') response = client.modify_spot_fleet_request( …
2
votes
1 answer

Boto3 SSM waiter not working for Automation Execution

I am trying to execute an SSM automation and then apply a waiter to wait for the execution to complete but i am landing on a InvocationDoesNotExist exception. My code is as follows: # Get the SSM client client = boto3.client('ssm') #Start the…
Mervin Hemaraju
  • 1,921
  • 2
  • 22
  • 71
2
votes
1 answer

Boto3 / ECR-Public errors

I'm trying to use the ecr-public client but I get similar errors when I execute any method. import boto3 client=boto3.client('ecr-public') client.get_authorization_token() error: botocore.exceptions.ClientError: An error occurred (InternalFailure)…
2
votes
1 answer

Amazon S3 validate pre signed url

I'm giving to a client a presigned url for put_object method: Server: s3_client = boto3.client('s3') res = s3_client.generate_presigned_url('put_object', Params = {'Bucket': 'my-bucket', 'Key': 'filepath/inside-bucket/filename.json'}, ExpiresIn =…
user3599803
  • 6,435
  • 17
  • 69
  • 130
2
votes
1 answer

"errorMessage": "Parameter validation failed in Lambda calling SageMaker endpoint

I am trying to invoke a SageMaker enpoint from AWS Lambda using a lambda function. This is a sample API call to the endpoint from SageMaker Studio, working as expected: here's my Lambda function (inspired from documentation): import os import…
2
votes
1 answer

Mock download file from s3 with actual file

I would like to write a test to mock the download of a function from s3 and replace it locally with an actual file that exists of my machine. I took inspiration from this post. The idea is the following: from moto import mock_s3 import boto3 def…
Bubble
  • 63
  • 1
  • 9
2
votes
1 answer

Using boto3 to await a synchronous lambda invocation

I want to invoke a lambda function synchronously (request - response) but want to use python async-await to await the response. response = await client.invoke('my-func', InvocationType='RequestResponse', Payload='...')) I found a kind of…
daramasala
  • 3,040
  • 2
  • 26
  • 33
1 2 3
99
100