Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
trojikman opened this issue Aug 11, 2020 · 1 comment
Open
Milestone

Comments

@trojikman
Copy link
Contributor

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

@trojikman trojikman added this to the 13.0 milestone Aug 11, 2020
@trojikman
Copy link
Contributor Author

I also thought that it would be nice to do something like a check for the uniqueness of the bucket name in case when bucket haven't created in S3 yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant