Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"AllAccessDisabled: All access to this object has been disabled" error being thrown when copying between S3 Buckets

I am getting this error:

AllAccessDisabled: All access to this object has been disabled

When performing the s3.copyObject function in my node Lambda function.

Is this error being thrown because of insufficient permissions on the source bucket, or because of insufficient permissions on the target bucket?

like image 574
SeanPlusPlus Avatar asked Nov 15 '18 22:11

SeanPlusPlus


People also ask

Why can't I copy an object between two Amazon S3 buckets?

If the object that you can't copy between buckets is owned by another account, then the object owner can do one of the following: The object owner can grant the bucket owner full control of the object. After the bucket owner owns the object, the bucket policy applies to the object.


2 Answers

If your bucket name does Not match with bucket name in your code, it will also throw an error 403 forbidden. Make sure you spell correctly

like image 115
eldorcodes Avatar answered Oct 20 '22 00:10

eldorcodes


This error means you are trying to access a bucket that has been locked down by AWS so that nobody can access it, regardless of permissions -- all access has been disabled.

It can occur because a bill goes unpaid and probably for other reasons as well...

However... usually this means you've made a mistake in your code and are not accessing the bucket that you think you are.

s3.copyObject expects CopySource to be this:

'/' + source_bucket_name + '/' + object_key

If you overlook this and supply something like /uploads/funny/cat.png you're going to get exactly this error, because here, uploads is the bucket name and funny/cat.png is the object key... and the bucket named uploads happens to be a bucket that returns the AllAccessDisabled error... so the real error here is that you are accessing the wrong bucket.

like image 20
Michael - sqlbot Avatar answered Oct 20 '22 00:10

Michael - sqlbot