Skip to content

[13.0] ir_attachment_s3: error in case when bucket is not created in AWS #1001

@trojikman

Description

@trojikman

Steps to reproduce:

  1. Install and configure module as described in docs
  2. Don't create bucket in AWS
  3. You'll get an error like "Access denied"

How it should work:
If bucket name passed in s3.bucket doesn't exist in AWS S3 then it must be created.

Where to fix:

s3 = boto3.resource(
"s3", aws_access_key_id=access_key_id, aws_secret_access_key=secret_key
)
bucket = s3.Bucket(bucket_name)
if not bucket:
s3.create_bucket(Bucket=bucket_name)
bucket = s3.Bucket(bucket_name)
return bucket

the bucket variable is True even if there is no buckets in S3.

Might help:
https://stackoverflow.com/questions/26871884/how-can-i-easily-determine-if-a-boto-3-s3-bucket-resource-exists

It was mentioned here

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions