Is it possible to get the ARN of an S3 bucket via the AWS command line?

I have looked through the documentation for aws s3api ... and aws s3 ... and have not found a way to do this.

share|improve this question
up vote 8 down vote accepted

It's always arn:aws:s3:::NAME-OF-YOU-BUCKET. If you know the name of the bucket, you know the ARN. No need to 'get' it from anywhere.

share|improve this answer
    
Probably why your AWS S3 bucket names have to be globally unique; but it's a horrid wart to couple these together that way. The interpolation of an account ID into that ARN would be much better. :( – Jim Dennis Dec 20 '16 at 23:59
    
Was hoping for a way to do this without making any assumptions about the ARN format. Buckets in cn-north-1 region are arn:aws-cn:s3:::BUCKET_NAME and I was hoping to avoid having to "know" how Amazon assigned ARNs in case Amazon were to change the rules. – ljcundiff Dec 21 '16 at 0:33
2  
@ljcundiff an ARN is a non-opaque, constructible identifier, apparently by design. They aren't at all likely to change the documented rules for the S3 ARN format. The cn-north-1 region is special case, as is GovCloud, because those are completely cordoned off from the global aws partition, not accessible with the same sets of keys. If you're working in multiple partitions, you have to know which partition you're dealing with. – Michael - sqlbot Dec 21 '16 at 0:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.