Boto3 Problem: "BucketName", must be one of: S3. Cannot move archives from Glacier to s3 bucket

0

I'm using Boto3 to try to create an Inventory Retrieval Job from Glacier. Relevant part of my job retrieval dict looks like this:

job_params = {
            'Type': 'inventory-retrieval',
            'OutputLocation': {
                'BucketName': self.returnBucket,
            },
            'InventoryRetrievalParameters': {
                'StartDate': formatStart,
                'EndDate': formateEnd,
            },
        }

The error I get says" BucketName", must be one of: S3. The Boto3 Documents say that it's supposed to be a string, with the bucket name. I've tried both the bucket name and the ARN and they don't work.

I Tried created resource that I thought was the right approach:

s3_resource = boto3.resource('s3')
s3_bucket = s3_resource.Bucket('the bucket name')

but when the self.retrurnBucket = s3_bucket I still get the same error.

  • Have you tried ‘BucketName’ :s3_bucket[‘name’]?

gefragt vor einem Jahr244 Aufrufe
2 Antworten
0

The doco page you linked to shows jobParameters contains:

        'OutputLocation': {
            'S3': {
                'BucketName': 'string',

Looks like you forgot the 'S3' bit.

EXPERTE
beantwortet vor einem Jahr
0

Hello you have to use it like below:

jobParameters={
        'Type': 'inventory-retrieval',
        'Format': 'JSON',
        'OutputLocation': {
            'S3': {
                'BucketName': bucket_name,
                'Prefix': inventory_file_key
            }
        }
    }
AWS
SUPPORT-TECHNIKER
beantwortet vor einem Jahr

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen