Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find/check current permissions in AWS S3 using cli?

I'm quite happy with the speed of aws cli But can't seem to find a way to find out what the permissions are on a file/folder.

E.g. I do:

$ curl http://my.s3.amazonaws.com/deploy/tool1/license.key -o ./license.key
$ cat license.key | sed 's/></>\n</g'
<?xml version="1.0" encoding="UTF-8"?>
<Error>
<Code>AccessDenied</Code>
<Message>Access Denied</Message>
<RequestId>E4D50F0606FFFD48</RequestId>
<HostId>+xxxyyyaaaa=</HostId>

$
$

Now curl http://my.s3.amazonaws.com/deploy/tool1/tool.sh -o ./tool.sh works just fine and I can get the tool.sh. So I suspect teh permissions on license.key to be the problem.

like image 622
Kashyap Avatar asked Feb 04 '16 19:02

Kashyap


Video Answer


1 Answers

In order to get the permissions on a file in S3 with the CLI, use the get-object-acl command of s3api (full documentation http://docs.aws.amazon.com/cli/latest/reference/s3api/get-object-acl.html)

Using your example:

$ aws s3api get-object-acl \
    --bucket my \
    --key deploy/tool1/license.key
like image 59
Max Avatar answered Sep 24 '22 16:09

Max